Mercurial > hg > gccphat-windowing
comparison Simulation/runAnalysis_filteredNoise_simulation.m @ 0:ab043bd3b162 tip
First commit
author | Alice Clifford <alice.clifford@eecs.qmul.ac.uk> |
---|---|
date | Mon, 11 Jun 2012 17:42:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ab043bd3b162 |
---|---|
1 %Script to run delay estimation analysis of filtered white noise at various | |
2 %bandwidths and with different window shapes | |
3 | |
4 | |
5 % Developer: - Alice Clifford (alice.clifford@eecs.qmul.ac.uk) | |
6 | |
7 | |
8 | |
9 clear all | |
10 close all | |
11 | |
12 addpath ../Functions | |
13 | |
14 Fs=44100; | |
15 T=10; | |
16 | |
17 | |
18 winShapes={ | |
19 'blackman', | |
20 'blackmanharris', | |
21 'flattopwin', | |
22 'gausswin', | |
23 'hamming', | |
24 'hann', | |
25 'rectwin', | |
26 }; | |
27 | |
28 | |
29 ds=10; %simulated delay (samples) | |
30 | |
31 input=randn((T*Fs)+ds+1,1); | |
32 input=input./max(abs(input)); %white noise input | |
33 | |
34 centreFreq=[0 11025 22050]; %centre frequencies (LP, BP, HP) | |
35 | |
36 bandWidth=logspace(1,5,500); %bandwidths | |
37 | |
38 bandWidth=(bandWidth(bandWidth>50)); | |
39 bandWidth=bandWidth(bandWidth<22050); | |
40 bandWidth=round(bandWidth); | |
41 | |
42 | |
43 percHits=zeros(length(bandWidth),length(centreFreq)); | |
44 | |
45 filterOrder=4; | |
46 freqVec=linspace(0,Fs,length(input)); | |
47 | |
48 frameSize=2048; | |
49 hopSize=frameSize/4; | |
50 | |
51 | |
52 for w=1:length(winShapes) | |
53 | |
54 for n=1:length(centreFreq) | |
55 | |
56 for m=1:length(bandWidth) | |
57 | |
58 | |
59 [w n m] | |
60 %CREATE FILTERED NOISE VECTOR FROM CENTRE FREQ AND BANDWIDTH | |
61 filtNoise=createFiltNoise(input,centreFreq(n),bandWidth(m),filterOrder,Fs); | |
62 | |
63 %CREATE DELAYED SIGNAL | |
64 x=zeros(length(filtNoise),2); | |
65 | |
66 x(:,1)=filtNoise; | |
67 x(:,2)=filter([zeros(ds,1);1],1,filtNoise); | |
68 | |
69 x=x(ds+1:end,:); | |
70 | |
71 | |
72 delayVec=gccPHATFunc_win(x,frameSize,hopSize,winShapes{w}); | |
73 percHitsMat(n,m)=percCorr(delayVec,ds,2); | |
74 | |
75 | |
76 end | |
77 | |
78 | |
79 end | |
80 clear x filtNoise | |
81 | |
82 %save(strcat('Results/noiseExpandBand_',winShapes{w})); %uncomment to | |
83 %save data | |
84 | |
85 end | |
86 | |
87 toc | |
88 |