SAF
|
Spatially encodes spherical microphone array signals into spherical harmonic signals (aka: Ambisonic signals) utilising theoretical encoding filters. More...
#include "array2sh_internal.h"
Go to the source code of this file.
Functions | |
void | array2sh_create (void **const phA2sh) |
Creates an instance of array2sh. | |
void | array2sh_destroy (void **const phM2sh) |
Destroys an instance of array2sh. | |
void | array2sh_init (void *const hA2sh, int sampleRate) |
Initialises an instance of array2sh with default settings. | |
void | array2sh_evalEncoder (void *const hA2sh) |
Evaluates the encoder, based on current global/user parameters. | |
void | array2sh_process (void *const hA2sh, const float *const *inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples) |
Spatially encode microphone/hydrophone array signals into spherical harmonic signals. | |
void | array2sh_refreshSettings (void *const hA2sh) |
Sets all intialisation flags to 1; re-initialising all settings/variables as array2sh is currently configured, at next available opportunity. | |
void | array2sh_setEncodingOrder (void *const hA2sh, int newOrder) |
Sets the encoding order (see SH_ORDERS enum) | |
void | array2sh_setRequestEncoderEvalFLAG (void *const hA2sh, int newState) |
Evaluates the performance of the current encoding filters when applied to a theoretical model of the currently configured array; two established objective metrics are then computed; more information in [1]. | |
void | array2sh_setEvalStatus (void *const hA2sh, ARRAY2SH_EVAL_STATUS new_evalStatus) |
Sets current eval status (see ARRAY2SH_EVAL_STATUS enum) | |
void | array2sh_setDiffEQpastAliasing (void *const hA2sh, int newState) |
Analyses what the theoretical spatial aliasing frequency is, and conducts diffuse-field equalisation above this (enable: 1, disable: 0). | |
void | array2sh_setPreset (void *const hA2sh, ARRAY2SH_MICROPHONE_ARRAY_PRESETS preset) |
Sets a pre-defined microphone/hydrophone array preset (See ARRAY2SH_MICROPHONE_ARRAY_PRESETS enum) | |
void | array2sh_setSensorAzi_rad (void *const hA2sh, int index, float newAzi_rad) |
Sets a particular sensor's azimuth (radians) w.r.t to the origin of the array. | |
void | array2sh_setSensorElev_rad (void *const hA2sh, int index, float newElev_rad) |
Sets a particular sensor's elevation (radians) w.r.t to the origin of the array. | |
void | array2sh_setSensorAzi_deg (void *const hA2sh, int index, float newAzi_deg) |
Sets a particular sensor's azimuth (degrees) w.r.t to the origin of the array. | |
void | array2sh_setSensorElev_deg (void *const hA2sh, int index, float newElev_deg) |
Sets a particular sensor's elevation (degrees) w.r.t to the origin of the array. | |
void | array2sh_setNumSensors (void *const hA2sh, int newQ) |
Sets the number of sensors in the array. | |
void | array2sh_setr (void *const hA2sh, float newr) |
Sets the radius of the array. | |
void | array2sh_setR (void *const hA2sh, float newR) |
Sets the radius (in meters) of the scatterer (only for Rigid arrays). | |
void | array2sh_setArrayType (void *const hA2sh, int newType) |
Sets the type of array (see ARRAY2SH_ARRAY_TYPES enum) | |
void | array2sh_setWeightType (void *const hA2sh, int newType) |
Sets the type of weights to use (see ARRAY2SH_WEIGHT_TYPES enum) | |
void | array2sh_setFilterType (void *const hA2sh, int newType) |
Sets the type filter design to employ for computing the encoding matrices (see ARRAY2SH_FILTER_TYPES enum) | |
void | array2sh_setRegPar (void *const hA2sh, float newVal) |
Sets the value of the regularisation parameter (the maximum permitted gain of the filters), in DECIBELS. | |
void | array2sh_setChOrder (void *const hA2sh, int newOrder) |
Sets the Ambisonic channel ordering convention to encode with, in order to match the convention employed by the input signals (see CH_ORDER enum) | |
void | array2sh_setNormType (void *const hA2sh, int newType) |
Sets the Ambisonic normalisation convention to encode with, in order to match with the convention employed by the input signals (see NORM_TYPES enum) | |
void | array2sh_setc (void *const hA2sh, float newc) |
Sets the speed of sound of the medium (~343m/s air, ~1480m/s water), in m/s. | |
void | array2sh_setGain (void *const hA2sh, float newGain) |
Sets the amount of post gain to apply after the encoding, in DECIBELS. | |
int | array2sh_getFrameSize (void) |
Returns the processing framesize (i.e., number of samples processed with every _process() call ) | |
ARRAY2SH_EVAL_STATUS | array2sh_getEvalStatus (void *const hA2sh) |
Returns current eval status (see ARRAY2SH_EVAL_STATUS enum) | |
int | array2sh_getReinitSHTmatrixFLAG (void *const hA2sh) |
Returns 0 if SHT is not be reinitialised, 1: if it is. | |
float | array2sh_getProgressBar0_1 (void *const hA2sh) |
(Optional) Returns current intialisation/processing progress, between 0..1 | |
void | array2sh_getProgressBarText (void *const hA2sh, char *text) |
(Optional) Returns current intialisation/processing progress text | |
int | array2sh_getRequestEncoderEvalFLAG (void *const hA2sh) |
Returns a flag, which is '1' if there has been a recent request to evaluate the current encoding performance, or '0', if there hasn't. | |
int | array2sh_getDiffEQpastAliasing (void *const hA2sh) |
Flag to enabled/disable diffuse equalisation above the spatial aliasing limit of the array (0: disabled, 1: enabled). | |
int | array2sh_getEncodingOrder (void *const hA2sh) |
Returns the current encoding order (see SH_ORDERS enum) | |
float | array2sh_getSensorAzi_rad (void *const hA2sh, int index) |
Returns a particular sensor's azimuth w.r.t to the origin of the array, in RADIANS. | |
float | array2sh_getSensorElev_rad (void *const hA2sh, int index) |
Returns a particular sensor's elevation w.r.t to the origin of the array, in RADIANS. | |
float | array2sh_getSensorAzi_deg (void *const hA2sh, int index) |
Returns a particular sensor's azimuth w.r.t to the origin of the array, in DEGREES. | |
float | array2sh_getSensorElev_deg (void *const hA2sh, int index) |
Returns a particular sensor's elevation w.r.t to the origin of the array, in DEGREES. | |
int | array2sh_getNumSensors (void *const hA2sh) |
Returns the number of sensors in the array. | |
int | array2sh_getMaxNumSensors (void) |
Returns the maximum supported number of sensors which can be in the array. | |
int | array2sh_getMinNumSensors (void *const hA2sh) |
Returns the minimum number of sensors which can be in the array [(current_order+1)^2]. | |
int | array2sh_getNSHrequired (void *const hA2sh) |
Returns the number of spherical harmonic signals required by the current encoding order: (current_order+1)^2. | |
float | array2sh_getr (void *const hA2sh) |
Returns the radius of the array, in meters. | |
float | array2sh_getR (void *const hA2sh) |
Returns the radius of the scatterer, in meters. | |
int | array2sh_getArrayType (void *const hA2sh) |
Returns the type of array. | |
int | array2sh_getWeightType (void *const hA2sh) |
Returns the type of weights to use see ARRAY2SH_WEIGHT_TYPES enum. | |
int | array2sh_getFilterType (void *const hA2sh) |
Returns the type filter design to employ for computing the encoding matrices (see ARRAY2SH_FILTER_TYPES enum) | |
float | array2sh_getRegPar (void *const hA2sh) |
Returns the value of the regurlisation parameter; the maximum permitted gain provided by the filters, in DECIBELS. | |
int | array2sh_getChOrder (void *const hA2sh) |
Returns the Ambisonic channel ordering convention currently being used to decode with, which should match the convention employed by the input signals (see CH_ORDER enum) | |
int | array2sh_getNormType (void *const hA2sh) |
Returns the Ambisonic normalisation convention currently being usedto decode with, which should match the convention employed by the input signals (see NORM_TYPES enum) | |
float | array2sh_getc (void *const hA2sh) |
Returns the speed of sound of the medium (~343m/s air, ~1480m/s water), in m/s. | |
float | array2sh_getGain (void *const hA2sh) |
Returns the amount of post gain to apply after the encoding, in DECIBELS. | |
float * | array2sh_getFreqVector (void *const hA2sh, int *nFreqPoints) |
Returns a pointer to the frequency vector. | |
float ** | array2sh_getbN_inv (void *const hA2sh, int *nCurves, int *nFreqPoints) |
Returns the regularised inversion of the modal coefficients per frequency (may be used for optional plotting purposes) | |
float ** | array2sh_getbN_modal (void *const hA2sh, int *nCurves, int *nFreqPoints) |
Returns the direct inversion of the modal coefficients per frequency (may be used for optional plotting purposes) | |
float * | array2sh_getSpatialCorrelation_Handle (void *const hA2sh, int *nCurves, int *nFreqPoints) |
Returns a pointer to the spatial correlation [1] data. | |
float * | array2sh_getLevelDifference_Handle (void *const hA2sh, int *nCurves, int *nFreqPoints) |
Returns a pointer to the level-difference [1] data. | |
int | array2sh_getSamplingRate (void *const hA2sh) |
Returns the DAW/Host sample rate. | |
int | array2sh_getProcessingDelay () |
Returns the processing delay in samples (may be used for delay compensation features) | |
Spatially encodes spherical microphone array signals into spherical harmonic signals (aka: Ambisonic signals) utilising theoretical encoding filters.
The algorithms within array2sh were pieced together and developed in collaboration with Symeon Delikaris-Manias and Angelo Farina. A detailed explanation of the algorithms within array2sh can be found in [1]. Also included, is a diffuse-field equalisation option for frequencies past aliasing, developed in collaboration with Archontis Politis, 8.02.2019
Definition in file array2sh.c.
void array2sh_create | ( | void **const | phA2sh | ) |
Creates an instance of array2sh.
[in] | phA2sh | (&) address of array2sh handle |
Definition at line 52 of file array2sh.c.
void array2sh_destroy | ( | void **const | phA2sh | ) |
Destroys an instance of array2sh.
[in] | phA2sh | (&) address of array2sh handle |
Definition at line 104 of file array2sh.c.
void array2sh_evalEncoder | ( | void *const | hA2sh | ) |
Evaluates the encoder, based on current global/user parameters.
[in] | hA2sh | array2sh handle |
Definition at line 161 of file array2sh.c.
int array2sh_getArrayType | ( | void *const | hA2sh | ) |
float ** array2sh_getbN_inv | ( | void *const | hA2sh, |
int * | nCurves, | ||
int * | nFreqPoints ) |
Returns the regularised inversion of the modal coefficients per frequency (may be used for optional plotting purposes)
[in] | hA2sh | array2sh handle |
[out] | nCurves | (&) number of equalisation curves (current_order+1) |
[out] | nFreqPoints | (&) number of frequencies |
Definition at line 687 of file array2sh.c.
float ** array2sh_getbN_modal | ( | void *const | hA2sh, |
int * | nCurves, | ||
int * | nFreqPoints ) |
Returns the direct inversion of the modal coefficients per frequency (may be used for optional plotting purposes)
[in] | hA2sh | array2sh handle |
[out] | nCurves | (&) number of equalisation curves (current_order+1) |
[out] | nFreqPoints | (&) number of frequencies |
Definition at line 695 of file array2sh.c.
float array2sh_getc | ( | void *const | hA2sh | ) |
Returns the speed of sound of the medium (~343m/s air, ~1480m/s water), in m/s.
Definition at line 668 of file array2sh.c.
int array2sh_getChOrder | ( | void *const | hA2sh | ) |
Returns the Ambisonic channel ordering convention currently being used to decode with, which should match the convention employed by the input signals (see CH_ORDER enum)
Definition at line 656 of file array2sh.c.
int array2sh_getDiffEQpastAliasing | ( | void *const | hA2sh | ) |
Flag to enabled/disable diffuse equalisation above the spatial aliasing limit of the array (0: disabled, 1: enabled).
Developed in collaboration with Archontis Politis.
Definition at line 551 of file array2sh.c.
int array2sh_getEncodingOrder | ( | void *const | hA2sh | ) |
Returns the current encoding order (see SH_ORDERS enum)
Definition at line 557 of file array2sh.c.
ARRAY2SH_EVAL_STATUS array2sh_getEvalStatus | ( | void *const | hA2sh | ) |
Returns current eval status (see ARRAY2SH_EVAL_STATUS enum)
Definition at line 521 of file array2sh.c.
int array2sh_getFilterType | ( | void *const | hA2sh | ) |
Returns the type filter design to employ for computing the encoding matrices (see ARRAY2SH_FILTER_TYPES enum)
Definition at line 644 of file array2sh.c.
int array2sh_getFrameSize | ( | void | ) |
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition at line 516 of file array2sh.c.
float * array2sh_getFreqVector | ( | void *const | hA2sh, |
int * | nFreqPoints ) |
Returns a pointer to the frequency vector.
[in] | hA2sh | array2sh handle |
[out] | nFreqPoints | (&) number of frequencies |
Definition at line 680 of file array2sh.c.
float array2sh_getGain | ( | void *const | hA2sh | ) |
Returns the amount of post gain to apply after the encoding, in DECIBELS.
Definition at line 674 of file array2sh.c.
float * array2sh_getLevelDifference_Handle | ( | void *const | hA2sh, |
int * | nCurves, | ||
int * | nFreqPoints ) |
Returns a pointer to the level-difference [1] data.
This is given per frequency, and is measure of the mean level difference between the encoded spherical harmonics using the current configuration is to ideal spherical harmonics
[in] | hA2sh | array2sh handle |
[out] | nCurves | (&) number of equalisation curves (current_order+1) |
[out] | nFreqPoints | (&) number of frequencies |
Definition at line 711 of file array2sh.c.
int array2sh_getMaxNumSensors | ( | void | ) |
Returns the maximum supported number of sensors which can be in the array.
Definition at line 599 of file array2sh.c.
int array2sh_getMinNumSensors | ( | void *const | hA2sh | ) |
Returns the minimum number of sensors which can be in the array [(current_order+1)^2].
Definition at line 604 of file array2sh.c.
int array2sh_getNormType | ( | void *const | hA2sh | ) |
Returns the Ambisonic normalisation convention currently being usedto decode with, which should match the convention employed by the input signals (see NORM_TYPES enum)
Definition at line 662 of file array2sh.c.
int array2sh_getNSHrequired | ( | void *const | hA2sh | ) |
Returns the number of spherical harmonic signals required by the current encoding order: (current_order+1)^2.
Definition at line 610 of file array2sh.c.
int array2sh_getNumSensors | ( | void *const | hA2sh | ) |
Returns the number of sensors in the array.
Definition at line 591 of file array2sh.c.
int array2sh_getProcessingDelay | ( | void | ) |
Returns the processing delay in samples (may be used for delay compensation features)
Definition at line 725 of file array2sh.c.
float array2sh_getProgressBar0_1 | ( | void *const | hA2sh | ) |
(Optional) Returns current intialisation/processing progress, between 0..1
Definition at line 533 of file array2sh.c.
void array2sh_getProgressBarText | ( | void *const | hA2sh, |
char * | text ) |
(Optional) Returns current intialisation/processing progress text
Definition at line 539 of file array2sh.c.
float array2sh_getr | ( | void *const | hA2sh | ) |
Returns the radius of the array, in meters.
Definition at line 616 of file array2sh.c.
float array2sh_getR | ( | void *const | hA2sh | ) |
Returns the radius of the scatterer, in meters.
Definition at line 623 of file array2sh.c.
float array2sh_getRegPar | ( | void *const | hA2sh | ) |
Returns the value of the regurlisation parameter; the maximum permitted gain provided by the filters, in DECIBELS.
Definition at line 650 of file array2sh.c.
int array2sh_getReinitSHTmatrixFLAG | ( | void *const | hA2sh | ) |
Returns 0 if SHT is not be reinitialised, 1: if it is.
Definition at line 527 of file array2sh.c.
int array2sh_getRequestEncoderEvalFLAG | ( | void *const | hA2sh | ) |
Returns a flag, which is '1' if there has been a recent request to evaluate the current encoding performance, or '0', if there hasn't.
Definition at line 545 of file array2sh.c.
int array2sh_getSamplingRate | ( | void *const | hA2sh | ) |
Returns the DAW/Host sample rate.
Definition at line 719 of file array2sh.c.
float array2sh_getSensorAzi_deg | ( | void *const | hA2sh, |
int | index ) |
Returns a particular sensor's azimuth w.r.t to the origin of the array, in DEGREES.
Definition at line 577 of file array2sh.c.
float array2sh_getSensorAzi_rad | ( | void *const | hA2sh, |
int | index ) |
Returns a particular sensor's azimuth w.r.t to the origin of the array, in RADIANS.
Definition at line 563 of file array2sh.c.
float array2sh_getSensorElev_deg | ( | void *const | hA2sh, |
int | index ) |
Returns a particular sensor's elevation w.r.t to the origin of the array, in DEGREES.
Definition at line 584 of file array2sh.c.
float array2sh_getSensorElev_rad | ( | void *const | hA2sh, |
int | index ) |
Returns a particular sensor's elevation w.r.t to the origin of the array, in RADIANS.
Definition at line 570 of file array2sh.c.
float * array2sh_getSpatialCorrelation_Handle | ( | void *const | hA2sh, |
int * | nCurves, | ||
int * | nFreqPoints ) |
Returns a pointer to the spatial correlation [1] data.
This is given per frequency, and is measure of how similar the encoded spherical harmonics using the current configuration is to ideal spherical harmonics. 1=perfect <1: less good/ aliasing
[in] | hA2sh | array2sh handle |
[out] | nCurves | (&) number of equalisation curves (current_order+1) |
[out] | nFreqPoints | (&) number of frequencies |
Definition at line 703 of file array2sh.c.
int array2sh_getWeightType | ( | void *const | hA2sh | ) |
Returns the type of weights to use see ARRAY2SH_WEIGHT_TYPES enum.
Definition at line 637 of file array2sh.c.
void array2sh_init | ( | void *const | hA2sh, |
int | samplerate ) |
Initialises an instance of array2sh with default settings.
[in] | hA2sh | array2sh handle |
[in] | samplerate | Host samplerate. |
Definition at line 148 of file array2sh.c.
void array2sh_process | ( | void *const | hA2sh, |
const float *const * | inputs, | ||
float *const * | outputs, | ||
int | nInputs, | ||
int | nOutputs, | ||
int | nSamples ) |
Spatially encode microphone/hydrophone array signals into spherical harmonic signals.
[in] | hA2sh | array2sh handle |
[in] | inputs | Input channel buffers; 2-D array: nInputs x nSamples |
[in] | outputs | Output channel buffers; 2-D array: nOutputs x nSamples |
[in] | nInputs | Number of input channels |
[in] | nOutputs | Number of output channels |
[in] | nSamples | Number of samples in 'inputs'/'output' matrices |
Definition at line 185 of file array2sh.c.
void array2sh_refreshSettings | ( | void *const | hA2sh | ) |
Sets all intialisation flags to 1; re-initialising all settings/variables as array2sh is currently configured, at next available opportunity.
Definition at line 277 of file array2sh.c.
void array2sh_setArrayType | ( | void *const | hA2sh, |
int | newType ) |
Sets the type of array (see ARRAY2SH_ARRAY_TYPES enum)
Definition at line 436 of file array2sh.c.
void array2sh_setc | ( | void *const | hA2sh, |
float | newc ) |
Sets the speed of sound of the medium (~343m/s air, ~1480m/s water), in m/s.
Definition at line 496 of file array2sh.c.
void array2sh_setChOrder | ( | void *const | hA2sh, |
int | newOrder ) |
Sets the Ambisonic channel ordering convention to encode with, in order to match the convention employed by the input signals (see CH_ORDER enum)
Definition at line 482 of file array2sh.c.
void array2sh_setDiffEQpastAliasing | ( | void *const | hA2sh, |
int | newState ) |
Analyses what the theoretical spatial aliasing frequency is, and conducts diffuse-field equalisation above this (enable: 1, disable: 0).
Thanks to Dr. Archontis Politis for suggesting and designing this feature.
Definition at line 317 of file array2sh.c.
void array2sh_setEncodingOrder | ( | void *const | hA2sh, |
int | newOrder ) |
Sets the encoding order (see SH_ORDERS enum)
Definition at line 284 of file array2sh.c.
void array2sh_setEvalStatus | ( | void *const | hA2sh, |
ARRAY2SH_EVAL_STATUS | new_evalStatus ) |
Sets current eval status (see ARRAY2SH_EVAL_STATUS enum)
Definition at line 306 of file array2sh.c.
void array2sh_setFilterType | ( | void *const | hA2sh, |
int | newType ) |
Sets the type filter design to employ for computing the encoding matrices (see ARRAY2SH_FILTER_TYPES enum)
Definition at line 460 of file array2sh.c.
void array2sh_setGain | ( | void *const | hA2sh, |
float | newGain ) |
Sets the amount of post gain to apply after the encoding, in DECIBELS.
Definition at line 507 of file array2sh.c.
void array2sh_setNormType | ( | void *const | hA2sh, |
int | newType ) |
Sets the Ambisonic normalisation convention to encode with, in order to match with the convention employed by the input signals (see NORM_TYPES enum)
Definition at line 489 of file array2sh.c.
void array2sh_setNumSensors | ( | void *const | hA2sh, |
int | newQ ) |
Sets the number of sensors in the array.
Definition at line 391 of file array2sh.c.
void array2sh_setPreset | ( | void *const | hA2sh, |
ARRAY2SH_MICROPHONE_ARRAY_PRESETS | preset ) |
Sets a pre-defined microphone/hydrophone array preset (See ARRAY2SH_MICROPHONE_ARRAY_PRESETS enum)
Definition at line 327 of file array2sh.c.
void array2sh_setr | ( | void *const | hA2sh, |
float | newr ) |
Sets the radius of the array.
Definition at line 410 of file array2sh.c.
void array2sh_setR | ( | void *const | hA2sh, |
float | newR ) |
Sets the radius (in meters) of the scatterer (only for Rigid arrays).
Definition at line 423 of file array2sh.c.
void array2sh_setRegPar | ( | void *const | hA2sh, |
float | newVal ) |
Sets the value of the regularisation parameter (the maximum permitted gain of the filters), in DECIBELS.
Definition at line 471 of file array2sh.c.
void array2sh_setRequestEncoderEvalFLAG | ( | void *const | hA2sh, |
int | newState ) |
Evaluates the performance of the current encoding filters when applied to a theoretical model of the currently configured array; two established objective metrics are then computed; more information in [1].
Definition at line 300 of file array2sh.c.
void array2sh_setSensorAzi_deg | ( | void *const | hA2sh, |
int | index, | ||
float | newAzi_deg ) |
Sets a particular sensor's azimuth (degrees) w.r.t to the origin of the array.
Input Arguments: hA2sh - array2sh handle index - sensor index newAzi_deg - sensor azimuth in DEGREES
Definition at line 364 of file array2sh.c.
void array2sh_setSensorAzi_rad | ( | void *const | hA2sh, |
int | index, | ||
float | newAzi_rad ) |
Sets a particular sensor's azimuth (radians) w.r.t to the origin of the array.
[in] | hA2sh | array2sh handle |
[in] | index | Sensor index |
[in] | newAzi_rad | Sensor azimuth in RADIANS |
Definition at line 338 of file array2sh.c.
void array2sh_setSensorElev_deg | ( | void *const | hA2sh, |
int | index, | ||
float | newElev_deg ) |
Sets a particular sensor's elevation (degrees) w.r.t to the origin of the array.
[in] | hA2sh | array2sh handle |
[in] | index | Sensor index |
[in] | newElev_deg | Sensor elevation in DEGREES |
Definition at line 378 of file array2sh.c.
void array2sh_setSensorElev_rad | ( | void *const | hA2sh, |
int | index, | ||
float | newElev_rad ) |
Sets a particular sensor's elevation (radians) w.r.t to the origin of the array.
[in] | hA2sh | array2sh handle |
[in] | index | Sensor index |
[in] | newElev_rad | Sensor elevation in RADIANS |
Definition at line 351 of file array2sh.c.
void array2sh_setWeightType | ( | void *const | hA2sh, |
int | newType ) |
Sets the type of weights to use (see ARRAY2SH_WEIGHT_TYPES enum)
Definition at line 448 of file array2sh.c.