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 / _chordtools / mlf2lab.m @ 8:b5b38998ef3b

History | View | Annotate | Download (1.48 KB)

1
%
2
% MLF2LAB Convert mlf file to lab file
3
% 
4
% mlf2lab(inputfile, labfile)
5
% 
6
% Converts a '.mlf' transcription file "inputfile" to a wavesurfer '.lab' 
7
% transcription file "labfile".
8
% 
9
% See also labread, labwrite, checklabsyntax.
10
%
11
% Author: Christopher Harte,  August 2005
12
% 
13
% Copyright: Centre for Digital Music, Queen Mary University of London 2005 
14
%
15
% This file is part of the C4DM Chord Toolkit.  
16
%
17
% The C4DM Chord Toolkit is free software; you can redistribute it and/or 
18
% modify it under the terms of the GNU General Public License as published 
19
% by the Free Software Foundation; either version 2 of the License, or
20
% (at your option) any later version.
21
%
22
% The C4DM Chord Toolkit is distributed in the hope that it will be useful,
23
% but WITHOUT ANY WARRANTY; without even the implied warranty of
24
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
% GNU General Public License for more details.
26
%
27
% You should have received a copy of the GNU General Public License
28
% along with the C4DM Toolkit; if not, write to the Free Software
29
% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
30
		
31
%
32
function mlf2lab(inputfile, labfile)
33

    
34

    
35
[timestamps, timestamps2, stamps] = textread(inputfile, '%f %f %s');
36

    
37

    
38
newtimes = timestamps./10000000;
39
newtimes2 = timestamps2./10000000;
40

    
41

    
42
fid = fopen(labfile, 'w');
43

    
44
for i = 1:length(newtimes)
45
    
46
    outtext = ['%f %f ' char(stamps(i)) '\n'];
47
    
48
    fprintf(fid, outtext, newtimes(i), newtimes2(i));
49
    
50
end
51

    
52
fclose(fid);
53

    
54