To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _beattracker / getmeasures2.m

History | View | Annotate | Download (653 Bytes)

1
function out = getmeasures2(fname,ts);
2

    
3
if nargin<2
4
	% optional argument to hand label the timesignature
5
    ts = 0;
6
end
7

    
8

    
9
[x fs] = wavread(fname);
10
x = mean(x,2);
11

    
12
if fs~=11025,
13
    x = resample(x,11025,fs);
14
end
15

    
16
x = x + randn(length(x),1) * 0.0000001;
17

    
18
df = get_dfs(x,bt_parms(0.01161*4));
19
disp 'onset detection function'
20

    
21
[beats,localscore,timesig] = newtt_hmm_dp(df{1});
22
disp 'beats'
23

    
24
[bcf,frame] = getbcfs2(fname,beats);
25
if~timesig, timesig = 4; end
26

    
27
if ts
28
    measures = bcfm(bcf.spec,beats,ts);
29
else
30
    measures = bcfm(bcf.spec,beats,timesig);
31
end
32

    
33

    
34

    
35
out.beats = beats/44100;
36
out.measures = measures/44100;
37
out.timesig = timesig;
38
out.df = df{1};