matthiasm@8: function out = getmeasures4(fname,ts); matthiasm@8: matthiasm@8: if nargin<2 matthiasm@8: % optional argument to hand label the timesignature matthiasm@8: ts = 0; matthiasm@8: end matthiasm@8: matthiasm@8: sz = wavread(fname,'size'); matthiasm@8: matthiasm@8: [x fs] = wavread(fname); matthiasm@8: x = mean(x,2); matthiasm@8: matthiasm@8: if fs~=11025, matthiasm@8: x = resample(x,11025,fs); matthiasm@8: end matthiasm@8: matthiasm@8: x = x + randn(length(x),1) * 0.0000001; matthiasm@8: matthiasm@8: df = get_dfs(x,bt_parms(0.01161*4)); matthiasm@8: disp 'onset detection function' matthiasm@8: matthiasm@8: [beats,localscore,timesig] = newtt_hmm_dp(df{1}); matthiasm@8: disp 'beats' matthiasm@8: matthiasm@8: % [bcf,frame] = getbcfs2(fname,beats); matthiasm@8: % if~timesig, timesig = 4; end matthiasm@8: % matthiasm@8: % if ts matthiasm@8: % measures = bcfm(bcf.spec,beats,ts); matthiasm@8: % else matthiasm@8: % measures = bcfm(bcf.spec,beats,timesig); matthiasm@8: % end matthiasm@8: reduced_fs = 86.12; matthiasm@8: % x = resample(x,reduced_fs,11025); matthiasm@8: % x = abs(x); matthiasm@8: winlength = round(reduced_fs/10/2)*2; matthiasm@8: win = gausswin(winlength); matthiasm@8: earlybeats = [0 mean([beats(2:end);beats(1:end-1)])]; matthiasm@8: matthiasm@8: matthiasm@8: matthiasm@8: matthiasm@8: % for iBeat = 1:length(beats) matthiasm@8: % beatindex = max(round(beats(iBeat)/(44100/reduced_fs)),winlength/2+1); matthiasm@8: % earlybeatindex = max(round(earlybeats(iBeat)/(44100/reduced_fs)),winlength/2+1); matthiasm@8: % % beatstrength = sum(x(beatindex-winlength/2+(1:winlength)) .* win); matthiasm@8: % beatstrength = sum(localscore(beatindex-winlength/2+(1:winlength))' .* win); matthiasm@8: % % earlybeatstrength = sum(x(earlybeatindex-winlength/2+(1:winlength)) matthiasm@8: % % .* win); matthiasm@8: % earlybeatstrength = sum(localscore(earlybeatindex-winlength/2+(1:winlength))' .* win); matthiasm@8: % if earlybeatstrength > 1.5 * beatstrength matthiasm@8: % beats(iBeat) = earlybeats(iBeat); matthiasm@8: % end matthiasm@8: % end matthiasm@8: matthiasm@8: out.beats = beats/44100; matthiasm@8: % out.measures = measures/44100; matthiasm@8: % out.timesig = timesig; matthiasm@8: % out.df = df{1};