Mercurial > hg > map
comparison userProgramsRM/test_speechInNoiseDelmanhorst.m @ 38:c2204b18f4a2 tip
End nov big change
author | Ray Meddis <rmeddis@essex.ac.uk> |
---|---|
date | Mon, 28 Nov 2011 13:34:28 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
37:771a643d5c29 | 38:c2204b18f4a2 |
---|---|
1 function test_speechInNoiseDelmanhorst | |
2 % as used for Delmanhorst presentation | |
3 | |
4 leveldBSPL= 60; % dB SPL | |
5 leveldBSPLNoise=-55; | |
6 | |
7 % leveldBSPL= 90; % test AR | |
8 % leveldBSPLNoise=85; | |
9 | |
10 % AR rate to attenuation factor | |
11 OMEatten=0.1; | |
12 % OMEatten=0.00; | |
13 | |
14 MOCattenuation=0.00; % no attenuation | |
15 % MOCattenuation=-0.02; % fixed | |
16 % MOCattenuation=0.02; % dynamic within-channel | |
17 | |
18 MOCtauProb=0.150; | |
19 | |
20 paramChanges={}; | |
21 | |
22 % no attenuation | |
23 paramChanges={['DRNLParams.rateToAttenuationFactorProb = '... | |
24 num2str(MOCattenuation) ';'],... | |
25 ['DRNLParams.MOCtauProb =' num2str(MOCtauProb) ';'],... | |
26 ['OMEParams.rateToAttenuationFactorProb=' num2str(OMEatten) ';'] }; | |
27 | |
28 % | |
29 fileName='twister_44kHz'; | |
30 % fileName='1o7a_44kHz'; | |
31 | |
32 dbstop if error | |
33 restorePath=path; | |
34 addpath (['..' filesep 'MAP'], ['..' filesep 'wavFileStore'], ... | |
35 ['..' filesep 'utilities']) | |
36 | |
37 %% #1 parameter file name | |
38 MAPparamsName='Normal'; | |
39 | |
40 | |
41 %% #2 probability (fast) or spikes (slow) representation | |
42 % AN_spikesOrProbability='spikes'; | |
43 % or | |
44 AN_spikesOrProbability='probability'; | |
45 | |
46 %% #3 speech file input | |
47 | |
48 beginSilence=.25; | |
49 endSilence=0.25; | |
50 noiseRampDuration=0.01; | |
51 | |
52 %% #5 number of channels in the model | |
53 % 21-channel model (log spacing) | |
54 numChannels=21; | |
55 lowestBF=300; highestBF= 6000; | |
56 BFlist=round(logspace(log10(lowestBF), log10(highestBF), numChannels)); | |
57 | |
58 % or specify your own channel BFs | |
59 % numChannels=1; | |
60 % BFlist=toneFrequency; | |
61 | |
62 | |
63 | |
64 %% delare 'showMap' options to control graphical output | |
65 showMapOptions.printModelParameters=1; % prints all parameters | |
66 showMapOptions.showModelOutput=1; % plot of all stages | |
67 showMapOptions.printFiringRates=1; % prints stage activity levels | |
68 showMapOptions.showACF=0; % shows SACF (probability only) | |
69 showMapOptions.showEfferent=0; % tracks of AR and MOC | |
70 showMapOptions.surfProbability=1; % 2D plot of HSR response | |
71 showMapOptions.surfSpikes=0; % 2D plot of spikes histogram | |
72 showMapOptions.ICrates=0; % IC rates by CNtauGk | |
73 showMapOptions.PSTHbinwidth=0.010; | |
74 showMapOptions.colorbar=0; | |
75 showMapOptions.view=[0 90]; | |
76 | |
77 % disable certain silly options | |
78 if strcmp(AN_spikesOrProbability, 'spikes') | |
79 % avoid nonsensical options | |
80 showMapOptions.surfProbability=0; | |
81 showMapOptions.showACF=0; | |
82 else | |
83 showMapOptions.surfSpikes=0; | |
84 end | |
85 % needed for labeling plot | |
86 showMapOptions.fileName=fileName; | |
87 | |
88 %% Generate stimuli | |
89 | |
90 %% file input simple or mixed | |
91 [inputSignal sampleRate]=wavread(fileName); | |
92 dt=1/sampleRate; | |
93 inputSignal=inputSignal(:,1); | |
94 targetRMS=20e-6*10^(leveldBSPL/20); | |
95 rms=(mean(inputSignal.^2))^0.5; | |
96 amp=targetRMS/rms; | |
97 inputSignal=inputSignal*amp; | |
98 | |
99 % add silences | |
100 intialSilence= zeros(1,round(beginSilence*sampleRate)); | |
101 finalSilence= zeros(1,round(endSilence*sampleRate)); | |
102 inputSignal= [intialSilence inputSignal' finalSilence]; | |
103 | |
104 [inputNoise sampleRateN]=wavread('babble'); | |
105 inputNoise=inputNoise(1:length(inputSignal)); | |
106 inputNoise=inputNoise(:,1); | |
107 targetRMS=20e-6*10^(leveldBSPLNoise/20); | |
108 rms=(mean(inputNoise.^2))^0.5; | |
109 amp=targetRMS/rms; | |
110 inputNoise=inputNoise*amp; | |
111 time=dt: dt: dt*length(inputNoise); | |
112 rampTime=dt:dt:noiseRampDuration; | |
113 ramp=[0.5*(1+cos(2*pi*rampTime/(2*noiseRampDuration)+pi)) ... | |
114 ones(1,length(time)-length(rampTime))]; | |
115 inputNoise=inputNoise'.*ramp; | |
116 inputSignal=inputSignal+inputNoise; | |
117 | |
118 | |
119 | |
120 %% run the model | |
121 tic | |
122 | |
123 fprintf('\n') | |
124 disp(['Signal duration= ' num2str(length(inputSignal)/sampleRate)]) | |
125 disp([num2str(numChannels) ' channel model']) | |
126 disp('Computing ...') | |
127 | |
128 MAP1_14(inputSignal, sampleRate, BFlist, ... | |
129 MAPparamsName, AN_spikesOrProbability, paramChanges); | |
130 | |
131 | |
132 %% the model run is now complete. Now display the results | |
133 UTIL_showMAP(showMapOptions, paramChanges) | |
134 figure(97), | |
135 title(['speech/ noise: ' num2str([leveldBSPL leveldBSPLNoise]) ... | |
136 '; atten/ tau: ' num2str([MOCattenuation MOCtauProb] )],'fontSize', 14) | |
137 | |
138 disp(['level=' num2str(leveldBSPL)]) | |
139 disp(['noise level=' num2str(leveldBSPLNoise)]) | |
140 | |
141 global DRNLParams | |
142 disp(['attenuation factor =' ... | |
143 num2str(DRNLParams.rateToAttenuationFactor, '%5.3f') ]) | |
144 disp(['attenuation factor (probability)=' ... | |
145 num2str(DRNLParams.rateToAttenuationFactorProb, '%5.3f') ]) | |
146 disp(AN_spikesOrProbability) | |
147 disp(paramChanges) | |
148 toc | |
149 path(restorePath) | |
150 |