diff --git a/Readme.md b/Readme.md index 1d38193..94fb8f5 100644 --- a/Readme.md +++ b/Readme.md @@ -1,5 +1,7 @@ # Ambisonic Encoding of Signals From Higher-Order Microphone Arrays +NB: This is the preliminary version for Octave. For it to work, you'll need to have netcdf installed (SOFA needs that). On macos, you can get it, for example, via `brew install netcdf`. Then, you'll need to run `pkg install -forge netcdf` in Octave. The scripts in this repository comprise a call to `pkg load netcdf`, which is required after each startup of Octave. Interestingly, I have to call `pkg install -forge netcdf` after each startup, too, for the package to be loaded. You'll, of course, also need to have the [SOFAtoolbox](https://sourceforge.net/projects/sofacoustics/) in the Octave path. + ## Spherical Microphone Arrays With a Spherical Baffle The MATLAB script `render_sma_to_ambisonics.m` demonstrates how to compute ambisonic signals from the signals that are captured by the microphones of a classical spherical microphone array with a rigid spherical baffle. @@ -33,10 +35,9 @@ The MATLAB script uses a reformulation of the equatorial array solution that is If you execute the scripts then the microphone signals from [this recording](https://youtu.be/95qDd13pVVY?t=58) will be encoded into 7th-order ambisonics and stored in the file `out_ambisonics.wav`, which is the same file that is mentioned above (it is getting overwritten). Start Reaper after computing the signals so that it loads the updated ones. The binaural preview will be stored in `out_ema_binaural.wav`. -We will shortly provide a MATLAB implementation of eMagLS for EMAs. - +We will shortly provide a MATLAB implementation of eMagLS for EMAs. + We thank Reality Labs for funding the initial work on the EMA concept. ## License -The content of this repository is licensed under the terms of the MIT license. Please consult the file LICENSE for more information about this license. - \ No newline at end of file +The content of this repository is licensed under the terms of the MIT license. Please consult the file (LICENSE)[LICENSE] for more information about this license. \ No newline at end of file diff --git a/dependencies/get_ema_radial_filters.m b/dependencies/get_ema_radial_filters.m index edc5239..f4b1ec9 100755 --- a/dependencies/get_ema_radial_filters.m +++ b/dependencies/get_ema_radial_filters.m @@ -109,7 +109,7 @@ ema_inv_rf_sym = [ema_inv_rf; conj(flipud(ema_inv_rf(2:end-1, :)))]; -ema_inv_rf_t = ifft(ema_inv_rf_sym, [], 1, 'symmetric'); +ema_inv_rf_t = real(ifft(ema_inv_rf_sym, [], 1)); filter_length = size(ema_inv_rf_t, 1); diff --git a/dependencies/get_sma_radial_filters.m b/dependencies/get_sma_radial_filters.m index 7bc09e9..ce3eb47 100755 --- a/dependencies/get_sma_radial_filters.m +++ b/dependencies/get_sma_radial_filters.m @@ -97,7 +97,7 @@ b_n_inv_sym = [b_n_inv; conj(flipud(b_n_inv(2:end-1, :)))]; -b_n_inv_t = ifft(b_n_inv_sym, 'symmetric'); +b_n_inv_t = real(ifft(b_n_inv_sym)); filter_length = size(b_n_inv_t, 1); diff --git a/dependencies/get_sound_field_sh_coeffs_from_ema_t.m b/dependencies/get_sound_field_sh_coeffs_from_ema_t.m index 57773b8..e872558 100755 --- a/dependencies/get_sound_field_sh_coeffs_from_ema_t.m +++ b/dependencies/get_sound_field_sh_coeffs_from_ema_t.m @@ -25,8 +25,11 @@ end % --------------------------- Evaluate Eq. (13) --------------------------- +s_ring_bar_m = zeros(size(s_ring_m_surf)); -s_ring_bar_m = fftfilt(ema_inv_rf_t, s_ring_m_surf); +for l = 1 : size(ema_inv_rf_t, 2) + s_ring_bar_m(:, l) = fftfilt(ema_inv_rf_t(:, l), s_ring_m_surf(:, l)); +end % --------------------------- Evaluate Eq. (15) --------------------------- diff --git a/render_ema_to_ambisonics.m b/render_ema_to_ambisonics.m index 9946d08..6eb47a0 100755 --- a/render_ema_to_ambisonics.m +++ b/render_ema_to_ambisonics.m @@ -21,6 +21,8 @@ % % (c) 2022 by Jens Ahrens +pkg load netcdf; + addpath('dependencies/'); % ----------------------------- Input data -------------------------------- @@ -74,5 +76,3 @@ out_lr = out_lr / max(abs(out_lr(:))); out_file_name = 'out_ema_binaural.wav'; audiowrite(out_file_name, out_lr, fs); - - diff --git a/render_sma_to_ambisonics.m b/render_sma_to_ambisonics.m index c6fecdd..69ff224 100755 --- a/render_sma_to_ambisonics.m +++ b/render_sma_to_ambisonics.m @@ -14,6 +14,8 @@ % % (c) 2022 by Jens Ahrens +pkg load netcdf; + addpath('dependencies/'); % ----------------------------- Input data --------------------------------