39#ifndef __SAF_SH_H_INCLUDED__
40#define __SAF_SH_H_INCLUDED__
51#define ORDER2NSH(order) ((order+1)*(order+1))
55#define NSH2ORDER(nSH) ( (int)(sqrt((double)nSH)-0.999) )
289 float_complex* T_c2r);
308 float_complex* T_r2c);
376 float_complex* A_xyz);
420 float_complex* A_xyz,
425 float* sectorCoeffs);
467 float_complex* A_xyz,
472 float* sectorCoeffs);
586 float_complex* A_xyz,
618 float_complex* A_xyz,
620 float_complex* velCoeffs);
660 float_complex* c_nm);
718 float* grid_dirs_deg,
768 float* grid_dirs_deg,
849 void *
const hESPRIT,
853 float* src_dirs_rad);
870 float_complex* Y_grid,
893 float_complex* Y_grid,
898 float_complex* w_MVDR);
932 float_complex* Y_grid,
956 float_complex* Y_grid,
980 float_complex* Y_grid,
1010 float amp_thresh_dB,
1011 float_complex* H_array,
1012 float* grid_dirs_deg,
1018 float_complex* H_sht);
1038 float amp_thresh_dB,
1039 float_complex* H_array,
1040 float* grid_dirs_deg,
1062 float_complex* H_sht,
1065 float alias_freq_hz,
1070 float_complex* H_sht_eq);
1088 double_complex* b_N);
1161 double_complex* b_N);
1183 double_complex* b_N);
1207 double_complex* b_N);
1227 float* sensor_dirs_rad,
1248 float_complex* H_array,
1254 float_complex* M_diffcoh);
1296 float* sensor_dirs_rad,
1298 float* src_dirs_deg,
1302 float_complex* H_array);
1331 float* sensor_dirs_rad,
1333 float* src_dirs_deg,
1338 float_complex* H_array);
1374 float_complex* M_array2SH,
1377 float_complex* H_array,
1379 float_complex* Y_grid,
void generateMinNormMap(int order, float_complex *Cx, float_complex *Y_grid, int nSources, int nGrid_dirs, int logScaleFlag, float *pmap)
Generates an activity-map based on the sub-space minimum-norm (MinNorm) method.
void generateMVDRmap(int order, float_complex *Cx, float_complex *Y_grid, int nGrid_dirs, float regPar, float *pmap, float_complex *w_MVDR)
Generates a powermap based on the energy of adaptive Minimum-Variance Distortion-less Response (MVDR)...
void arraySHTmatricesDiffEQ(float_complex *H_sht, float_complex *DCM, float *freqVector, float alias_freq_hz, int nBins, int order, int nMics, float_complex *H_sht_eq)
Diffuse-field equalisation of SHT matrices above the spatial aliasing frequency.
void sphMUSIC_destroy(void **const phMUSIC)
Destroys an instance of the spherical harmonic domain MUSIC implementation.
void unnorm_legendreP(int n, double *x, int lenX, double *y)
Calculates unnormalised Legendre polynomials up to order N, for all values in vector x [1].
void rotateAxisCoeffsComplex(int order, float *c_n, float theta_0, float phi_0, float_complex *c_nm)
Generates spherical coefficients for a rotated axisymmetric pattern (COMPLEX)
void sphPWD_create(void **const phPWD, int order, float *grid_dirs_deg, int nDirs)
Creates an instance of a spherical harmonic domain implementation of the steer-response power (SRP) a...
void cylModalCoeffs(int order, double *kr, int nBands, ARRAY_CONSTRUCTION_TYPES arrayType, double_complex *b_N)
Calculates the modal coefficients for open/rigid cylindrical arrays.
void evaluateSHTfilters(int order, float_complex *M_array2SH, int nSensors, int nBands, float_complex *H_array, int nDirs, float_complex *Y_grid, float *cSH, float *lSH)
Generates some objective measures, which evaluate the performance of spatial encoding filters.
void sphMUSIC_compute(void *const hMUSIC, float_complex *Vn, int nSrcs, float *P_music, int *peak_inds)
Computes a pseudo-spectrum based on the MUSIC algorithm in the spherical harmonic domain; optionally ...
void sphESPRIT_create(void **const phESPRIT, int order)
Creates an instance of the spherical harmonic domain ESPRIT-based direction of arrival estimator.
float computeSectorCoeffsEP(int orderSec, float_complex *A_xyz, SECTOR_PATTERNS pattern, float *sec_dirs_deg, int nSecDirs, float *sectorCoeffs)
Computes beamforming matrices (sector coefficients) which, when applied to input SH signals,...
void unnorm_legendreP_recur(int n, float *x, int lenX, float *Pnm_minus1, float *Pnm_minus2, float *Pnm)
Calculates unnormalised Legendre polynomials up to order N, for all values in vector x.
int calculateGridWeights(float *dirs_rad, int nDirs, int order, float *w)
Computes approximation of quadrature/integration weights for a given grid.
void beamWeightsDolphChebyshev2Spherical(int N, int paramType, float arrayParam, float *b_n)
Generates beamweights in the SHD for Dolph-Chebyshev beampatterns, with mainlobe and sidelobe control...
void diffCohMtxMeas(float_complex *H_array, int nBins, int N_sensors, int nGrid, float *w_grid, float_complex *M_diffcoh)
Calculates the diffuse coherence matrices for an arbitrary array.
void getSHcomplex(int order, float *dirs_rad, int nDirs, float_complex *Y)
Computes complex-valued spherical harmonics [1] for each given direction on the unit sphere.
void beamWeightsVelocityPatternsReal(int order, float *b_n, float azi_rad, float elev_rad, float_complex *A_xyz, float *velCoeffs)
Generates beamforming coefficients for velocity patterns (REAL)
void sphMUSIC_create(void **const phMUSIC, int order, float *grid_dirs_deg, int nDirs)
Creates an instance of the spherical harmonic domain MUSIC implementation, which may be used for comp...
void beamWeightsVelocityPatternsComplex(int order, float *b_n, float azi_rad, float elev_rad, float_complex *A_xyz, float_complex *velCoeffs)
Generates beamforming coefficients for velocity patterns (COMPLEX)
void sphESPRIT_estimateDirs(void *const hESPRIT, float_complex *Us, int K, float *src_dirs_rad)
Estimates the direction-of-arrival (DoA) based on the ESPRIT-based estimator, in the spherical harmon...
void sphModalCoeffs(int order, double *kr, int nBands, ARRAY_CONSTRUCTION_TYPES arrayType, double dirCoeff, double_complex *b_N)
Calculates the modal coefficients for open/rigid spherical arrays.
void beamWeightsCardioid2Spherical(int N, float *b_n)
Generates spherical coefficients for generating cardioid beampatterns.
void beamWeightsMaxEV(int N, float *b_n)
Generates beamweights in the SHD for maximum energy-vector beampatterns.
void sphPWD_destroy(void **const phPWD)
Destroys an instance of the spherical harmonic domain PWD implementation.
void rotateAxisCoeffsReal(int order, float *c_n, float theta_0, float phi_0, float *c_nm)
Generates spherical coefficients for a rotated axisymmetric pattern (REAL)
float sphArrayAliasLim(float r, float c, int maxN)
Returns a simple estimate of the spatial aliasing limit (the kR = maxN rule)
void complex2realSHMtx(int order, float_complex *T_c2r)
Computes a complex to real spherical harmonic transform matrix.
void sphPWD_compute(void *const hPWD, float_complex *Cx, int nSrcs, float *P_map, int *peak_inds)
Computes a power-map based on determining the energy of hyper-cardioid beamformers; optionally,...
void diffCohMtxMeasReal(float *H_array, int N_sensors, int nGrid, float *w_grid, float *M_diffcoh)
Calculates the diffuse coherence matrices for an array that uses a broad-band real-valued basis.
void sphArrayNoiseThreshold(int maxN, int Nsensors, float r, float c, ARRAY_CONSTRUCTION_TYPES arrayType, double dirCoeff, float maxG_db, float *f_lim)
Computes the frequencies (per order), at which the noise of a SHT of a SMA exceeds a specified maximu...
void generateMUSICmap(int order, float_complex *Cx, float_complex *Y_grid, int nSources, int nGrid_dirs, int logScaleFlag, float *pmap)
Generates an activity-map based on the sub-space multiple-signal classification (MUSIC) method.
void beamWeightsHypercardioid2Spherical(int N, float *b_n)
Generates beamweights in the SHD for hypercardioid beampatterns.
void complex2realCoeffs(int order, float_complex *C_N, int K, float *R_N)
Converts SH coefficients from the complex to real basis.
ARRAY_CONSTRUCTION_TYPES
Microphone/Hydrophone array construction types.
void simulateCylArray(int order, double *kr, int nBands, float *sensor_dirs_rad, int N_sensors, float *src_dirs_deg, int N_srcs, ARRAY_CONSTRUCTION_TYPES arrayType, float_complex *H_array)
Simulates a cylindrical microphone array, returning the transfer functions for each (plane wave) sour...
void arraySHTmatrices(ARRAY_SHT_OPTIONS method, int order, float amp_thresh_dB, float_complex *H_array, float *grid_dirs_deg, int nBins, int nMics, int nGrid, float *w_grid, float_complex *H_sht)
Computes matrices required to transform array signals into spherical harmonic signals (frequency-doma...
void sphESPRIT_destroy(void **const phESPRIT)
Destroys an instance of the spherical harmonic domain ESPRIT-based direction of arrival estimator.
SECTOR_PATTERNS
Sector pattern designs for directionally-constraining sound-fields [1].
void simulateSphArray(int order, double *kr, double *kR, int nBands, float *sensor_dirs_rad, int N_sensors, float *src_dirs_deg, int N_srcs, ARRAY_CONSTRUCTION_TYPES arrayType, double dirCoeff, float_complex *H_array)
Simulates a spherical microphone array, returning the transfer functions for each (plane wave) source...
void getSHrotMtxReal(float R[3][3], float *RotMtx, int L)
Generates a real-valued spherical harmonic rotation matrix [1] based on a 3x3 rotation matrix (see qu...
void getSHreal_recur(int order, float *dirs_rad, int nDirs, float *Y)
Computes real-valued spherical harmonics [1] for each given direction on the unit sphere.
void arraySHTfilters(ARRAY_SHT_OPTIONS method, int order, float amp_thresh_dB, float_complex *H_array, float *grid_dirs_deg, int nFFT, int nMics, int nGrid, float *w_grid, float *h_sht)
Computes filters required to transform array signals into spherical harmonic signals (time-domain)
void generatePWDmap(int order, float_complex *Cx, float_complex *Y_grid, int nGrid_dirs, float *pmap)
Generates a powermap based on the energy of a plane-wave decomposition (PWD) (i.e.
void computeVelCoeffsMtx(int sectorOrder, float_complex *A_xyz)
Computes the matrices which generate the coefficients of a beampattern of order (sectorOrder+1) that ...
float computeSectorCoeffsAP(int orderSec, float_complex *A_xyz, SECTOR_PATTERNS pattern, float *sec_dirs_deg, int nSecDirs, float *sectorCoeffs)
Computes beamforming matrices (sector coefficients) which, when applied to input SH signals,...
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 sphDiffCohMtxTheory(int order, float *sensor_dirs_rad, int N_sensors, ARRAY_CONSTRUCTION_TYPES arrayType, double dirCoeff, double *kr, int nBands, double *M_diffcoh)
Calculates the theoretical diffuse coherence matrix for a spherical array.
void sphScattererModalCoeffs(int order, double *kr, double *kR, int nBands, double_complex *b_N)
Calculates the modal coefficients for a rigid spherical scatterer with omni-directional sensors.
void checkCondNumberSHTReal(int order, float *dirs_rad, int nDirs, float *w, float *cond_N)
Computes the condition numbers for a least-squares SHT.
void real2complexSHMtx(int order, float_complex *T_r2c)
Computes a real to complex spherical harmonic transform matrix.
void sphScattererDirModalCoeffs(int order, double *kr, double *kR, int nBands, double dirCoeff, double_complex *b_N)
Calculates the modal coefficients for a rigid spherical scatterer with directional sensors.
ARRAY_SHT_OPTIONS
Microphone array to spherical harmonic domain conversion options.
void generateCroPaCLCMVmap(int order, float_complex *Cx, float_complex *Y_grid, int nGrid_dirs, float regPar, float lambda, float *pmap)
(EXPERIMENTAL) Generates a powermap utilising the CroPaC LCMV post-filter described in [1]
@ ARRAY_CONSTRUCTION_RIGID_DIRECTIONAL
Rigid baffle, directional sensors.
@ ARRAY_CONSTRUCTION_RIGID
Rigid baffle, omni-directional sensors.
@ ARRAY_CONSTRUCTION_OPEN_DIRECTIONAL
Open array, directional sensors.
@ ARRAY_CONSTRUCTION_OPEN
Open array, omni-directional sensors.
@ SECTOR_PATTERN_PWD
Plane-wave decomposition/Hyper-cardioid.
@ SECTOR_PATTERN_MAXRE
Spatially tapered hyper-cardioid, such that it has maximum energy concentrated in the look- direction...
@ SECTOR_PATTERN_CARDIOID
Cardioid pattern.
@ ARRAY_SHT_DEFAULT
The default SHT filters are ARRAY_SHT_REG_LS.
@ ARRAY_SHT_REG_LS
Regularised least-squares (LS)
@ ARRAY_SHT_REG_LSHD
Regularised least-squares (LS) in the SH domain (similar as in [1])
Contains wrappers for handling complex numbers across both C99-compliant compilers and Microsoft Visu...