Mercurial > hg > aimc
comparison matlab/bmm/carfac/SAI_DesignLayers.m @ 608:fc353426eaad
Better functionization of SAI, and new way to make picture with lag
marginal and smoothed history of lag marginal.
author | dicklyon@google.com |
---|---|
date | Mon, 13 May 2013 21:15:56 +0000 |
parents | ec3a1c74ec54 |
children | b3118c9ed67f |
comparison
equal
deleted
inserted
replaced
607:49eef19e4f1d | 608:fc353426eaad |
---|---|
47 n_layers = 11 | 47 n_layers = 11 |
48 end | 48 end |
49 if nargin < 2 | 49 if nargin < 2 |
50 width_per_layer = 32; % resolution "half life" in space | 50 width_per_layer = 32; % resolution "half life" in space |
51 end | 51 end |
52 future_lags = 3 * width_per_layer; | 52 future_lags = 4 * width_per_layer; |
53 width_first_layer = future_lags + 2 * width_per_layer; | 53 width_first_layer = future_lags + 1 * width_per_layer; |
54 width_extra_last_layer = 2 * width_per_layer; | 54 width_extra_last_layer = 2 * width_per_layer; |
55 left_overlap = 15; | 55 left_overlap = 15; |
56 right_overlap = 15; | 56 right_overlap = 15; |
57 first_window_width = 400; % or maybe use seglen? or 0.020 * fs? | 57 first_window_width = 400; % or maybe use seglen? or 0.020 * fs? |
58 min_window_width = 2*width_per_layer; % or somewhere on that order | 58 min_window_width = 1*width_per_layer; % or somewhere on that order |
59 window_exponent = 1.4; | 59 window_exponent = 1.4; |
60 alpha_max = 0.5; | 60 alpha_max = 1; |
61 | 61 |
62 % Start with NAP_samples_per_SAI_sample, declining to 1 from here: | 62 % Start with NAP_samples_per_SAI_sample, declining to 1 from here: |
63 max_samples_per = 2^(n_layers - 1); | 63 max_samples_per = 2^(n_layers - 1); |
64 % Construct the overall lag-warping function: | 64 % Construct the overall lag-warping function: |
65 NAP_samples_per_SAI_sample = [ ... | 65 NAP_samples_per_SAI_sample = [ ... |
119 alpha(end + 1 - (1:right)) = ... | 119 alpha(end + 1 - (1:right)) = ... |
120 alpha(end + 1 - (1:right)) .* (1:right)/(right + 1); | 120 alpha(end + 1 - (1:right)) .* (1:right)/(right + 1); |
121 layer_array(layer).alpha = alpha * alpha_max; | 121 layer_array(layer).alpha = alpha * alpha_max; |
122 | 122 |
123 offset = offset + width; % total width from left through this layer. | 123 offset = offset + width; % total width from left through this layer. |
124 | |
125 % Smooth across channels a little before picking triggers: | |
126 layer_array(layer).channel_smoothing_scale = 0.25*(layer-1); | |
124 end | 127 end |
125 total_width = offset; % Return size of SAI this will make. | 128 total_width = offset; % Return size of SAI this will make. |
126 | 129 |
127 % for each layer, fill in its lag-resampling function for interp1: | 130 % for each layer, fill in its lag-resampling function for interp1: |
128 for layer = 1:n_layers | 131 for layer = 1:n_layers |
163 | 166 |
164 % Say about how long the history buffer needs to be to shift any trigger | 167 % Say about how long the history buffer needs to be to shift any trigger |
165 % location in the range of the window to a fixed location. Assume | 168 % location in the range of the window to a fixed location. Assume |
166 % using two window placements overlapped 50%. | 169 % using two window placements overlapped 50%. |
167 n_triggers = 2; | 170 n_triggers = 2; |
171 layer_array(layer).n_window_pos = n_triggers; | |
168 layer_array(layer).buffer_width = layer_array(layer).frame_width + ... | 172 layer_array(layer).buffer_width = layer_array(layer).frame_width + ... |
169 ceil((1 + (n_triggers - 1)/2) * layer_array(layer).window_width); | 173 floor((1 + (n_triggers - 1)/2) * layer_array(layer).window_width); |
170 end | 174 end |
171 | 175 |
172 return | 176 return |
173 | 177 |