keyword.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- % Live demo/test for keyword spotting
- close all
- more off
- fs = 8000;
- duration = 3;
- % Record the keyword first
- fprintf('Hit return to start %g-second recording of your KEYWORDn', duration);
- pause;
- fprintf('Start recording ...n');
- y2 = wavrecord(duration*fs, fs, 'uint8');
- y2 = (double(y2)-128)/128;
- fprintf('Finish %g-second of recording.n', duration);
- vec2 = wav2ftr(y2);%MFCC特征提取
- % Start testing
- fprintf('The following recording will be used to compare with your keyword.nn');
- while(1)
- fprintf('Hit return to start %g-second recording...n', duration);
- pause;
- fprintf('Start recording ...n');
- y1 = wavrecord(duration*fs, fs, 'uint8');
- y1 = (double(y1)-128)/128;
- fprintf('Finish %g-second of recording.n', duration);
- vec1 = wav2ftr(y1);
- save speech vec1 vec2
- % ====== Solution obtained by DTW
- [minDist, DTWpath] = dtwmex2(vec1, vec2);%
- fprintf('DTW distance = %gn', minDist);%
- fprintf('Linear warping distance = %gn', lwarp(vec1, vec2));
- dtwplot(vec1, vec2, DTWpath);
- end