Skip to content

Commit

Permalink
Enable Octave
Browse files Browse the repository at this point in the history
  • Loading branch information
JensAhrens committed May 4, 2023
1 parent 27e4834 commit 76088d2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
9 changes: 5 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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.

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.
2 changes: 1 addition & 1 deletion dependencies/get_ema_radial_filters.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion dependencies/get_sma_radial_filters.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 4 additions & 1 deletion dependencies/get_sound_field_sh_coeffs_from_ema_t.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) ---------------------------

Expand Down
4 changes: 2 additions & 2 deletions render_ema_to_ambisonics.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
%
% (c) 2022 by Jens Ahrens

pkg load netcdf;

addpath('dependencies/');

% ----------------------------- Input data --------------------------------
Expand Down Expand Up @@ -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);


2 changes: 2 additions & 0 deletions render_sma_to_ambisonics.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
%
% (c) 2022 by Jens Ahrens

pkg load netcdf;

addpath('dependencies/');

% ----------------------------- Input data --------------------------------
Expand Down

0 comments on commit 76088d2

Please sign in to comment.