christopherh@1: % christopherh@1: % MLF2LAB Convert mlf file to lab file christopherh@1: % christopherh@1: % mlf2lab(inputfile, labfile) christopherh@1: % christopherh@1: % Converts a '.mlf' transcription file "inputfile" to a wavesurfer '.lab' christopherh@1: % transcription file "labfile". christopherh@1: % christopherh@1: % See also labread, labwrite, checklabsyntax. christopherh@1: % christopherh@1: % Author: Christopher Harte, March 2009 christopherh@1: % christopherh@1: % Copyright: Centre for Digital Music, Queen Mary University of London 2005 christopherh@1: % christopherh@1: % This file is part of the C4DM Chord Toolkit V2.0 christopherh@1: % christopherh@1: % The C4DM Chord Toolkit is free software; you can redistribute it and/or christopherh@1: % modify it under the terms of the GNU General Public License as published christopherh@1: % by the Free Software Foundation; either version 2 of the License, or christopherh@1: % (at your option) any later version. christopherh@1: % christopherh@1: % The C4DM Chord Toolkit is distributed in the hope that it will be useful, christopherh@1: % but WITHOUT ANY WARRANTY; without even the implied warranty of christopherh@1: % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the christopherh@1: % GNU General Public License for more details. christopherh@1: % christopherh@1: % You should have received a copy of the GNU General Public License christopherh@1: % along with the C4DM Toolkit; if not, write to the Free Software christopherh@1: % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA christopherh@1: christopherh@1: % christopherh@1: function mlf2lab(inputfile, labfile) christopherh@1: christopherh@1: christopherh@1: [timestamps, timestamps2, stamps] = textread(inputfile, '%f %f %s'); christopherh@1: christopherh@1: christopherh@1: newtimes = timestamps./10000000; christopherh@1: newtimes2 = timestamps2./10000000; christopherh@1: christopherh@1: christopherh@1: fid = fopen(labfile, 'w'); christopherh@1: christopherh@1: for i = 1:length(newtimes) christopherh@1: christopherh@1: outtext = ['%f %f ' char(stamps(i)) '\n']; christopherh@1: christopherh@1: fprintf(fid, outtext, newtimes(i), newtimes2(i)); christopherh@1: christopherh@1: end christopherh@1: christopherh@1: fclose(fid); christopherh@1: christopherh@1: