source: birds/domilbirds.m @ 56

Last change on this file since 56 was 56, checked in by dtax, 11 years ago

A bit more..

File size: 915 bytes
RevLine 
[50]1% directory where the WAV-files of the birds are stored:
2dpath = fullfile(mildatapath,'birds');
3
[56]4fname = 'PC13_20090531_050000_0.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]9fmax = 256;%Defined in paper
[50]10
[52]11figure(2); clf; showspec(S,f,t);
[54]12[S,f,t] = spectrogram(signal,512,256,fmax,fs);
13
14figure(2); imagesc(t,f,abs(S));
15axis xy; xlabel('time (s)'); ylabel('freq.');
16
[52]17figure(3); clf; showspec(imag(S), f,t);
[50]18
[53]19% smooth and threshold the spectrogram?
20G = fspecial('gaussian',[5 5],2); % window 5x5, sigma=2
21I = imfilter(abs(S),G,'same');
22t = dd_threshold(I(:),0.8);
23mask = (I>t);
24mask(f<2000,:) = 0;
25
26figure(4); clf; imagesc(mask); axis xy;
[56]27% measure something:
28x = regionprops(bwlabel(mask),abs(S));
29y = x([x.Area]>10)
[53]30
31
[54]32
33%%
34s2 = whiten(S,fmax);
35figure(4); imagesc(t,f,s2);
36axis xy; xlabel('time (s)'); ylabel('freq.');
Note: See TracBrowser for help on using the repository browser.