% EXAMPLE_INST Example of use of software routines for the separation of an % instantaneous mixture % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2008 Emmanuel Vincent % This software is distributed under the terms of the GNU Public License % version 3 (http://www.gnu.org/licenses/gpl.txt) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Input time-frequency representation x=wavread('dev1/dev1_male4_inst_mix.wav').'; X=stft_multi(x); % Estimation of the number of sources nsrc=count_inst(X); % Estimation of the mixing matrix Ae=estmix_inst(X,nsrc); mkdir('results'); save('results/dev1_male4_inst_matrix.mat','Ae'); % Evaluation of the estimated mixing matrix load('dev1/dev1_male4_inst_matrix.mat'); [MER,perm]=bss_eval_mix(Ae,A); % Source separation via l0-norm minimization S=sep_l0min(X,Ae); se=istft_multi(S,160000); for j=1:nsrc, wavwrite(se(j,:).',16000,['results/dev1_male4_inst_src_' int2str(j) '.wav']); end % Evaluation of the estimated sources s=zeros(4,160000); for j=1:4, s(j,:)=wavread(['dev1/dev1_male4_src_' int2str(j) '.wav']).'; end [SDRs,SIRs,SARs,perms]=bss_eval_sources(se,s); % Computation of the spatial source images I=src_image(S,Ae); ie=istft_multi(I,160000); for j=1:nsrc, wavwrite(reshape(ie(j,:,:),160000,2),16000,['results/dev1_male4_inst_sim_' int2str(j) '.wav']); end % Evaluation of the estimated source images i=zeros(4,160000,2); for j=1:4, i(j,:,:)=reshape(wavread(['dev1/dev1_male4_inst_sim_' int2str(j) '.wav']),1,160000,2); end [SDRi,ISRi,SIRi,SARi,permi]=bss_eval_images(ie,i); % Ideal binary masking benchmark (STFT) b1=sep_ibm(x,i); [SDRb1,ISRb1,SIRb1,SARb1]=bss_eval_images_nosort(b1,i); % Ideal binary masking benchmark (Cochleagram) b2=zeros(4,160000,2); for j=1:4, ibm=generateIBM(reshape(i(j,:,:),160000,2),reshape(sum(i([1:j-1 j+1:4],:,:),1),160000,2)); b2(j,:,:)=generateEstimate(x.',ibm); end [SDRb2,ISRb2,SIRb2,SARb2]=bss_eval_images_nosort(b2,i);