genwavedata.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- % Get MFCC of all wave files and save them into a single mat file
- % Find the speakers automatically
- dirinfo = dir('wavefile');
- speakers = {dirinfo.name};
- speakers(1:2) = []; % Get rid of "." and ".."
- % ====== Compute no. of total files
- waveNum = 0;
- for i=1:length(speakers),
- dirinfo = dir(['wavefile/', speakers{i}, '/*.wav']);
- singerNames = {dirinfo.name};
- waveNum = waveNum + length(singerNames);
- end
- h = waitbar(0, ['Converting ', num2str(waveNum), ' wave files to mat structure ...']);
- % ====== Compute features
- index = 1;
- for i=1:length(speakers),
- dirinfo = dir(['wavefile/', speakers{i}, '/*.wav']);
- singerNames = {dirinfo.name};
- for j=1:length(singerNames),
- waitbar(index/waveNum);
- % fprintf('%g/%gn', index, waveNum);
- wavefile = ['wavefile', speakers{i}, '', singerNames{j}];
- [y, fs, nbits] = wavreadc(wavefile);
- waveData(index).speaker = speakers{i};
- waveData(index).gender = eval(speakers{i}(1));
- waveData(index).answer = singerNames{j}(1:end-4);
- waveData(index).feature = wave2mfccmex(y);
- waveData(index).frameNum = size(waveData(index).feature, 2);
- waveData(index).wavepath = wavefile;
- index = index + 1;
- end;
- end;
- close(h);
- save waveData waveData