|
|
@@ -57,7 +57,7 @@ sphear_octa_af_calibrate((1:16), 0.004, 0.001);
|
|
|
|
|
|
%% now we start the calibration process
|
|
|
|
|
|
-%% read all the calibrated A-format files
|
|
|
+%% read all the calibrated A format signals
|
|
|
[AF, FS] = sphear_af_read((1:16));
|
|
|
|
|
|
%% just for checking the data, this plots the frequency response of each
|
|
|
@@ -88,30 +88,32 @@ sphear_plot_r(R, 0);
|
|
|
|
|
|
%% plot frequency response of B-format components for each measurement direction (just a test)
|
|
|
|
|
|
-sphear_bf_plot_frequency_response(BF, 300, 20000, -60, 0, 48000, 8192);
|
|
|
+sphear_bf_plot_frequency_response(BF, 600, 1200, 300, 20000, -60, 0, 48000, 8192);
|
|
|
|
|
|
%% calculate power of B-format signals in logarithmically spaced frequency bands
|
|
|
|
|
|
-[B, FC, FE] = sphear_signal_power_all(BF, FS, 300, 20000, 1200, 2400, 16, 8192);
|
|
|
+[B, FC, FE] = sphear_signal_power_all(BF, FS, 300, 20000, 600, 1200, 16, 8192);
|
|
|
|
|
|
%% above the transition frequency (see plots above) the B-format behavior
|
|
|
%% deviates from the ideal as the capsules are no longer co-located, we use
|
|
|
%% the signal power to extract filter shapes from the B-format signals.
|
|
|
|
|
|
-%% extract the shapes of wxyz filters
|
|
|
-%% get flat response in cardinal directions
|
|
|
+%% extract the shapes of wxyz[uv] filters
|
|
|
+%%
|
|
|
+%% average response in cardinal directions
|
|
|
|
|
|
[W X Y Z U V] = sphear_bf_extract_filter_shapes(B, 0);
|
|
|
|
|
|
-%% get bright response in cardinal directions
|
|
|
+%% average response in diagonal directions
|
|
|
|
|
|
[W X Y Z U V] = sphear_bf_extract_filter_shapes(B, 1);
|
|
|
|
|
|
-%% average all measurements for all components
|
|
|
+%% average all measurements
|
|
|
|
|
|
[W X Y Z U V] = sphear_bf_extract_filter_shapes(B, 2);
|
|
|
|
|
|
%% look at the shapes of the filters
|
|
|
+%%
|
|
|
%% for tetrahedral microphones Z is an average estimation so do not plot it
|
|
|
|
|
|
sphear_bf_plot_filters(FC, W, X, Y);
|
|
|
@@ -120,9 +122,9 @@ sphear_bf_plot_filters(FC, W, X, Y, Z);
|
|
|
|
|
|
sphear_bf_plot_filters(FC, W, X, Y, Z, U, V);
|
|
|
|
|
|
-%% now design four FIR filters, one for each B-format component
|
|
|
+%% now design minimum phase FIR filters, one for each B-format component
|
|
|
|
|
|
-[FIR TFIR] = sphear_design_fir_filters(FC, 512, 15, 48000, W, X, Y);
|
|
|
+[FIR IR MPS] = sphear_design_fir_filters(FC, 512, 48000, W, X, Y);
|
|
|
|
|
|
%% in the case of the Octathingy we do use Z for now (this is a hack!)
|
|
|
%%
|
|
|
@@ -130,32 +132,31 @@ sphear_bf_plot_filters(FC, W, X, Y, Z, U, V);
|
|
|
%% 256 makes a little bump at around 5KHz. XYZ are happy with a lot
|
|
|
%% less, 128 seems fine
|
|
|
|
|
|
-[FIR] = sphear_design_fir_filters(FC, 512, 15, 48000, W, X, Y, Z);
|
|
|
+[FIR IR MPS] = sphear_design_fir_filters(FC, 512, 48000, W, X, Y, Z);
|
|
|
|
|
|
-[FIR TFIR] = sphear_design_fir_filters(FC, 512, 15, 48000, W, X, Y, Z, U, V);
|
|
|
+[FIR IR MPS] = sphear_design_fir_filters(FC, 512, 48000, W, X, Y, Z, U, V);
|
|
|
|
|
|
-[FIR TFIR] = sphear_design_fir_filters(FC, 512, 15, 48000, W, X, Y, Z, U, V, 8, -24);
|
|
|
+%% limit low frequency boost
|
|
|
+[FIR IR MPS] = sphear_design_fir_filters(FC, 512, 48000, W, X, Y, Z, U, V, 8, -24);
|
|
|
|
|
|
%% re-calculate the full B-format signal with the filters
|
|
|
|
|
|
[BF, BFF] = sphear_af_to_bf(AF, A2B, FIR, 8192);
|
|
|
|
|
|
-[BF, BFF] = sphear_af_to_bf(AF, A2B, TFIR, 8192);
|
|
|
-
|
|
|
%% get the average power in the directions of the lobes for W, XY and UV
|
|
|
%% and normalize the A2B matrix so that ZY and UV have the same peak amplitude
|
|
|
%% as W
|
|
|
|
|
|
-[A2B XY_gain UV_gain] = sphear_bf_normalize_gain(A2B, BFF, FS, 1200, 2400, 8192);
|
|
|
+[A2B XY_gain UV_gain] = sphear_bf_normalize_gain(A2B, BFF, FS, 600, 1200, 8192);
|
|
|
|
|
|
%% re-calculate the B-format signal
|
|
|
|
|
|
-[BF, BFF] = sphear_af_to_bf(AF, A2B, TFIR, 8192);
|
|
|
+[BF, BFF] = sphear_af_to_bf(AF, A2B, FIR, 8192);
|
|
|
|
|
|
%% plot the frequency response of the B-format components for each measurement
|
|
|
%% direction, they should all be flat
|
|
|
|
|
|
-sphear_bf_plot_frequency_response(BFF, 300, 20000, -35, -3, 48000, 8192);
|
|
|
+sphear_bf_plot_frequency_response(BFF, 600, 1200, 300, 20000, -35, -3, 48000, 8192);
|
|
|
|
|
|
%% a revealing plot that highlights the cardinal direction response versus
|
|
|
%% the diagonal direction response (incomplete code for the 8 capsule case)
|
|
|
@@ -164,7 +165,7 @@ sphear_plot_directions(BFF, 300, 20000, -15, 3, 48000, 8192, 1);
|
|
|
|
|
|
%% plot the polar response of the B-format components
|
|
|
|
|
|
-sphear_bf_plot_polar_response(BFF, 800, 1600, 300, 20000, 3, 8192, FS);
|
|
|
+sphear_bf_plot_polar_response(BFF, 600, 1200, 300, 20000, 3, 8192, FS);
|
|
|
|
|
|
%% replace the Z polar response with a virtual cardioid pointing in the forward direction
|
|
|
|
|
|
@@ -179,10 +180,16 @@ sphear_write_simple_a2b_encoder(A2B, FIR);
|
|
|
|
|
|
sphear_write_simple_a2b_encoder(A2B, TFIR);
|
|
|
|
|
|
-%%
|
|
|
+%% plot B format components separately for a set of measurements
|
|
|
|
|
|
sphear_capsule_plot_frequency_response(BFF, [1:16], 300, 20000, -50, 0, 48000, 8192);
|
|
|
|
|
|
+sphear_capsule_plot_frequency_response(BFF, [1, 5, 9, 13], 300, 20000, -50, 0, 48000, 8192);
|
|
|
+
|
|
|
+sphear_capsule_plot_frequency_response(BFF, [1, 3, 5, 7, 9, 11, 13, 15], 300, 20000, -50, 0, 48000, 8192);
|
|
|
+
|
|
|
+sphear_capsule_plot_frequency_response(BFF, [1, 3, 5, 7, 9, 11, 13, 15] + 1, 300, 20000, -50, 0, 48000, 8192);
|
|
|
+
|
|
|
%%%%%%%%% testing code to determine z axis wobble during calibration measurements
|
|
|
|
|
|
DELTA = sphear_signal_arrival_times(AF);
|