Mercurial > hg > aimc
comparison matlab/bmm/carfac/CARFAC_Run_Linear.m @ 504:a0869cb1c99b
Major update to how the DOHC works; like in recent book OHC chapter; Design Doc update (a bit)
author | dicklyon@google.com |
---|---|
date | Thu, 24 May 2012 22:26:56 +0000 |
parents | 896620d9d539 |
children |
comparison
equal
deleted
inserted
replaced
502:37c007925536 | 504:a0869cb1c99b |
---|---|
15 % distributed under the License is distributed on an "AS IS" BASIS, | 15 % distributed under the License is distributed on an "AS IS" BASIS, |
16 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 16 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17 % See the License for the specific language governing permissions and | 17 % See the License for the specific language governing permissions and |
18 % limitations under the License. | 18 % limitations under the License. |
19 | 19 |
20 function [naps, CF] = CARFAC_Run_Linear(CF, input_waves, extra_damping) | 20 function [naps, CF] = CARFAC_Run_Linear(CF, input_waves, relative_undamping) |
21 % function [naps, CF] = CARFAC_Run_Linear(CF, input_waves, extra_damping) | 21 % function [naps, CF] = CARFAC_Run_Linear(CF, input_waves, relative_undamping) |
22 % | 22 % |
23 % This function runs the CARFAC; that is, filters a 1 or more channel | 23 % This function runs the CARFAC; that is, filters a 1 or more channel |
24 % sound input to make one or more neural activity patterns (naps); | 24 % sound input to make one or more neural activity patterns (naps); |
25 % however, unlike CARFAC_Run, it forces it to be linear, and gives a | 25 % however, unlike CARFAC_Run, it forces it to be linear, and gives a |
26 % linear (not detected) output. | 26 % linear (not detected) output. |
27 | 27 |
28 % only saving one of these, really: | 28 % only saving one of these, really: |
29 saved_v_damp_max = CF.ears(1).CAR_coeffs.v_damp_max; | 29 velocity_scale = CF.ears(1).CAR_coeffs.velocity_scale; |
30 for ear = 1:CF.n_ears | 30 for ear = 1:CF.n_ears |
31 CF.ears(ear).CAR_coeffs.v_damp_max = 0.00; % make it linear for now | 31 % make it effectively linear for now |
32 CF.ears(ear).CAR_coeffs.velocity_scale = 0; | |
32 end | 33 end |
33 | 34 |
34 [n_samp, n_ears] = size(input_waves); | 35 [n_samp, n_ears] = size(input_waves); |
35 n_ch = CF.n_ch; | 36 n_ch = CF.n_ch; |
36 | 37 |
37 if nargin < 3 | 38 if nargin < 3 |
38 extra_damping = 0; | 39 relative_undamping = 1; % default to min-damping condition |
39 end | 40 end |
40 | 41 |
41 if n_ears ~= CF.n_ears | 42 if n_ears ~= CF.n_ears |
42 error('bad number of input_waves channels passed to CARFAC_Run') | 43 error('bad number of input_waves channels passed to CARFAC_Run') |
43 end | 44 end |
44 | 45 |
45 for ear = 1:CF.n_ears | 46 for ear = 1:CF.n_ears |
47 coeffs = CF.ears(ear).CAR_coeffs; | |
46 % Set the state of damping, and prevent interpolation from there: | 48 % Set the state of damping, and prevent interpolation from there: |
47 CF.ears(ear).CAR_state.zB_memory(:) = extra_damping; % interpolator state | 49 CF.ears(ear).CAR_state.zB_memory(:) = coeffs.zr_coeffs .* relative_undamping; % interpolator state |
48 CF.ears(ear).CAR_state.dzB_memory(:) = 0; % interpolator slope | 50 CF.ears(ear).CAR_state.dzB_memory(:) = 0; % interpolator slope |
49 CF.ears(ear).CAR_state.g_memory = CARFAC_Stage_g( ... | 51 CF.ears(ear).CAR_state.g_memory = CARFAC_Stage_g(coeffs, relative_undamping); |
50 CF.ears(ear).CAR_coeffs(ear), extra_damping); | |
51 CF.ears(ear).CAR_state.dg_memory(:) = 0; % interpolator slope | 52 CF.ears(ear).CAR_state.dg_memory(:) = 0; % interpolator slope |
52 end | 53 end |
53 | 54 |
54 naps = zeros(n_samp, n_ch, n_ears); | 55 naps = zeros(n_samp, n_ch, n_ears); |
55 | 56 |
62 end | 63 end |
63 % skip IHC and AGC updates | 64 % skip IHC and AGC updates |
64 end | 65 end |
65 | 66 |
66 for ear = 1:CF.n_ears | 67 for ear = 1:CF.n_ears |
67 CF.ears(ear).CAR_coeffs.v_damp_max = saved_v_damp_max; | 68 CF.ears(ear).CAR_coeffs.velocity_scale = velocity_scale; |
68 end | 69 end |
69 | 70 |