SAF
Loading...
Searching...
No Matches
binauraliser_internal.h File Reference

Convolves input audio (up to 64 channels) with interpolated HRTFs in the time-frequency domain. More...

#include "binauraliser.h"
#include "saf.h"
#include "saf_externals.h"

Go to the source code of this file.

Data Structures

struct  binauraliser_data
 Main structure for binauraliser. More...
 

Macros

#define BINAURALISER_FRAME_SIZE   ( 128 )
 Framesize, in time-domain samples.
 
#define HOP_SIZE   ( 128 )
 STFT hop size.
 
#define HYBRID_BANDS   ( HOP_SIZE + 5 )
 Number of frequency bands.
 
#define TIME_SLOTS   ( BINAURALISER_FRAME_SIZE / HOP_SIZE )
 Number of STFT timeslots.
 

Functions

void binauraliser_setCodecStatus (void *const hBin, CODEC_STATUS newStatus)
 Sets codec status (see CODEC_STATUS enum)
 
void binauraliser_interpHRTFs (void *const hBin, INTERP_MODES mode, float azimuth_deg, float elevation_deg, float_complex h_intrp[HYBRID_BANDS][NUM_EARS])
 Interpolates between (up to) 3 HRTFs via amplitude-normalised VBAP gains.
 
void binauraliser_initHRTFsAndGainTables (void *const hBin)
 Initialise the HRTFs: either loading the default set or loading from a SOFA file; and then generate a VBAP gain table for interpolation.
 
void binauraliser_initTFT (void *const hBin)
 Initialise the filterbank used by binauraliser.
 
void binauraliser_loadPreset (SOURCE_CONFIG_PRESETS preset, float dirs_deg[MAX_NUM_INPUTS][2], int *newNCH, int *nDims)
 Returns the source directions for a specified source config preset.
 

Detailed Description

Convolves input audio (up to 64 channels) with interpolated HRTFs in the time-frequency domain.

The HRTFs are interpolated by applying amplitude-preserving VBAP gains to the HRTF magnitude responses and inter-aural time differences (ITDs) individually, before being re-combined. The example also allows the user to specify an external SOFA file for the convolution, and rotations of the source directions to accomodate head-tracking.

Author
Leo McCormack
Date
25.09.2017
License
ISC

Definition in file binauraliser_internal.h.

Macro Definition Documentation

◆ BINAURALISER_FRAME_SIZE

#define BINAURALISER_FRAME_SIZE   ( 128 )

Framesize, in time-domain samples.

Definition at line 52 of file binauraliser_internal.h.

◆ HOP_SIZE

#define HOP_SIZE   ( 128 )

STFT hop size.

Definition at line 55 of file binauraliser_internal.h.

◆ HYBRID_BANDS

#define HYBRID_BANDS   ( HOP_SIZE + 5 )

Number of frequency bands.

Definition at line 56 of file binauraliser_internal.h.

◆ TIME_SLOTS

#define TIME_SLOTS   ( BINAURALISER_FRAME_SIZE / HOP_SIZE )

Number of STFT timeslots.

Definition at line 57 of file binauraliser_internal.h.

Function Documentation

◆ binauraliser_initHRTFsAndGainTables()

void binauraliser_initHRTFsAndGainTables ( void *const hBin)

Initialise the HRTFs: either loading the default set or loading from a SOFA file; and then generate a VBAP gain table for interpolation.

Note
Call binauraliser_initTFT() (if needed) before calling this function

Definition at line 125 of file binauraliser_internal.c.

◆ binauraliser_initTFT()

void binauraliser_initTFT ( void *const hBin)

Initialise the filterbank used by binauraliser.

Note
Call this function before binauraliser_initHRTFsAndGainTables()

Definition at line 267 of file binauraliser_internal.c.

◆ binauraliser_interpHRTFs()

void binauraliser_interpHRTFs ( void *const hBin,
INTERP_MODES mode,
float azimuth_deg,
float elevation_deg,
float_complex h_intrp[HYBRID_BANDS][NUM_EARS] )

Interpolates between (up to) 3 HRTFs via amplitude-normalised VBAP gains.

The HRTF magnitude responses and HRIR ITDs are interpolated seperately before re-introducing the phase.

Parameters
[in]hBinbinauraliser handle
[in]modesee INTERP_MODES
[in]azimuth_degSource azimuth in DEGREES
[in]elevation_degSource elevation in DEGREES
[out]h_intrpInterpolated HRTF

Definition at line 46 of file binauraliser_internal.c.

◆ binauraliser_loadPreset()

void binauraliser_loadPreset ( SOURCE_CONFIG_PRESETS preset,
float dirs_deg[MAX_NUM_INPUTS][2],
int * newNCH,
int * nDims )

Returns the source directions for a specified source config preset.

The function also returns the number of source in the configuration Note: default uniformly distributed points are used to pad the dirs_deg matrix up to the MAX_NUM_INPUTS, if nCH is less than this. This can help avoid scenarios of many sources being panned in the same direction, or triangulations errors.

Parameters
[in]presetSee SOURCE_CONFIG_PRESETS enum.
[out]dirs_degSource directions, [azimuth elevation] convention, in DEGREES;
[out]newNCH(&) new number of channels
[out]nDims(&) estimate of the number of dimensions (2 or 3)

Definition at line 283 of file binauraliser_internal.c.

◆ binauraliser_setCodecStatus()

void binauraliser_setCodecStatus ( void *const hBin,
CODEC_STATUS newStatus )

Sets codec status (see CODEC_STATUS enum)

Definition at line 35 of file binauraliser_internal.c.