为什么80%的码农都做不了架构师?>>>
NG 的 Machine Learning 公开课中讲了鸡尾酒聚会算法。可以将语音源 1 和语音源 2 混合在一起的声音还原。这个算法和频谱分析有关。
实现
[x1, Fs1] = wavread('mix1.wav');
[x2, Fs2] = wavread('mix2.wav');
xx = [x1, x2]';
yy = sqrtm(inv(cov(xx')))*(xx-repmat(mean(xx,2),1,size(xx,2)));
[W,s,v] = svd((repmat(sum(yy.*yy,1),size(yy,1),1).*yy)*yy');
a = W*xx; %W is unmixing matrix
subplot(2,2,1); plot(x1); title('mixed audio - mic 1');
subplot(2,2,2); plot(x2); title('mixed audio - mic 2');
subplot(2,2,3); plot(a(1,:), 'g'); title('unmixed wave 1');
subplot(2,2,4); plot(a(2,:),'r'); title('unmixed wave 2');
wavwrite(a(1,:), Fs1, 'unmixed1.wav');
wavwrite(a(2,:), Fs1, 'unmixed2.wav');
参考
http://stackoverflow.com/questions/20414667/cocktail-party-algorithm-svd-implementation-in-one-line-of-code
http://blog.sciencenet.cn/blog-696950-699432.html