matthiasm@8: function [bcf,frame,beats] = getbcfs2(fname,beats); matthiasm@8: matthiasm@8: matthiasm@8: matthiasm@8: if nargin<2 matthiasm@8: matthiasm@8: [x fs] = wavread(fname); matthiasm@8: x = mean(x,2); matthiasm@8: if fs~=44100 matthiasm@8: x = resample(x,44100,fs); matthiasm@8: end matthiasm@8: p = bt_parms; matthiasm@8: matthiasm@8: df = get_dfs(x(1:4:end),bt_parms(0.01161*4)); matthiasm@8: [beats,timesig] = newtt_mm(df{1},p); matthiasm@8: beats = beatadjust(beats,df{1}); matthiasm@8: end matthiasm@8: matthiasm@8: matthiasm@8: matthiasm@8: beats = beats(:)'; matthiasm@8: matthiasm@8: matthiasm@8: siz = wavread(fname,'size'); matthiasm@8: [x fs] = wavread(fname); matthiasm@8: x = mean(x,2); matthiasm@8: % if siz(2)>1 matthiasm@8: % x = mean(x')'; matthiasm@8: % end matthiasm@8: matthiasm@8: if fs ~= 44100 matthiasm@8: x = resample(x,44100,fs); matthiasm@8: end matthiasm@8: matthiasm@8: beats = round(beats); matthiasm@8: beats(beats>length(x)) = []; matthiasm@8: beats = sort(beats); matthiasm@8: %beats = beats - 4096; matthiasm@8: %beats(beats<1) = 1; matthiasm@8: matthiasm@8: % matthiasm@8: % spark = sparsekernel(110, 880, 36, 44100/16, 0.054); matthiasm@8: % spark(1025:end,:) = []; matthiasm@8: spark = 1; matthiasm@8: matthiasm@8: for k=1:length(beats)-1 matthiasm@8: % [spec(k,:),mfcc(k,:), cq(k,:),hpcp(k,:),chroma(k,:)] = chromaframe(x(beats(k):beats(k+1)),spark); matthiasm@8: [spec(k,:)] = chromaframe(x(beats(k):beats(k+1)),spark); matthiasm@8: matthiasm@8: end matthiasm@8: matthiasm@8: matthiasm@8: matthiasm@8: for k=1:size(spec,1)-1, matthiasm@8: matthiasm@8: % bcf.spec(k) = dobeatkl(spec(k,:),spec(k+1,:)); matthiasm@8: % bcf.cq(k) = dobeatkl(cq(k,:).^2,cq(k+1,:).^2); matthiasm@8: % bcf.hpcp(k) = dobeatkl(hpcp(k,:).^2,hpcp(k+1,:).^2); matthiasm@8: % bcf.chroma(k) = dobeatkl(chroma(k,:).^2,chroma(k+1,:).^2); matthiasm@8: % bcf.mfcc(k) = dobeatkl(mfcc(k,:).^2,mfcc(k+1,:).^2); matthiasm@8: bcf.spec(k) = dojsdiv2(spec(k,:),spec(k+1,:)); matthiasm@8: % bcf.cq(k) = dojsdiv2(cq(k,:),cq(k+1,:)); matthiasm@8: % bcf.hpcp(k) = dojsdiv2(hpcp(k,:),hpcp(k+1,:)); matthiasm@8: % bcf.chroma(k) = dojsdiv2(chroma(k,:),chroma(k+1,:)); matthiasm@8: % bcf.mfcc(k) = dojsdiv2(mfcc(k,:),mfcc(k+1,:)); matthiasm@8: matthiasm@8: end matthiasm@8: matthiasm@8: matthiasm@8: % bcf.spec=adapt_thresh(bcf.spec,2,1); matthiasm@8: matthiasm@8: frame.spec = spec; matthiasm@8: matthiasm@8: % % my added bit matthiasm@8: % temp = 0*spec; matthiasm@8: % for i=1:length(temp)-1 matthiasm@8: % temp(i)=spec(i)+0.2/spec(i+1); matthiasm@8: % end matthiasm@8: % frame.spec = temp; matthiasm@8: matthiasm@8: matthiasm@8: matthiasm@8: % frame.cq = cq; matthiasm@8: % frame.hpcp = hpcp; matthiasm@8: % frame.chroma = chroma; matthiasm@8: % frame.mfcc = mfcc; matthiasm@8: matthiasm@8: % for i=1:222, [c,n] = meterTracker(wavread(files(i+2).name),44100); kc{i} = round(44100*c.measures); kn{i} = round(44100*n.measures); if~mod(i,10),i,end; clear c; clear n; end