0001
0002
0003
0004 addMyPath;
0005
0006
0007 duration=3;
0008 fs=16000;
0009 waveFile='test.wav';
0010 language='chinese';
0011 text='´ÂÃã¥Õ«Ò±m¶³¶¡';
0012
0013
0014 while 1
0015 textByUser=input(sprintf('Please enter your text in English or Chinese [%s]: ', text), 's');
0016 if isempty(textByUser)
0017 textByUser=text;
0018 else
0019 text=textByUser;
0020 end
0021 if any(abs(text)>128)
0022 language='chinese';
0023 else
0024 language='english';
0025 end
0026 languageByUser=input(sprintf('Please enter the language [%s]: ', language), 's');
0027 if isempty(languageByUser)
0028 languageByUser=language;
0029 else
0030 language=languageByUser;
0031 end
0032 fprintf('Hit return to start %d-sec recording of "%s": ', duration, text);
0033 pause
0034 fprintf('\nRecording...');
0035 y=wavrecord(duration*fs, fs, 1);
0036 wavwrite(y, fs, 16, waveFile);
0037 sound(y, fs);
0038 fprintf('Finish recording\n');
0039 fprintf('Start assessment...\n');
0040
0041 plotOpt=1;
0042 pitchFile='test.pitch';
0043 [finalScore1, dosCmd]=waveAssess(waveFile, text, language, plotOpt, pitchFile);
0044
0045 fprintf('Done with assessment...\n');
0046 end