Mercurial > hg > c4dm-chord-transcriptions
comparison chordtools/mlf2lab.m @ 1:8973548174c1 tip
adding tools to repo
author | christopherh |
---|---|
date | Mon, 06 May 2013 14:43:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:0a4ad3e72e75 | 1:8973548174c1 |
---|---|
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, March 2009 | |
12 % | |
13 % Copyright: Centre for Digital Music, Queen Mary University of London 2005 | |
14 % | |
15 % This file is part of the C4DM Chord Toolkit V2.0 | |
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 |