Isolate a period of a sound

조회 수: 3 (최근 30일)
George
George 2013년 12월 3일
Hey, I have an array of over 100K values from a wavread audio file with a pretty high sampling rate. It is the sound of a dog barking 4 times. I would like to isolate 1 bark. I've tried filtering the data so that everything beneath a signal value of 0.05 goes to 0 and everything above goes to 1. It looks like a step function, except for the fact that there are values in between that are also 0. I would like to just isolate 1 period, but I don't know how to get the indices of the FINAL drop from 1 to 0. ... not the ones in the middle.
Here's what I've tried, thanks in advance!:
%% read in the file and isolate 1 sound [Y, FS] = wavread('Bark');
%% Isolate one sound period Yabs = abs(Y); % absolute value of signal figure(999);plot(Yabs) %visualize for n = 1:length(Yabs); if Yabs(n) > 0.05; Yabs(n) = 1; else Yabs(n) = 0; %filter low signal end end
figure(888); plot(Yabs); %visualize filtered signal
% tol = 50; % for n = 1:length(Yabs-tol) % if Yabs(n+tol)-Yabs(n) == 1 % indstart = n-750; % -750 to grab the rest of the signal beneath the threshold % end % if Yabs(n+tol)-Yabs(n) == -1 % indend = n+tol; % break % end % end
Period = [indstart, indend]
Ysolo = Y(Period(1):Period(2));
% Ysolo is the isolated period.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by