[50] | 1 | % directory where the WAV-files of the birds are stored: |
---|
| 2 | dpath = fullfile(mildatapath,'birds'); |
---|
| 3 | |
---|
[53] | 4 | fname = 'PC13_20090531_050000_1.wav'; |
---|
[50] | 5 | %fname = 'PC8_20090531_050000_99.wav'; |
---|
| 6 | [signal,fs] = wavread(fullfile(dpath,'wavs',fname)); |
---|
| 7 | |
---|
| 8 | [S,f,t] = spectrogram(signal,512,256,[],fs); |
---|
[54] | 9 | fmax = 256;%Defined in paper |
---|
[50] | 10 | |
---|
[52] | 11 | figure(2); clf; showspec(S,f,t); |
---|
[54] | 12 | [S,f,t] = spectrogram(signal,512,256,fmax,fs); |
---|
| 13 | |
---|
| 14 | figure(2); imagesc(t,f,abs(S)); |
---|
| 15 | axis xy; xlabel('time (s)'); ylabel('freq.'); |
---|
| 16 | |
---|
[52] | 17 | figure(3); clf; showspec(imag(S), f,t); |
---|
[50] | 18 | |
---|
[53] | 19 | % smooth and threshold the spectrogram? |
---|
| 20 | G = fspecial('gaussian',[5 5],2); % window 5x5, sigma=2 |
---|
| 21 | I = imfilter(abs(S),G,'same'); |
---|
| 22 | t = dd_threshold(I(:),0.8); |
---|
| 23 | mask = (I>t); |
---|
| 24 | mask(f<2000,:) = 0; |
---|
| 25 | |
---|
| 26 | figure(4); clf; imagesc(mask); axis xy; |
---|
| 27 | |
---|
| 28 | |
---|
[54] | 29 | |
---|
| 30 | %% |
---|
| 31 | s2 = whiten(S,fmax); |
---|
| 32 | figure(4); imagesc(t,f,s2); |
---|
| 33 | axis xy; xlabel('time (s)'); ylabel('freq.'); |
---|