📄 main.asv
字号:
%*************** setup sources **********
format compact
%**** if you are mixing the sources yourself:
sources=readsounds(['man.wav';'man.wav']);
[N,P]=size(sources);
permute=randperm(P);
s=sources(:,permute);
a=[1 2; 1 1];
x=a*s;
mixes=a*sources;
%**** if you are loading already-mixed sources:
%mixes=readsounds(['mix2';'mix1']); % see "help readsounds"
%**** prewhite the data
mx=mean(mixes');
c=cov(mixes');
x=x-mx'*ones(1,P); % subtract means from mixes
wz=2*inv(sqrtm(c)); % get decorrelating matrix
x=wz*x; % decorrelate mixes so cov(x')=4*eye(N);
%****
w=eye(N); % init. unmixing matrix, or w=rand(M,N);
M=size(w,2); % M=N usually
sweep=0;
oldw=w;
olddelta=ones(1,N*N);
Id=eye(M);
%************* this learns: "help sep" explains all
% only two sources,choose L=0.01; B=30;
L=0.01; B=30; sep
% more than two sources,choose L=0.001; B=30;
%L=0.001; B=30; sep
% more than one hundred sources,choose L=0.01; B=30;
%L=0.0001; B=30; sep % and so on
%for multiple sweeps:
%L=0.005; B=30;
%for I=1:10000, sep; end;
%***************************************
mixes=a*sources; % make mixed sources
sound(mixes(1,:)) % play the first one (if it is audio)
plot(mixes(1,:)) % plot the first one (if it is another signal)
uu=w*wz*mixes; % make unmixed sources
sound(uu(1,:)) % play the first one (if it is audio)
plot(uu(1,:)) % plot the first one (if it is another signal)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -