|
|
@@ -3,12 +3,12 @@
|
|
|
%% sphear_fir_render_directions: render impulse responses throught the FIR filter A2B matrix
|
|
|
%%
|
|
|
%% usage:
|
|
|
-%% [] = sphear_fir_render_directions(FIR, fmin, fmax, N, Npre, Nfft, plot_on, smooth)
|
|
|
+%% [] = sphear_fir_render_directions(FIR, fmin, fmax, ymin, ymax, Nfft, plot_on, smooth)
|
|
|
%%
|
|
|
%% FIR: A2B matrix of FIR filters
|
|
|
%% fmin, fmax: range of frequencies to use
|
|
|
-%% N: number of samples to filter
|
|
|
-%% Npre: number of samples before the main impulse peak
|
|
|
+%% ymin, ymax: vertical scale for plot
|
|
|
+%% Fs: sampling rate
|
|
|
%% Nfft: size of FFT
|
|
|
%%
|
|
|
%% optional parameters:
|
|
|
@@ -33,7 +33,7 @@
|
|
|
%% You should have received a copy of the GNU General Public License
|
|
|
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
-function [BFF] = sphear_fir_render_directions(FIR, fmin, fmax, N, Npre, Nfft, plot_on, smooth)
|
|
|
+function [BFF] = sphear_fir_render_directions(FIR, fmin, fmax, ymin, ymax, Fs, Nfft, plot_on, smooth)
|
|
|
|
|
|
%% no smoothing or plotting by default
|
|
|
if (!exist("smooth"))
|
|
|
@@ -47,15 +47,6 @@ function [BFF] = sphear_fir_render_directions(FIR, fmin, fmax, N, Npre, Nfft, pl
|
|
|
end
|
|
|
end
|
|
|
|
|
|
- [ref, Fs] = wavread('../data/current/ref/reference-001-1.wav');
|
|
|
- %% find highest peak location and define sample range
|
|
|
- [index, value] = findmaxpeak(ref);
|
|
|
- r_start = index - Npre;
|
|
|
- r_end = r_start + N -1;
|
|
|
- range = r_start:r_end;
|
|
|
- ref_fft = fft(tukeywin(size(range)(2), 0.02) .* ref(range), N);
|
|
|
- printf("reference: peak %f at %d, sample range [%d %d]\n", value, index, r_start, r_end);
|
|
|
-
|
|
|
%% plot if requested
|
|
|
if (plot_on != 0)
|
|
|
if (strcmp(plot_on, "epsc") || strcmp(plot_on, "pngc"))
|
|
|
@@ -76,8 +67,8 @@ function [BFF] = sphear_fir_render_directions(FIR, fmin, fmax, N, Npre, Nfft, pl
|
|
|
f = figure;
|
|
|
hold on;
|
|
|
grid on;
|
|
|
- axis([fmin, fmax, -40, 0]);
|
|
|
- tics('y', [6, 0, -3, -6, -9, -12, -15, -20, -25, -30]);
|
|
|
+ axis([fmin, fmax, ymin, ymax]);
|
|
|
+ tics('y', [6, 3, 0, -3, -6, -9, -12, -15, -20, -25, -30]);
|
|
|
tics('x', [300, 500, 1000, 2000, 3000, 5000, 7000, 10000, 15000, 20000]);
|
|
|
ca=get (gcf, "currentaxes");
|
|
|
set(ca,"fontweight","bold","linewidth",1.5)
|
|
|
@@ -85,7 +76,7 @@ function [BFF] = sphear_fir_render_directions(FIR, fmin, fmax, N, Npre, Nfft, pl
|
|
|
idx = 1;
|
|
|
for m = [1, 5, 9, 13, 3, 7, 11, 15]
|
|
|
%% render b format components
|
|
|
- bf(idx,:,:) = sphear_a_to_b(m, FIR, range, N);
|
|
|
+ bf(idx,:,:) = sphear_a_to_b(m, FIR, Nfft);
|
|
|
|
|
|
%% calculate B format frequency responses
|
|
|
for b = 1:4
|