getfeat_b.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- % Get features of all wave files and save them into a single mat file
- addpath mex
- singers = textread('singer.txt', '%s');
- for i=1:length(singers),
- singers{i} = singers{i}(findstr(singers{i},'.')+1:end);
- end
- dirinfo = dir('wavefile');
- speakers = {dirinfo.name};
- speakers(1:2) = []; % Get rid of "." and ".."
- % ====== Compute features
- index = 1;
- for i=1:length(speakers),
- for j=1:length(singers),
- fprintf('index = %gn', index);
- wavefile = ['wavefile', speakers{i}, '', num2str(j), '.wav'];
- [y, fs, nbits] = wavread(wavefile);
- waveData(index).speaker = speakers{i};
- waveData(index).answer = singers{j};
- waveData(index).feature = wav2ftr(y);
- index = index + 1;
- end;
- end;
- % ====== Compute distance matrix
- waveNum = length(waveData);
- distmat = zeros(waveNum);
- for i=1:waveNum;
- fprintf('i = %dn', i);
- for j=1:waveNum;
- distmat(i,j) = dtwasr(waveData(i).feature, waveData(j).feature, 2);
- end
- end
- save waveData waveData distmat