|
@@ -70,6 +70,8 @@ sphear_af_plot_frequency_response(AF, 300, 20000, -60, -10, 48000, 8192);
|
|
|
|
|
|
|
|
[R] = sphear_signal_power(AF, FS, 600, 1000, 8192);
|
|
[R] = sphear_signal_power(AF, FS, 600, 1000, 8192);
|
|
|
|
|
|
|
|
|
|
+[R] = sphear_signal_power(AF, FS, 800, 2400, 8192);
|
|
|
|
|
+
|
|
|
%% check that capsule signals are reasonable
|
|
%% check that capsule signals are reasonable
|
|
|
|
|
|
|
|
sphear_plot_r(R, 0);
|
|
sphear_plot_r(R, 0);
|
|
@@ -78,6 +80,8 @@ sphear_plot_r(R, 0);
|
|
|
|
|
|
|
|
[A2B, PV, COND] = sphear_calculate_a2b(R);
|
|
[A2B, PV, COND] = sphear_calculate_a2b(R);
|
|
|
|
|
|
|
|
|
|
+[A2B, PV, COND] = sphear_octa_calculate_a2b(R);
|
|
|
|
|
+
|
|
|
%% generate a B-format signal using the A-format signal and the static A to B matrix
|
|
%% generate a B-format signal using the A-format signal and the static A to B matrix
|
|
|
|
|
|
|
|
[BF] = sphear_af_to_bf(AF, A2B);
|
|
[BF] = sphear_af_to_bf(AF, A2B);
|
|
@@ -102,9 +106,13 @@ sphear_bf_plot_frequency_response(BF, 300, 20000, -60, 0, 48000, 8192);
|
|
|
|
|
|
|
|
[W X Y Z] = sphear_bf_extract_filter_shapes(B, [1:16]);
|
|
[W X Y Z] = sphear_bf_extract_filter_shapes(B, [1:16]);
|
|
|
|
|
|
|
|
|
|
+[W X Y Z U V] = sphear_bf_extract_filter_shapes(B, [1:16]);
|
|
|
|
|
+
|
|
|
|
|
+[W X Y Z U V] = sphear_bf_extract_filter_shapes(B, 0);
|
|
|
|
|
+
|
|
|
%% now design four FIR filters, one for each B-format component
|
|
%% now design four FIR filters, one for each B-format component
|
|
|
|
|
|
|
|
-[FIR] = sphear_design_fir_filters(FC, 512, 15, 48000, W, X, Y);
|
|
|
|
|
|
|
+[FIR TFIR] = sphear_design_fir_filters(FC, 512, 15, 48000, W, X, Y);
|
|
|
|
|
|
|
|
%% in the case of the Octathingy we do use Z for now (this is a hack!)
|
|
%% in the case of the Octathingy we do use Z for now (this is a hack!)
|
|
|
%%
|
|
%%
|
|
@@ -114,6 +122,10 @@ sphear_bf_plot_frequency_response(BF, 300, 20000, -60, 0, 48000, 8192);
|
|
|
|
|
|
|
|
[FIR] = sphear_design_fir_filters(FC, 512, 15, 48000, W, X, Y, Z);
|
|
[FIR] = sphear_design_fir_filters(FC, 512, 15, 48000, W, X, Y, Z);
|
|
|
|
|
|
|
|
|
|
+[FIR TFIR] = sphear_design_fir_filters(FC, 512, 15, 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);
|
|
|
|
|
+
|
|
|
%% look at the shapes of the filters
|
|
%% look at the shapes of the filters
|
|
|
%% for tetrahedral microphones Z is an average estimation so do not plot it
|
|
%% for tetrahedral microphones Z is an average estimation so do not plot it
|
|
|
|
|
|
|
@@ -121,10 +133,24 @@ sphear_bf_plot_filters(FC, W, X, Y);
|
|
|
|
|
|
|
|
sphear_bf_plot_filters(FC, W, X, Y, Z);
|
|
sphear_bf_plot_filters(FC, W, X, Y, Z);
|
|
|
|
|
|
|
|
|
|
+sphear_bf_plot_filters(FC, W, X, Y, Z, U, V);
|
|
|
|
|
+
|
|
|
%% re-calculate the full B-format signal with the filters
|
|
%% 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, 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);
|
|
|
|
|
+
|
|
|
|
|
+%% re-calculate the B-format signal
|
|
|
|
|
+
|
|
|
|
|
+[BF, BFF] = sphear_af_to_bf(AF, A2B, TFIR, 8192);
|
|
|
|
|
+
|
|
|
%% plot the frequency response of the B-format components for each measurement
|
|
%% plot the frequency response of the B-format components for each measurement
|
|
|
%% direction, they should all be flat
|
|
%% direction, they should all be flat
|
|
|
|
|
|
|
@@ -143,8 +169,21 @@ sphear_bf_plot_polar_response(BFF, 800, 1600, 300, 20000, 3, 8192, FS);
|
|
|
|
|
|
|
|
sphear_bf_plot_polar_response(BFF, 800, 1600, 300, 20000, 3, 8192, FS, 1.0);
|
|
sphear_bf_plot_polar_response(BFF, 800, 1600, 300, 20000, 3, 8192, FS, 1.0);
|
|
|
|
|
|
|
|
|
|
+sphear_bf_plot_polar_response(BFF, 800, 1600, 300, 20000, 3, 8192, FS, 2.0);
|
|
|
|
|
+
|
|
|
%% write a simple Faust A to B encoder that includes the static matrix
|
|
%% write a simple Faust A to B encoder that includes the static matrix
|
|
|
%% and all FIR filters (not efficient but works)
|
|
%% and all FIR filters (not efficient but works)
|
|
|
|
|
|
|
|
sphear_write_simple_a2b_encoder(A2B, FIR);
|
|
sphear_write_simple_a2b_encoder(A2B, FIR);
|
|
|
|
|
|
|
|
|
|
+sphear_write_simple_a2b_encoder(A2B, TFIR);
|
|
|
|
|
+
|
|
|
|
|
+%%
|
|
|
|
|
+
|
|
|
|
|
+sphear_capsule_plot_frequency_response(BFF, [1:16], 300, 20000, -50, 0, 48000, 8192);
|
|
|
|
|
+
|
|
|
|
|
+%%%%%%%%% testing code to determine z axis wobble during calibration measurements
|
|
|
|
|
+
|
|
|
|
|
+DELTA = sphear_signal_arrival_times(AF);
|
|
|
|
|
+AFC = sphear_af_fix_wobble(AF, (DELTA + abs(min(DELTA')))');
|
|
|
|
|
+
|