% directory where the WAV-files of the birds are stored: dpath = fullfile(mildatapath,'birds'); fname = 'PC13_20090531_050000_0.wav'; %fname = 'PC8_20090531_050000_99.wav'; [signal,fs] = wavread(fullfile(dpath,'wavs',fname)); [S,f,t] = spectrogram(signal,512,256,[],fs); fmax = 256;%Defined in paper figure(2); clf; showspec(S,f,t); [S,f,t] = spectrogram(signal,512,256,fmax,fs); figure(2); imagesc(t,f,abs(S)); axis xy; xlabel('time (s)'); ylabel('freq.'); figure(3); clf; showspec(imag(S), f,t); % smooth and threshold the spectrogram? G = fspecial('gaussian',[5 5],2); % window 5x5, sigma=2 I = imfilter(abs(S),G,'same'); t = dd_threshold(I(:),0.8); mask = (I>t); mask(f<2000,:) = 0; figure(4); clf; imagesc(mask); axis xy; % measure something: x = regionprops(bwlabel(mask),abs(S)); y = x([x.Area]>10) %% s2 = whiten(S,fmax); figure(4); imagesc(t,f,s2); axis xy; xlabel('time (s)'); ylabel('freq.');