boblsturm@0: function Y = chromagram_E(d,sr,fftlen,nbin,f_ctr,f_sd) boblsturm@0: % Y = chromagram_E(d,sr,fftlen,nbin) boblsturm@0: % Calculate a "chromagram" of the sound in d (at sampling rate sr) boblsturm@0: % Use windows of fftlen points, hopped by ffthop points boblsturm@0: % Divide the octave into nbin steps boblsturm@0: % Weight with center frequency f_ctr (in Hz) and gaussian SD f_sd (in octaves) boblsturm@0: % 2006-09-26 dpwe@ee.columbia.edu boblsturm@0: boblsturm@0: if nargin < 3; fftlen = 2048; end boblsturm@0: if nargin < 4; nbin = 12; end boblsturm@0: if nargin < 5; f_ctr = 1000; end boblsturm@0: if nargin < 6; f_sd = 1; end boblsturm@0: boblsturm@0: fftwin = fftlen/2; boblsturm@0: ffthop = fftlen/4; % always for this boblsturm@0: boblsturm@0: D = abs(specgram(d,fftlen,sr,fftwin,(fftwin-ffthop))); boblsturm@0: boblsturm@0: A0 = 27.5; % Hz boblsturm@0: A440 = 440; % Hz boblsturm@0: boblsturm@0: f_ctr_log = log(f_ctr/A0) / log(2); boblsturm@0: boblsturm@0: CM = fft2chromamx(fftlen, nbin, sr, A440, f_ctr_log, f_sd); boblsturm@0: % Chop extra dims boblsturm@0: CM = CM(:,1:(fftlen/2)+1); boblsturm@0: boblsturm@0: Y = CM*D;