gocount.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- % This script plots word counts with respect to min. energy level (threshold).
- % ====== Load all wave data
- if ~exist('waveData'),
- fprintf('Loading waveData.matn');
- load waveData.mat
- end
- % ====== Get rid of English singers
- index = [];
- for i = 1:length(waveData);
- if any(abs(waveData(i).answer)<127),
- index = [index, i];
- end
- end
- waveData(index) = [];
- waveNum = length(waveData);
- % ====== Set parameters
- P.frameSize = 256;
- P.overlap = 86;
- minEnergy = linspace(0.0001, 0.04, 10);
- % ====== Get word count of each wave file
- correct = zeros(length(minEnergy), waveNum);
- h = waitbar(0, ['Get word count of ', num2str(waveNum), ' wave files...']);
- for i = 1:waveNum;
- % fprintf('%g/%gn', i, waveNum);
- waitbar(i/waveNum, h)
- wavefile = waveData(i).wavepath;
- wdcount = wdcnt(wavefile, P, minEnergy, 0);
- % wdcount = wdcnt(wavefile, P, minEnergy, 1);
- % pause
- correct(:,i) = (wdcount==length(waveData(i).answer))';
- end
- close(h)
- % ====== Plot the recognition rate w.r.t. min. energy
- rate = sum(correct, 2)/waveNum;
- plot(minEnergy, rate, '-o');
- xlabel('minEnergy');
- ylabel('Correct Rate');
- [a, b] = max(rate);
- optMinEnergy = minEnergy(b);
- fprintf('Max. recognition rate = %g (when minEnergy = %g)n', a, optMinEnergy);