annotate _misc/featureextraction/.svn/text-base/chunkspectrogram_ISMIR2010.m.svn-base @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function [s,f,t] = chunkspectrogram_ISMIR2010(filename,d_windo,d_nOverlap,d_nFFT, maxf)
matthiasm@8 2 %%
matthiasm@8 3 % d_ are the downsampled things
matthiasm@8 4 % o_ are the original things
matthiasm@8 5
matthiasm@8 6
matthiasm@8 7 d_fs = 11025;
matthiasm@8 8
matthiasm@8 9 [filesize, o_fs] = wavread(filename,'size');
matthiasm@8 10
matthiasm@8 11
matthiasm@8 12
matthiasm@8 13 if mod(o_fs/d_fs,1) ~= 0
matthiasm@8 14 error('The sample frequency of the wave file has to be an integer multiple of %1.0f.',d_fs);
matthiasm@8 15 end
matthiasm@8 16 downsample = o_fs/d_fs;
matthiasm@8 17
matthiasm@8 18 o_windo = d_windo * downsample;
matthiasm@8 19 o_nOverlap = d_nOverlap * downsample;
matthiasm@8 20 o_hopSize = o_windo-o_nOverlap;
matthiasm@8 21 nFrame = floor((filesize(1) - o_windo) / o_hopSize);
matthiasm@8 22
matthiasm@8 23 s = zeros(d_nFFT/2, nFrame);
matthiasm@8 24 f = (0:d_nFFT/2-1)/d_fs;
matthiasm@8 25 t = zeros(nFrame,1);
matthiasm@8 26
matthiasm@8 27 wind = hamming(d_windo);
matthiasm@8 28 wind = wind/sum(wind);
matthiasm@8 29
matthiasm@8 30 for iLine = 1:round(nFrame/200)
matthiasm@8 31 fprintf(1,'_');
matthiasm@8 32 end
matthiasm@8 33 fprintf(1,'\n');
matthiasm@8 34
matthiasm@8 35 for iFrame = 1:nFrame
matthiasm@8 36 if mod(iFrame,200) == 0
matthiasm@8 37 fprintf(1,'.');
matthiasm@8 38 end
matthiasm@8 39 ind = [1,o_windo] + (iFrame-1) * (o_hopSize);
matthiasm@8 40 wave = sum(wavread(filename, ind),2) / 2;
matthiasm@8 41 temp = fft(resample(wave,d_fs,o_fs) .* wind);
matthiasm@8 42 s(:, iFrame) = temp(1:d_nFFT/2);
matthiasm@8 43 t(iFrame) = (ind(1) + ind(2)) / 2 / o_fs;
matthiasm@8 44 end
matthiasm@8 45 fprintf(1,'\n');