54 *phAmbi = (
void*)pData;
93 pars->
M_dec[i][j] = NULL;
136 if(pData->
hSTFT!=NULL)
157 free(pars->
M_dec[i][j]);
179 pData->
fs = sampleRate;
190 int i, ch, d, j, n, ng, nGrid_dirs, masterOrder, nSH_order, max_nSH, nLoudspeakers;
191 float* grid_dirs_deg, *Y, *M_dec_tmp, *g, *a, *e, *a_n, *hrtf_vbap_gtable;;
193#ifdef SAF_ENABLE_SOFA_READER_MODULE
213 max_nSH = (masterOrder+1)*(masterOrder+1);
215 if(pData->
hSTFT==NULL){
236 for(ch=0; ch < nLoudspeakers; ch++)
238 if( (((sum_elev < 5.0f) && (sum_elev > -5.0f))) || (nLoudspeakers < 4) )
255 g =
malloc1d(nLoudspeakers*
sizeof(
float));
256 a =
malloc1d(nGrid_dirs*
sizeof(
float));
257 e =
malloc1d(nGrid_dirs*
sizeof(
float));
261 M_dec_tmp =
malloc1d(nLoudspeakers * max_nSH *
sizeof(
float));
278 for( n=1; n<=masterOrder; n++){
280 nSH_order = (n+1)*(n+1);
281 free(pars->
M_dec[d][n-1]);
282 pars->
M_dec[d][n-1] =
malloc1d(nLoudspeakers* nSH_order *
sizeof(
float));
285 for(i=0; i<nLoudspeakers; i++){
286 for(j=0; j<nSH_order; j++){
287 pars->
M_dec[d][n-1][i*nSH_order+j] = M_dec_tmp[i*max_nSH +j];
288 pars->
M_dec_cmplx[d][n-1][i*nSH_order+j] = cmplxf(pars->
M_dec[d][n-1][i*nSH_order+j], 0.0f);
293 a_n =
malloc1d(nSH_order*nSH_order*
sizeof(
float));
299 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nLoudspeakers, nSH_order, nSH_order, 1.0f,
300 pars->
M_dec[d][n-1], nSH_order,
301 a_n, nSH_order, 0.0f,
303 for(i=0; i<nLoudspeakers * nSH_order; i++)
307 Y =
malloc1d(nSH_order*
sizeof(
float));
309 for(ng=0; ng<nGrid_dirs; ng++){
310 azi_incl[0] = grid_dirs_deg[ng*2]*
SAF_PI/180.0f;
311 azi_incl[1] =
SAF_PI/2.0f-grid_dirs_deg[ng*2+1]*
SAF_PI/180.0f;
313 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans, nLoudspeakers, 1, nSH_order, 1.0f,
314 pars->
M_dec[d][n-1], nSH_order,
317 a[ng] = e[ng] = 0.0f;
318 for(i=0; i<nLoudspeakers; i++){
320 e[ng] += powf(g[i], 2.0f);
325 a_avg[n-1] = e_avg[n-1] = 0.0f;
326 for(ng=0; ng<nGrid_dirs; ng++){
330 a_avg[n-1] /= (float)nGrid_dirs;
331 e_avg[n-1] /= (float)nGrid_dirs;
332 pars->
M_norm[d][n-1][0] = 1.0f/(a_avg[n-1]+2.23e-6f);
333 pars->
M_norm[d][n-1][1] = sqrtf(1.0f/(e_avg[n-1]+2.23e-6f));
357#ifdef SAF_ENABLE_SOFA_READER_MODULE
365 saf_print_warning(
"Unable to load the specified SOFA file, or it contained something other than 2 channels. Using default HRIR data instead.");
401 hrtf_vbap_gtable = NULL;
406 if(hrtf_vbap_gtable==NULL){
455 free(hrtf_vbap_gtable);
472 const float *
const * inputs,
473 float*
const*
const outputs,
481 int ch, ear, i, band, orderBand, nSH_band, decIdx, nSH;
482 const float_complex calpha = cmplxf(1.0f, 0.0f), cbeta = cmplxf(0.0f, 0.0f);
485 int nLoudspeakers, binauraliseLS, masterOrder;
487 float transitionFreq;
507 for(i=0; i <
SAF_MIN(nSH, nInputs); i++)
532 nSH_band = (orderBand+1)*(orderBand+1);
535 decIdx = pData->
freqVector[band] < transitionFreq ? 0 : 1;
536 if(rE_WEIGHT[decIdx]){
537 cblas_cgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nLoudspeakers,
TIME_SLOTS, nSH_band, &calpha,
543 cblas_cgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nLoudspeakers,
TIME_SLOTS, nSH_band, &calpha,
560 for (ch = 0; ch < nLoudspeakers; ch++) {
569 for (ear = 0; ear <
NUM_EARS; ear++)
582 for(ch = 0; ch <
SAF_MIN(binauraliseLS==1 ?
NUM_EARS : nLoudspeakers, nOutputs); ch++)
584 for (; ch < nOutputs; ch++)
588 for (ch=0; ch < nOutputs; ch++)
637 if(newAzi_deg>180.0f)
638 newAzi_deg = -360.0f + newAzi_deg;
639 newAzi_deg =
SAF_MAX(newAzi_deg, -180.0f);
640 newAzi_deg =
SAF_MIN(newAzi_deg, 180.0f);
651 newElev_deg =
SAF_MAX(newElev_deg, -90.0f);
652 newElev_deg =
SAF_MIN(newElev_deg, 90.0f);
726 int band, rangeIdx, curOrder, reverse;
733 case MIC_PRESET_IDEAL:
739 case MIC_PRESET_ZYLIA:
755 case MIC_PRESET_EIGENMIKE32:
771 case MIC_PRESET_DTU_MIC:
957 return (
int)pData->
norm;
#define MAX_SH_ORDER
Maximum supported Ambisonic order.
#define PROGRESSBARTEXT_CHAR_LENGTH
Length of progress bar string.
@ PROC_STATUS_ONGOING
Codec is processing input audio, and should not be reinitialised at this time.
@ PROC_STATUS_NOT_ONGOING
Codec is not processing input audio, and may be reinitialised if needed.
NORM_TYPES
Available Ambisonic normalisation conventions.
@ NORM_SN3D
Schmidt semi-normalisation (SN3D)
@ NORM_FUMA
(Legacy) Furse-Malham scaling
@ NORM_N3D
orthonormalised (N3D)
CH_ORDER
Available Ambisonic channel ordering conventions.
@ CH_ACN
Ambisonic Channel Numbering (ACN)
@ CH_FUMA
(Legacy) Furse-Malham/B-format (WXYZ)
#define MAX_NUM_SH_SIGNALS
Maximum number of spherical harmonic components/signals supported.
@ SH_ORDER_FIRST
First-order (4 channels)
CODEC_STATUS
Current status of the codec.
@ CODEC_STATUS_NOT_INITIALISED
Codec has not yet been initialised, or the codec configuration has changed.
@ CODEC_STATUS_INITIALISED
Codec is initialised and ready to process input audio.
@ CODEC_STATUS_INITIALISING
Codec is currently being initialised, input audio should not be processed.
void afSTFT_clearBuffers(void *const hSTFT)
Flushes time-domain buffers with zeros.
void afSTFT_create(void **const phSTFT, int nCHin, int nCHout, int hopsize, int lowDelayMode, int hybridmode, AFSTFT_FDDATA_FORMAT format)
Creates an instance of afSTFT.
void afSTFT_backward_knownDimensions(void *const hSTFT, float_complex ***dataFD, int framesize, int dataFD_nCH, int dataFD_nHops, float **dataTD)
Performs backward afSTFT transform (dataFD dimensions are known)
void afSTFT_forward_knownDimensions(void *const hSTFT, float **dataTD, int framesize, int dataFD_nCH, int dataFD_nHops, float_complex ***dataFD)
Performs forward afSTFT transform (dataFD dimensions are known)
void afSTFT_getCentreFreqs(void *const hSTFT, float fs, int nBands, float *freqVector)
Returns current frequency vector.
void afSTFT_destroy(void **const phSTFT)
Destroys an instance of afSTFT.
void afSTFT_channelChange(void *const hSTFT, int new_nCHin, int new_nCHout)
Re-allocates memory to support a change in the number of input/output channels.
@ AFSTFT_BANDS_CH_TIME
nBands x nChannels x nTimeHops
#define TIME_SLOTS
Number of STFT timeslots.
#define HOP_SIZE
STFT hop size.
#define HYBRID_BANDS
Number of frequency bands.
void ambi_dec_setDecOrderAllBands(void *const hAmbi, int newValue)
Sets the decoding order for all frequency bands.
void ambi_dec_create(void **const phAmbi)
Creates an instance of the ambi_dec.
int ambi_dec_getNumLoudspeakers(void *const hAmbi)
Returns the number of loudspeakers in the current layout.
void ambi_dec_process(void *const hAmbi, const float *const *inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples)
Decodes input spherical harmonic signals to the loudspeaker channels.
int ambi_dec_getMasterDecOrder(void *const hAmbi)
Returns the master/maximum decoding order (see SH_ORDERS enum)
int ambi_dec_getNSHrequired(void *const hAmbi)
Returns the number of spherical harmonic signals required by the current decoding order: (current_ord...
void ambi_dec_setDecOrder(void *const hAmbi, int newValue, int bandIdx)
Sets the decoding order for a given frequency band.
float ambi_dec_getProgressBar0_1(void *const hAmbi)
(Optional) Returns current intialisation/processing progress, between 0..1
int ambi_dec_getEnableHRIRsPreProc(void *const hAmbi)
Returns the flag indicating whether the pre-processing applied to the HRTFs is enabled (1) or disable...
void ambi_dec_setBinauraliseLSflag(void *const hAmbi, int newState)
Sets flag to dictate whether the output loudspeaker signals should be binauralised.
float ambi_dec_getLoudspeakerElev_deg(void *const hAmbi, int index)
Returns the loudspeaker elevation in degrees for a given index.
void ambi_dec_setChOrder(void *const hAmbi, int newOrder)
Sets the Ambisonic channel ordering convention to decode with, in order to match the convention emplo...
int ambi_dec_getDecNormType(void *const hAmbi, int index)
Returns the current equalisation approach for one of the decoders (see AMBI_DEC_DIFFUSE_FIELD_EQ_APPR...
int ambi_dec_getDecOrder(void *const hAmbi, int bandIdx)
Returns the decoding order for a given frequency band index (see SH_ORDERS enum)
void ambi_dec_getProgressBarText(void *const hAmbi, char *text)
(Optional) Returns current intialisation/processing progress text
int ambi_dec_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
int ambi_dec_getNormType(void *const hAmbi)
Returns the Ambisonic normalisation convention currently being usedto decode with,...
int ambi_dec_getHRIRsamplerate(void *const hAmbi)
Returns the HRIR sample rate.
void ambi_dec_setDecEnableMaxrE(void *const hAmbi, int index, int newID)
Sets a flag to enable/disable (1 or 0) the max_rE weighting for one of the decoders.
void ambi_dec_initCodec(void *const hAmbi)
Intialises the codec variables, based on current global/user parameters.
void ambi_dec_setSofaFilePath(void *const hAmbi, const char *path)
Sets the file path for a .sofa file, in order to employ a custom HRIR set for the decoding.
int ambi_dec_getUseDefaultHRIRsflag(void *const hAmbi)
Returns the value of a flag used to dictate whether the default HRIRs in the Spatial_Audio_Framework ...
void ambi_dec_setSourcePreset(void *const hAmbi, int newPresetID)
Sets the source preset (ideal SH or SH signals derived from mic arrays)
void ambi_dec_refreshSettings(void *const hAmbi)
Sets all intialisation flags to 1.
void ambi_dec_getDecOrderHandle(void *const hAmbi, float **pX_vector, int **pY_values, int *pNpoints)
Returns handles for the decoding orders and frequency vector.
int ambi_dec_getDecOrderAllBands(void *const hAmbi)
Returns the decoding order for the first band (see SH_ORDERS enum)
void ambi_dec_setOutputConfigPreset(void *const hAmbi, int newPresetID)
Sets the output loudspeaker preset.
int ambi_dec_getProcessingDelay()
Returns the processing delay in samples; may be used for delay compensation features.
void ambi_dec_setDecNormType(void *const hAmbi, int index, int newID)
Sets the equalisation approach for one of the decoders.
int ambi_dec_getNumberOfBands(void)
Returns the number of frequency bands employed by ambi_dec.
float ambi_dec_getTransitionFreq(void *const hAmbi)
Returns the frequency (in Hz) at which to transition from the low frequency decoder to the high frequ...
void ambi_dec_setDecMethod(void *const hAmbi, int index, int newID)
Sets the decoding method for a specific decoder.
char * ambi_dec_getSofaFilePath(void *const hAmbi)
Returns the file path for a .sofa file (WITH file extension)
void ambi_dec_setLoudspeakerElev_deg(void *const hAmbi, int index, float newElev_deg)
Sets the elevation of a specific loudspeaker.
CODEC_STATUS ambi_dec_getCodecStatus(void *const hAmbi)
Returns current codec status (see CODEC_STATUS enum)
void ambi_dec_setUseDefaultHRIRsflag(void *const hAmbi, int newState)
Sets flag to dictate whether the default HRIRs in the Spatial_Audio_Framework should be used (1),...
void ambi_dec_setMasterDecOrder(void *const hAmbi, int newValue)
Sets the master decoding order.
int ambi_dec_getDecMethod(void *const hAmbi, int index)
Returns the currently selected decoding method (see AMBI_DEC_DECODING_METHODS enum)
void ambi_dec_setEnableHRIRsPreProc(void *const hAmbi, int newState)
Enable (1) or disable (0) the pre-processing applied to the HRTFs.
int ambi_dec_getChOrder(void *const hAmbi)
Returns the Ambisonic channel ordering convention currently being used to decode with,...
void ambi_dec_init(void *const hAmbi, int sampleRate)
Initialises an instance of ambi_dec with default settings.
void ambi_dec_setTransitionFreq(void *const hAmbi, float newValue)
Sets the frequeny at which to transition from the low frequency decoder to the high frequency decoder...
void ambi_dec_setLoudspeakerAzi_deg(void *const hAmbi, int index, float newAzi_deg)
Sets the azimuth of a specific loudspeaker.
void ambi_dec_setNumLoudspeakers(void *const hAmbi, int new_nLoudspeakers)
Sets the number of loudspeakers to decode to.
void ambi_dec_setNormType(void *const hAmbi, int newType)
Sets the Ambisonic normalisation convention to decode with, in order to match with the convention emp...
int ambi_dec_getMaxNumLoudspeakers()
Returns the maximum number of loudspeakers supported by ambi_dec.
int ambi_dec_getDecEnableMaxrE(void *const hAmbi, int index)
Returns the value of a flag used to dictate whether the max_rE weighting is being applied by a given ...
int ambi_dec_getBinauraliseLSflag(void *const hAmbi)
Returns the value of a flag used to dictate whether the loudspeaker signals should be binauralised (0...
void ambi_dec_destroy(void **const phAmbi)
Destroys an instance of the ambi_dec.
int ambi_dec_getDAWsamplerate(void *const hAmbi)
Returns the DAW/Host sample rate.
float ambi_dec_getLoudspeakerAzi_deg(void *const hAmbi, int index)
Returns the loudspeaker azimuth in degrees for a given index.
#define AMBI_DEC_TRANSITION_MIN_VALUE
Minimum transition value between low/high frequency decoders, in Hz.
#define AMBI_DEC_TRANSITION_MAX_VALUE
Maximum transition value between low/high frequency decoders, in Hz.
AMBI_DEC_DIFFUSE_FIELD_EQ_APPROACH
When using mixed order decoding (i.e.
@ AMPLITUDE_PRESERVING
preserve omni amplitude
@ ENERGY_PRESERVING
preserve omni energy
@ DECODING_METHOD_SAD
Sampling Ambisonic Decoder (SAD)
@ DECODING_METHOD_MMD
Mode-Matching Decoder (MMD)
@ DECODING_METHOD_EPAD
Energy-Preserving Ambisonic Decoder (EPAD)
@ DECODING_METHOD_ALLRAD
All-Round Ambisonic Decoder (AllRAD)
void ambi_dec_setCodecStatus(void *const hAmbi, CODEC_STATUS newStatus)
Sets codec status (see CODEC_STATUS enum)
void ambi_dec_interpHRTFs(void *const hAmbi, float azimuth_deg, float elevation_deg, float_complex h_intrp[HYBRID_BANDS][NUM_EARS])
Interpolates between the 3 nearest HRTFs using amplitude-preserving VBAP gains.
void loadLoudspeakerArrayPreset(LOUDSPEAKER_ARRAY_PRESETS preset, float dirs_deg[MAX_NUM_LOUDSPEAKERS][2], int *newNCH, int *nDims)
Returns the loudspeaker directions for a specified loudspeaker array preset.
A frequency-dependent Ambisonic decoder for reproducing Ambisonic sound scenes over loudspeakers.
#define MIN_NUM_LOUDSPEAKERS
To avoid triangulation errors when using AllRAD.
#define AMBI_DEC_FRAME_SIZE
Framesize, in time-domain samples.
#define MAX_NUM_LOUDSPEAKERS
Maximum permitted output channels.
#define NUM_DECODERS
One for low-frequencies and another for high-frequencies.
void convertHOAChannelConvention(float *insig, int order, int signalLength, HOA_CH_ORDER inConvention, HOA_CH_ORDER outConvention)
Converts an Ambisonic signal from one channel ordering convention to another.
void getLoudspeakerDecoderMtx(float *ls_dirs_deg, int nLS, LOUDSPEAKER_AMBI_DECODER_METHODS method, int order, int enableMaxReWeighting, float *decMtx)
Computes an ambisonic decoding matrix of a specific order, for a given loudspeaker layout.
void convertHOANormConvention(float *insig, int order, int signalLength, HOA_NORM inConvention, HOA_NORM outConvention)
Converts an Ambisonic signal from one normalisation convention to another.
void getMaxREweights(int order, int diagMtxFlag, float *a_n)
Computes the weights required to manipulate a hyper-cardioid beam-pattern, such that it has maximum e...
@ HOA_CH_ORDER_FUMA
Furse-Malham (FuMa) convention, often used by older recordings.
@ HOA_CH_ORDER_ACN
Ambisonic Channel numbering (ACN) convention, which is employed by all spherical harmonic related fun...
@ LOUDSPEAKER_DECODER_ALLRAD
All-Round Ambisonic Decoder (AllRAD): SAD decoding to a t-design, panned for the target loudspeaker d...
@ LOUDSPEAKER_DECODER_SAD
Sampling Ambisonic Decoder (SAD): transpose of the loudspeaker spherical harmonic matrix,...
@ LOUDSPEAKER_DECODER_EPAD
Energy-Preserving Ambisonic Decoder (EPAD) [1].
@ LOUDSPEAKER_DECODER_MMD
Mode-Matching Decoder (MMD): pseudo-inverse of the loudspeaker spherical harmonic matrix.
@ HOA_NORM_FUMA
Furse-Malham (FuMa) convention.
@ HOA_NORM_SN3D
Schmidt semi-normalisation (SN3D) convention, as used by the AmbiX standard.
@ HOA_NORM_N3D
Orthonormalised (N3D) convention, which is the default convention used by SAF.
const int __default_N_hrir_dirs
The number of directions/measurements in the default HRIR dataset.
const float __default_hrirs[836][2][256]
The default HRIR data for SAF.
const float __default_hrir_dirs_deg[836][2]
The measurement directions used for the default HRIR dataset.
const int __default_hrir_len
The length of the filters, in samples, for the default HRIR dataset.
const int __default_hrir_fs
The samplerate used to measure the default HRIR filters
void diffuseFieldEqualiseHRTFs(int N_dirs, float *itds_s, float *centreFreq, int N_bands, float *weights, int applyEQ, int applyPhase, float_complex *hrtfs)
Applies pre-processing to a set of HRTFs, which can either be diffuse-field EQ of an (optionally weig...
void estimateITDs(float *hrirs, int N_dirs, int hrir_len, int fs, float *itds_s)
Estimates the interaural time-differences (ITDs) for each HRIR based on the cross-correlation between...
void HRIRs2HRTFs_afSTFT(float *hrirs, int N_dirs, int hrir_len, int hopsize, int LDmode, int hybridmode, float_complex *hrtf_fb)
Passes zero padded HRIRs through the afSTFT filterbank.
#define ORDER2NSH(order)
Converts spherical harmonic order to number of spherical harmonic components i.e: (order+1)^2.
int calculateGridWeights(float *dirs_rad, int nDirs, int order, float *w)
Computes approximation of quadrature/integration weights for a given grid.
void getSHreal(int order, float *dirs_rad, int nDirs, float *Y)
Computes real-valued spherical harmonics [1] for each given direction on the unit sphere.
void saf_sofa_close(saf_sofa_container *c)
Frees all SOFA data in a sofa_container.
SAF_SOFA_ERROR_CODES saf_sofa_open(saf_sofa_container *h, char *sofa_filepath, SAF_SOFA_READER_OPTIONS option)
Fills a 'sofa_container' with data found in a SOFA file (GeneralFIR or SimpleFreeFieldHRIR),...
SAF_SOFA_ERROR_CODES
SOFA loader error codes.
@ SAF_SOFA_READER_OPTION_DEFAULT
The default option is SAF_SOFA_READER_OPTION_LIBMYSOFA.
@ SAF_SOFA_OK
None of the error checks failed.
#define SAF_CLAMP(a, min, max)
Ensures value "a" is clamped between the "min" and "max" values.
#define SAF_PI
pi constant (single precision)
#define SAF_MAX(a, b)
Returns the maximum of the two values.
#define NUM_EARS
2 (true for most humans)
void utility_svvcopy(const float *a, const int len, float *c)
Single-precision, vector-vector copy, i.e.
const float __Tdesign_degree_30_dirs_deg[480][2]
Directions [azimuth, Elevation] in degrees, for minimum Tdesign degree: 30.
#define SAF_MIN(a, b)
Returns the minimum of the two values.
void sphElev2incl(float *dirsElev, int nDirs, int degreesFlag, float *dirsIncl)
Converts spherical coordinates of unit length from elevation to inclination.
const float __Eigenmike32_freqRange[6]
Sensor array frequency ranges for each SH order, for the Eigenmike32 (should only be used as a rough ...
#define saf_print_warning(message)
Macro to print a warning message along with the filename and line number.
const int __Eigenmike32_maxOrder
Max spherical harmonic order for the Eigenmike32.
const float __Zylia_freqRange[4]
Sensor array frequency ranges for each SH order, for the Zylia array (should only be used as a rough ...
const int __DTU_mic_maxOrder
Max spherical harmonic order for the custom 52-sensor array built at the Technical University of Denm...
const float __DTU_mic_freqRange[10]
Sensor array frequency ranges for each SH order, for the DTU mic (should only be used as a rough esti...
const int __Zylia_maxOrder
Max spherical harmonic order for the Zylia mic.
void generateVBAPgainTable3D(float *ls_dirs_deg, int L, int az_res_deg, int el_res_deg, int omitLargeTriangles, int enableDummies, float spread, float **gtable, int *N_gtable, int *nTriangles)
Generates a 3-D VBAP gain table based on specified loudspeaker directions, with optional spreading [2...
void compressVBAPgainTable3D(float *vbap_gtable, int nTable, int nDirs, float *vbap_gtableComp, int *vbap_gtableIdx)
Compresses a VBAP gain table to use less memory and CPU (by removing the elements which are just zero...
void ** malloc2d(size_t dim1, size_t dim2, size_t data_size)
2-D malloc (contiguously allocated, so use free() as usual to deallocate)
void * malloc1d(size_t dim1_data_size)
1-D malloc (same as malloc, but with error checking)
void * realloc1d(void *ptr, size_t dim1_data_size)
1-D realloc (same as realloc, but with error checking)
void *** malloc3d(size_t dim1, size_t dim2, size_t dim3, size_t data_size)
3-D malloc (contiguously allocated, so use free() as usual to deallocate)
#define FLATTEN2D(A)
Use this macro when passing a 2-D dynamic multi-dimensional array to memset, memcpy or any other func...
#define FLATTEN3D(A)
Use this macro when passing a 3-D dynamic multi-dimensional array to memset, memcpy or any other func...
Contains variables for sofa file loading, HRTF interpolation, and the loudspeaker decoders.
float_complex hrtf_interp[MAX_NUM_LOUDSPEAKERS][HYBRID_BANDS][NUM_EARS]
interpolated HRTFs
char * sofa_filepath
absolute/relevative file path for a sofa file
float * M_dec_maxrE[NUM_DECODERS][MAX_SH_ORDER]
ambisonic decoding matrices with maxrE weighting ([0] for low-freq, [1] for high-freq); FLAT: nLoudsp...
float * M_dec[NUM_DECODERS][MAX_SH_ORDER]
ambisonic decoding matrices ([0] for low-freq, [1] for high-freq); FLAT: nLoudspeakers x nSH
int hrtf_nTriangles
number of triangle groups after triangulation
float * itds_s
interaural-time differences for each HRIR (in seconds); N_hrirs x 1
int * hrtf_vbap_gtableIdx
N_hrtf_vbap_gtable x 3.
int hrtf_vbapTableRes[2]
[azi elev] step sizes in degrees
int hrir_len
length of the HRIRs, this can be truncated, see "saf_sofa_reader.h"
float_complex * hrtf_fb
HRTF filterbank coefficients; nBands x nCH x N_hrirs.
int hrir_fs
sampling rate of the HRIRs, should ideally match the host sampling rate, although not required
float_complex * M_dec_cmplx_maxrE[NUM_DECODERS][MAX_SH_ORDER]
complex ambisonic decoding matrices with maxrE weighting ([0] for low-freq, [1] for high-freq); FLAT:...
float * hrtf_fb_mag
magnitudes of the HRTF filterbank coefficients; nBands x nCH x N_hrirs
int N_hrtf_vbap_gtable
number of interpolation directions
float_complex * M_dec_cmplx[NUM_DECODERS][MAX_SH_ORDER]
complex ambisonic decoding matrices ([0] for low-freq, [1] for high-freq); FLAT: nLoudspeakers x nSH
float * weights
grid integration weights of hrirs; N_hrirs x 1
int N_hrir_dirs
number of HRIR directions in the current sofa file
float * hrtf_vbap_gtableComp
N_hrtf_vbap_gtable x 3.
float * hrirs
time domain HRIRs; N_hrir_dirs x 2 x hrir_len
float M_norm[NUM_DECODERS][MAX_SH_ORDER][2]
norm coefficients to preserve omni energy/amplitude between different orders and decoders
float * hrir_dirs_deg
directions of the HRIRs in degrees [azi elev]; N_hrir_dirs x 2
Main structure for ambi_dec.
CODEC_STATUS codecStatus
see CODEC_STATUS
int new_nLoudpkrs
if new_nLoudpkrs != nLoudpkrs, afSTFT is reinitialised (current value will be replaced by this after ...
int new_masterOrder
if new_masterOrder != masterOrder, ambi_dec is reinitialised (current value will be replaced by this ...
CH_ORDER chOrdering
Ambisonic channel order convention (see CH_ORDER)
int loudpkrs_nDims
dimensionality of the current loudspeaker set-up
float ** SHFrameTD
Input spherical harmonic (SH) signals in the time-domain; MAX_NUM_SH_SIGNALS x AMBI_DEC_FRAME_SIZE.
float loudpkrs_dirs_deg[MAX_NUM_LOUDSPEAKERS][NUM_DECODERS]
loudspeaker directions in degrees [azi, elev]
float_complex *** binframeTF
Output binaural signals in the time-frequency domain; HYBRID_BANDS x NUM_EARS x TIME_SLOTS.
int useDefaultHRIRsFLAG
1: use default HRIRs in database, 0: use those from SOFA file
float transitionFreq
transition frequency for the 2 decoders, in Hz
void * hSTFT
afSTFT handle
int rE_WEIGHT[NUM_DECODERS]
0:disabled, 1: enable max_rE weight
AMBI_DEC_DIFFUSE_FIELD_EQ_APPROACH diffEQmode[NUM_DECODERS]
diffuse-field EQ approach; see AMBI_DEC_DIFFUSE_FIELD_EQ_APPROACH enum
float_complex *** SHframeTF
Input spherical harmonic (SH) signals in the time-frequency domain; HYBRID_BANDS x MAX_NUM_SH_SIGNALS...
int enableHRIRsPreProc
flag to apply pre-processing to the currently loaded HRTFs
float progressBar0_1
Current (re)initialisation progress, between [0..1].
int masterOrder
Current maximum/master decoding order.
NORM_TYPES norm
Ambisonic normalisation convention (see NORM_TYPES)
float ** outputFrameTD
Output loudspeaker or binaural signals in the time-domain; MAX_NUM_LOUDSPEAKERS x AMBI_DEC_FRAME_SIZE...
int recalc_hrtf_interpFLAG[MAX_NUM_LOUDSPEAKERS]
0: no init required, 1: init required
int nLoudpkrs
number of loudspeakers/virtual loudspeakers
AMBI_DEC_DECODING_METHODS dec_method[NUM_DECODERS]
decoding methods for each decoder, see AMBI_DEC_DECODING_METHODS enum
PROC_STATUS procStatus
see PROC_STATUS
float freqVector[HYBRID_BANDS]
frequency vector for time-frequency transform, in Hz
char * progressBarText
Current (re)initialisation step, string.
int orderPerBand[HYBRID_BANDS]
Ambisonic decoding order per frequency band 1..SH_ORDER.
int binauraliseLS
1: convolve loudspeaker signals with HRTFs, 0: output loudspeaker signals
ambi_dec_codecPars * pars
codec parameters
float_complex *** outputframeTF
Output loudspeaker signals in the time-frequency domain; HYBRID_BANDS x MAX_NUM_LOUDSPEAKERS x TIME_S...
int new_binauraliseLS
if new_binauraliseLS != binauraliseLS, ambi_dec is reinitialised (current value will be replaced by t...
int reinit_hrtfsFLAG
0: no init required, 1: init required
SOFA container struct comprising all possible data that can be extracted from SOFA 1....
int DataLengthIR
Length of the IRs, in samples.
int nSources
Number of source/measurement positions.
float * SourcePosition
Source positions (refer to SourcePositionType & SourcePositionUnits for the convention and units); FL...
float DataSamplingRate
Sampling rate used to measure the IRs.
int nReceivers
Number of ears/number of mics etc.
float * DataIR
The impulse response (IR) Data; FLAT:nSources x nReceivers x DataLengthIR.