SAF
|
Files | |
file | saf_default_hrirs.c |
Default HRIR data. | |
file | saf_hrir.c |
Public source for the HRIR/HRTF processing module (SAF_HRIR_MODULE) | |
file | saf_hrir.h |
Main header for the HRIR/HRTF processing module (SAF_HRIR_MODULE) | |
Functions | |
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 the left and right channels, which are first low-pass filtered at 750Hz. | |
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. | |
void | HRIRs2HRTFs_qmf (float *hrirs, int N_dirs, int hrir_len, int hopsize, int hybridmode, float_complex *hrtf_fb) |
Passes zero padded HRIRs through the qmf filterbank. | |
void | HRIRs2HRTFs (float *hrirs, int N_dirs, int hrir_len, int fftSize, float_complex *hrtfs) |
Converts HRIRs to HRTFs for a given FFT size. | |
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 weighted) average of all HRTFs (CTF), phase simplification based on ITDs, or both. | |
void | interpHRTFs (float_complex *hrtfs, float *itds, float *freqVector, float *interp_table, int N_hrtf_dirs, int N_bands, int N_interp_dirs, float_complex *hrtf_interp) |
Interpolates a set of HRTFs based on a specified interpolation table. | |
void | binauralDiffuseCoherence (float_complex *hrtfs, float *itds, float *freqVector, int N_hrtf_dirs, int N_bands, float *HRTFcoh) |
Computes the binaural diffuse coherence per frequency for a given HRTF set, as described in [1]. | |
void | resampleHRIRs (float *hrirs_in, int hrirs_N_dirs, int hrirs_in_len, int hrirs_in_fs, int hrirs_out_fs, int padToNextPow2, float **hrirs_out, int *hrirs_out_len) |
Resamples a set of HRIRs from its original samplerate to a new samplerate. | |
Variables | |
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_N_hrir_dirs |
The number of directions/measurements in 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 | |
HRIR/HRTF processing module
void binauralDiffuseCoherence | ( | float_complex * | hrtfs, |
float * | itds, | ||
float * | freqVector, | ||
int | N_hrtf_dirs, | ||
int | N_bands, | ||
float * | HRTFcoh ) |
Computes the binaural diffuse coherence per frequency for a given HRTF set, as described in [1].
[in] | hrtfs | HRTFs as filterbank coeffs FLAT: N_bands x NUM_EARS x N_hrtf_dirs |
[in] | itds | The inter-aural time difference (ITD) for each HRIR; N_hrtf_dirs x 1 |
[in] | freqVector | Frequency vector; N_bands x 1 |
[in] | N_hrtf_dirs | Number of HRTF directions |
[in] | N_bands | Number of frequency bands |
[out] | HRTFcoh | Binaural coherence per frequency; N_bands x 1 |
Definition at line 322 of file saf_hrir.c.
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 weighted) average of all HRTFs (CTF), phase simplification based on ITDs, or both.
[in] | N_dirs | Number of HRTFs |
[in] | itds_s | HRIR ITDs (set to NULL if not needed); N_dirs x 1 |
[in] | centreFreq | Frequency vector (set to NULL if not needed); N_bands x 1 |
[in] | N_bands | Number of frequency bands/bins |
[in] | weights | Grid weights (set to NULL if not available); N_dirs x 1 |
[in] | applyEQ | Diffuse-field EQ / CTF; 0:disabled, 1:enabled |
[in] | applyPhase | Phase simplification; 0:disabled, 1:enabled |
[in,out] | hrtfs | The HRTFs; FLAT: N_bands x NUM_EARS x N_dirs |
Definition at line 173 of file saf_hrir.c.
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 the left and right channels, which are first low-pass filtered at 750Hz.
[in] | hrirs | HRIRs; FLAT: N_dirs x NUM_EARS x hrir_len |
[in] | N_dirs | Number of HRIRs |
[in] | hrir_len | Length of the HRIRs in samples |
[in] | fs | Sampling rate of the HRIRs |
[out] | itds_s | ITDs in seconds; N_dirs x 1 |
Definition at line 40 of file saf_hrir.c.
void HRIRs2HRTFs | ( | float * | hrirs, |
int | N_dirs, | ||
int | hrir_len, | ||
int | fftSize, | ||
float_complex * | hrtfs ) |
Converts HRIRs to HRTFs for a given FFT size.
[in] | hrirs | HRIRs; FLAT: N_dirs x NUM_EARS x hrir_len |
[in] | N_dirs | Number of HRIRs |
[in] | hrir_len | Length of the HRIRs in samples |
[in] | fftSize | FFT size |
[out] | hrtfs | HRTFs; FLAT: (fftSize/2+1) x NUM_EARS x N_dirs |
Definition at line 139 of file saf_hrir.c.
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.
The filterbank coefficients are then normalised with the energy of an impulse, which is centered at approximately the beginning of the median HRIR peak.
[in] | hrirs | HRIRs; FLAT: N_dirs x NUM_EARS x hrir_len |
[in] | N_dirs | Number of HRIRs |
[in] | hrir_len | Length of the HRIRs in samples |
[in] | hopsize | Hop size in samples |
[in] | LDmode | Low-Delay mode, 0:disabled, 1:enabled |
[in] | hybridmode | Hybrid-filtering, 0:disabled, 1:enabled |
[out] | hrtf_fb | HRTFs as filterbank coeffs; FLAT: (hybrid ? hopsize+5 : hopsize+1) x NUM_EARS x N_dirs |
Definition at line 110 of file saf_hrir.c.
void HRIRs2HRTFs_qmf | ( | float * | hrirs, |
int | N_dirs, | ||
int | hrir_len, | ||
int | hopsize, | ||
int | hybridmode, | ||
float_complex * | hrtf_fb ) |
Passes zero padded HRIRs through the qmf filterbank.
The filterbank coefficients are then normalised with the energy of an impulse, which is centered at approximately the beginning of the median HRIR peak.
[in] | hrirs | HRIRs; FLAT: N_dirs x NUM_EARS x hrir_len |
[in] | N_dirs | Number of HRIRs |
[in] | hrir_len | Length of the HRIRs in samples |
[in] | hopsize | Hop size in samples |
[in] | hybridmode | 0:disabled, 1:enabled |
[out] | hrtf_fb | HRTFs as filterbank coeffs; FLAT: (hybrid ? hopsize+7 : hopsize+1) x NUM_EARS x N_dirs |
Definition at line 125 of file saf_hrir.c.
void interpHRTFs | ( | float_complex * | hrtfs, |
float * | itds, | ||
float * | freqVector, | ||
float * | interp_table, | ||
int | N_hrtf_dirs, | ||
int | N_bands, | ||
int | N_interp_dirs, | ||
float_complex * | hrtf_interp ) |
Interpolates a set of HRTFs based on a specified interpolation table.
[in] | hrtfs | HRTFs as filterbank coeffs; FLAT: N_bands x NUM_EARS x N_hrtf_dirs |
[in] | itds | The inter-aural time difference (ITD) for each HRIR (set to NULL if you do not want phase simplication to be applied); N_hrtf_dirs x 1 |
[in] | freqVector | Frequency vector (set to NULL if you do not want phase simplication to be applied); N_bands x 1 |
[in] | interp_table | Amplitude-Normalised VBAP gain table; FLAT: N_interp_dirs x N_hrtf_dirs |
[in] | N_hrtf_dirs | Number of HRTF directions |
[in] | N_bands | Number of frequency bands |
[in] | N_interp_dirs | Number of interpolated hrtf positions |
[out] | hrtf_interp | interpolated HRTFs; FLAT: N_bands x NUM_EARS x N_interp_dirs |
Definition at line 241 of file saf_hrir.c.
void resampleHRIRs | ( | float * | hrirs_in, |
int | hrirs_N_dirs, | ||
int | hrirs_in_len, | ||
int | hrirs_in_fs, | ||
int | hrirs_out_fs, | ||
int | padToNextPow2, | ||
float ** | hrirs_out, | ||
int * | hrirs_out_len ) |
Resamples a set of HRIRs from its original samplerate to a new samplerate.
[in] | hrirs_in | Input HRIRs; FLAT: hrirs_N_dirs x NUM_EARS x hrirs_in_len |
[in] | hrirs_N_dirs | Number of HRIRs |
[in] | hrirs_in_len | Length of input HRIRs, in samples |
[in] | hrirs_in_fs | Original sampling rate, in Hz |
[in] | hrirs_out_fs | New sampling rate, in Hz |
[in] | padToNextPow2 | 1: length of output HRIRs padded to next 2^x, 0: no |
[out] | hrirs_out | Resampled HRIRs; FLAT: hrirs_N_dirs x NUM_EARS x hrirs_out_len |
[out] | hrirs_out_len | (&) New HRIR length |
Definition at line 365 of file saf_hrir.c.
|
extern |
The measurement directions used for the default HRIR dataset.
Definition at line 871 of file saf_default_hrirs.c.
|
extern |
The samplerate used to measure the default HRIR filters
Definition at line 1714 of file saf_default_hrirs.c.
|
extern |
The length of the filters, in samples, for the default HRIR dataset.
Definition at line 1712 of file saf_default_hrirs.c.
|
extern |
The default HRIR data for SAF.
Definition at line 32 of file saf_default_hrirs.c.
|
extern |
The number of directions/measurements in the default HRIR dataset.
Definition at line 1710 of file saf_default_hrirs.c.