alice@0: %Script to run delay estimation analysis of filtered white noise at various alice@0: %bandwidths and with different window shapes alice@0: alice@0: alice@0: % Developer: - Alice Clifford (alice.clifford@eecs.qmul.ac.uk) alice@0: alice@0: alice@0: alice@0: clear all alice@0: close all alice@0: alice@0: addpath ../Functions alice@0: alice@0: Fs=44100; alice@0: T=10; alice@0: alice@0: alice@0: winShapes={ alice@0: 'blackman', alice@0: 'blackmanharris', alice@0: 'flattopwin', alice@0: 'gausswin', alice@0: 'hamming', alice@0: 'hann', alice@0: 'rectwin', alice@0: }; alice@0: alice@0: alice@0: ds=10; %simulated delay (samples) alice@0: alice@0: input=randn((T*Fs)+ds+1,1); alice@0: input=input./max(abs(input)); %white noise input alice@0: alice@0: centreFreq=[0 11025 22050]; %centre frequencies (LP, BP, HP) alice@0: alice@0: bandWidth=logspace(1,5,500); %bandwidths alice@0: alice@0: bandWidth=(bandWidth(bandWidth>50)); alice@0: bandWidth=bandWidth(bandWidth<22050); alice@0: bandWidth=round(bandWidth); alice@0: alice@0: alice@0: percHits=zeros(length(bandWidth),length(centreFreq)); alice@0: alice@0: filterOrder=4; alice@0: freqVec=linspace(0,Fs,length(input)); alice@0: alice@0: frameSize=2048; alice@0: hopSize=frameSize/4; alice@0: alice@0: alice@0: for w=1:length(winShapes) alice@0: alice@0: for n=1:length(centreFreq) alice@0: alice@0: for m=1:length(bandWidth) alice@0: alice@0: alice@0: [w n m] alice@0: %CREATE FILTERED NOISE VECTOR FROM CENTRE FREQ AND BANDWIDTH alice@0: filtNoise=createFiltNoise(input,centreFreq(n),bandWidth(m),filterOrder,Fs); alice@0: alice@0: %CREATE DELAYED SIGNAL alice@0: x=zeros(length(filtNoise),2); alice@0: alice@0: x(:,1)=filtNoise; alice@0: x(:,2)=filter([zeros(ds,1);1],1,filtNoise); alice@0: alice@0: x=x(ds+1:end,:); alice@0: alice@0: alice@0: delayVec=gccPHATFunc_win(x,frameSize,hopSize,winShapes{w}); alice@0: percHitsMat(n,m)=percCorr(delayVec,ds,2); alice@0: alice@0: alice@0: end alice@0: alice@0: alice@0: end alice@0: clear x filtNoise alice@0: alice@0: %save(strcat('Results/noiseExpandBand_',winShapes{w})); %uncomment to alice@0: %save data alice@0: alice@0: end alice@0: alice@0: toc alice@0: