Mercurial > hg > ishara
view dsp/mk_mfcc.m @ 42:ae596261e75f
Various fixes and development to audio handling
author | samer |
---|---|
date | Tue, 02 Dec 2014 14:51:13 +0000 |
parents | c3b0cd708782 |
children |
line wrap: on
line source
% mk_mfcc - Function factory, makes MFCC functions % % mk_mfcc :: % I:[[M]->[N]] ~'selects which rows of DCT to compute', % N:natural ~'size of input', % nonneg ~'sampling rate' % -> ([[N]]->[[M]]). function f = mk_mfcc(M,N,fs) Nfft = 2^nextpow2(N+1); Nspec= dftbins(Nfft); wndw = spdiag(hamming(N,'periodic')); melW = tri_filterbank(melspace(400/3,min(7000,fs/2),42),fs*(0:Nspec-1)/Nfft); dctW = row(dct(eye(size(melW,1))),M); f=@mfcc; function y=mfcc(x) ft = fft(wndw*x,Nfft); y = dctW*log(melW*abs(ft(1:Nspec,:)).^2); end end