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


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


newtimes = timestamps./10000000;
newtimes2 = timestamps2./10000000;


fid = fopen(labfile, 'w');

for i = 1:length(newtimes)
    
    outtext = ['%f %f ' char(stamps(i)) '\n'];
    
    fprintf(fid, outtext, newtimes(i), newtimes2(i));
    
end

fclose(fid);


