getKmeansParam.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- % Get Kmeans parameters from speakerData.mat
- addpath usersjangmatlabtoolboxdcpr
- centerNum = 16; % No. of centers for each speaker
- if ~exist('speakerData'),
- fprintf('Loading speakerData.mat...n');
- load speakerData.mat
- end
- tic
- fprintf('Compute Kmeans parameters for each speaker...n');
- for i=1:length(speakerData),
- fprintf('Computing Kmeans parameters for speaker %g (%s) ===> ', ...
- i, speakerData(i).speaker);
- feature = speakerData(i).feature;
- % Run 10 times of Kmeans to find the min. objective function
- optObjFcn = inf;
- for j=1:10,
- fprintf('Run %g of Kmeans:n', j);
- [center, U, objFcn] = kmeans(feature', centerNum, [nan, 1000, nan, 1]);
- if objFcn(1) < optObjFcn,
- optObjFcn = objFcn(1);
- speakerData(i).kmeansParam = center;
- end
- end
- end
- fprintf('Total time = %gn', toc);
- fprintf('Saving speakerData to speakerData.mat...n');
- save speakerData speakerData