livedemo2.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- fs = 8000;
- duration = 3;
- if ~exist('speakerData'),
- fprintf('Loading speakerData.mat...n');
- load speakerData.mat
- end
- addpath /users/jang/matlab/toolbox/dcpr
- 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);
- speakerNum = length(speakerData);
- for i=1:speakerNum,
- logprob(i) = -sum(log(evalgmm(feature', ...
- speakerData(i).param.M, ...
- speakerData(i).param.V, ...
- speakerData(i).param.W)));
- end
- [a, b] = sort(logprob);
- for i = 1:speakerNum,
- fprintf('%g: %s (log prob=%g)n', i, speakerData(b(i)).speaker, logprob(b(i)));
- end
- end