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 / _song / song_beat.m

History | View | Annotate | Download (727 Bytes)

1
function song = song_beat(song, param)
2
switch param.beattype
3
    case 'auto'
4
        rhythm = getmeasures4(fullfile(song.wavpath, [song.filenametrunk, '.wav']));
5
        beattimes = rhythm.beats';
6

    
7
        [sz, fs] = wavread(fullfile(song.wavpath, [song.filenametrunk, '.wav']),'size');
8
        songLength = sz(1)/fs;
9

    
10
        song.beattimes  = [beattimes, [beattimes(2:end); songLength]];
11
        song.nBeat = size(song.beattimes,1);
12
    case 'autoprecalculated'
13
        load(param.metafilename);
14
        song.beattimes = beattimes_auto;
15
        song.nBeat = size(song.beattimes,1);
16
    case 'manual'
17
        load(param.metafilename);
18
        song.beattimes = beattimes_manual;
19
        song.nBeat = size(song.beattimes,1);
20
end