getdist.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- load waveData.mat
- allSpeakers = {waveData.speaker};
- index1 = findcell(allSpeakers, '1Roger');
- index2 = findcell(allSpeakers, '1Gavins');
- index3 = findcell(allSpeakers, '1Gao');
- index4 = findcell(allSpeakers, '1Jtchen');
- index = [index1, index2, index3, index4];
- waveData = waveData(index);
- % ====== Compute distance matrix based on original features
- waveNum = length(waveData);
- distmat = zeros(waveNum);
- for i=1:waveNum;
- fprintf('i = %dn', i);
- for j=(i+1):waveNum;
- featureI = waveData(i).feature;
- featureJ = waveData(j).feature;
- distmat(i,j) = dtwmex0(featureI, featureJ, 2, 1);
- end
- end
- distmat = distmat+distmat';
- save dist0 distmat
- % ====== Feature transformation
- feature = cat(2, waveData.feature);
- mu = mean(feature, 2);
- sigma = sqrt(diag(cov(feature')));
- feature = (feature-mu*ones(1, size(feature,2)))./(sigma*ones(1,size(feature,2)));
- % ====== Compute distance matrix based on normalized features
- waveNum = length(waveData);
- distmat = zeros(waveNum);
- for i=1:waveNum;
- fprintf('i = %dn', i);
- for j=(i+1):waveNum;
- featureI = waveData(i).feature;
- dataNumI = size(featureI, 2);
- featureI = (featureI-mu*ones(1, dataNumI))./(sigma*ones(1,dataNumI));
- featureJ = waveData(j).feature;
- dataNumJ = size(featureJ, 2);
- featureJ = (featureJ-mu*ones(1, dataNumJ))./(sigma*ones(1,dataNumJ));
- distmat(i,j) = dtwmex0(featureI, featureJ, 2, 1);
- end
- end
- distmat = distmat+distmat';
- save dist1 distmat