livedemo1.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- fs = 8000;
- duration = 3;
- if ~exist('waveData'),
- fprintf('Loading waveData.mat...n');
- load waveData.mat
- end
- while(1)
- fprintf('Hit return to start %g-second recording...n', duration);
- pause;
- fprintf('Start recording ...n');
- y = wavrecord(duration*fs, fs, 'uint8');
- y = (double(y)-128)/128;
- fprintf('Finish %g-second of recording.n', duration);
- feature = wav2ftr(y);
- waveNum = length(waveData);
- for i=1:waveNum,
- waveData(i).dist = dtwasr(feature, waveData(i).feature, 2);
- end
- [a, b] = sort([waveData.dist]);
- for i = 1:10,
- fprintf('%g: %s (by %s, distance=%g)n', i, waveData(b(i)).answer, waveData(b(i)).speaker, waveData(b(i)).dist);
- end
- end