0001 function [status, result]=wave2mlf2(waveFile, text, mlfFile, plotOpt)
0002
0003
0004
0005
0006
0007
0008 if nargin<1, selfdemo; return; end
0009 if nargin<4, plotOpt=0; end
0010
0011 tempWavFile=[tempname, '.wav'];
0012 wave2wave(waveFile, tempWavFile, 16000, 16);
0013
0014
0015 tempFile=tempname;
0016 fid=fopen(tempFile, 'w');
0017 tempWavFile=strrep(tempWavFile, '/', '\');
0018 text=strrep(text, ' ', '_');
0019 text=strrep(text, '?', '');
0020 text=strrep(text, '.', '');
0021 text=lower(text);
0022 fprintf(fid, '%s %s\n', tempWavFile, text);
0023 fclose(fid);
0024
0025 [parentDir, junk, junk, junk]=fileparts(which(mfilename));
0026 alignDir=[parentDir, '\align.eng.obj'];
0027 cmd=[alignDir, '\alignment.bat ', tempFile, ' ', mlfFile];
0028 disp(cmd);
0029 [status, result]=dos(cmd);
0030
0031 if plotOpt
0032 waveMlfPlot(waveFile, mlfFile);
0033 end
0034
0035
0036 function selfdemo
0037 waveFile='what_movies_have_you_seen_recently.wav';
0038 waveFile='how_many_people_do_you_talk_to_every_day.wav';
0039 mlfFile=[waveFile(1:end-3), 'mlf'];
0040 text=waveFile(1:end-4); text=strrep(text, '_', ' ');
0041 plotOpt=1;
0042 feval(mfilename, waveFile, text, mlfFile, plotOpt);