SAF
Loading...
Searching...
No Matches
saf_utility_dvf.c File Reference

Distance variation function filter coefficient data [1]. More...

Go to the source code of this file.

Functions

static float interpolate_lin (float a, float b, float ifac)
 Linear interpolation between two values.
 
static float db2mag (float dB)
 Covert decibels to a magnitude.
 
void calcDVFShelfParams (int i, float rhoIn, float *g0, float *gInf, float *fc)
 Calculate the high shelf gains and cutoff parameters, given a azimuth index i and distance rho.
 
void interpDVFShelfParams (float theta, float rho, float *iG0, float *iGInf, float *iFc)
 Calculate the shelving filter parameters for the Distance Variation Function filter from the source (ipsilateral) azimuth and distance.
 
void dvfShelfCoeffs (float g0, float gInf, float fc, float fs, float *b0, float *b1, float *a1)
 Calculate the DVF filter coefficients from shelving filter parameters.
 
void calcDVFCoeffs (float alpha, float rho, float fs, float *b, float *a)
 Calculate the Distance Variation Function (DVF) filter coefficients, as described in [1].
 
void doaToIpsiInteraural (float azimuth, float elevation, float *alphaLR, float *betaLR)
 Convert a frontal azimuth/elevation to a modified Interaural-Polar coordinate.
 

Variables

static const double p11 [19] = { 12.97, 13.19, 12.13, 11.19, 9.91, 8.328, 6.493, 4.455, 2.274, 0.018, -2.24, -4.43, -6.49, -8.34, -9.93, -11.3, -12.2, -12.8, -13.0 }
 Table 1: Coefficients for Eqs.
 
static const double p21 [19] = { -9.69, 234.2, -11.2, -9.03, -7.87, -7.42, -7.31, -7.28, -7.29, -7.48, -8.04, -9.23, -11.6, -17.4, -48.4, 9.149, 1.905, -0.75, -1.32 }
 
static const double q11 [19] = { -1.14, 18.48, -1.25, -1.02, -0.83, -0.67, -0.5, -0.32, -0.11, -0.13, 0.395, 0.699, 1.084, 1.757, 4.764, -0.64, 0.109, 0.386, 0.45 }
 
static const double q21 [19] = { 0.219, -8.5, 0.346, 0.336, 0.379, 0.421, 0.423, 0.382, 0.314, 0.24, 0.177, 0.132, 0.113, 0.142, 0.462, -0.14, -0.08, -0.06, -0.05 }
 
static const double p12 [19] = { -4.39, -4.31, -4.18, -4.01, -3.87, -4.1, -3.87, -5.02, -6.72, -8.69, -11.2, -12.1, -11.1, -11.1, -9.72, -8.42, -7.44, -6.78, -6.58 }
 
static const double p22 [19] = { 2.123, -2.78, 4.224, 3.039, -0.57, -34.7, 3.271, 0.023, -8.96, -58.4, 11.47, 8.716, 21.8, 1.91, -0.04, -0.66, 0.395, 2.662, 3.387 }
 
static const double q12 [19] = { -0.55, 0.59, -1.01, -0.56, 0.665, 11.39, -1.57, -0.87, 0.37, 5.446, -1.13, -0.63, -2.01, 0.15, 0.243, 0.147, -0.18, -0.67, -0.84 }
 
static const double q22 [19] = { -0.06, -0.17, -0.02, -0.32, -1.13, -8.3, 0.637, 0.325, -0.08, -1.19, 0.103, -0.12, 0.098, -0.4, -0.41, -0.34, -0.18, 0.05, 0.131 }
 
static const double p13 [19] = { 0.457, 0.455, -0.87, 0.465, 0.494, 0.549, 0.663, 0.691, 3.507, -27.4, 6.371, 7.032, 7.092, 7.463, 7.453, 8.101, 8.702, 8.925, 9.317 }
 
static const double p23 [19] = { -0.67, 0.142, 3404., -0.91, -0.67, -1.21, -1.76, 4.655, 55.09, 10336., 1.735, 40.88, 23.86, 102.8, -6.14, -18.1, -9.05, -9.03, -6.89 }
 
static const double p33 [19] = { 0.174, -0.11, -1699., 0.437, 0.658, 2.02, 6.815, 0.614, 589.3, 16818., -9.39, -44.1, -23.6, -92.3, -1.81, 10.54, 0.532, 0.285, -2.08 }
 
static const double q13 [19] = { -1.75, -0.01, 7354., -2.18, -1.2, -1.59, -1.23, -0.89, 29.23, 1945., -0.06, 5.635, 3.308, 13.88, -0.88, -2.23, -0.96, -0.9, -0.57 }
 
static const double q23 [19] = { 0.699, -0.35, -5350., 1.188, 0.256, 0.816, 1.166, 0.76, 59.51, 1707., -1.12, -6.18, -3.39, -12.7, -0.19, 1.295, -0.02, -0.08, -0.4 }
 
static const int numAz_table = sizeof(q23) / sizeof(q23[0])
 
static const float headDim = SAF_PI * (0.0875f / 0.09096f)
 
static const float sosDiv2PiA = 343.0f / (2.0f * SAF_PI * 0.09096f)
 

Detailed Description

Distance variation function filter coefficient data [1].

See also
[1] S. Spagnol, E. Tavazzi, and F. Avanzini, “Distance rendering and perception of nearby virtual sound sources with a near-field filter model,” Applied Acoustics, vol. 115, pp. 61–73, Jan. 2017, doi: 10.1016/j.apacoust.2016.08.015.
Author
Michael McCrea
Date
20.02.2021
License
ISC

Definition in file saf_utility_dvf.c.

Function Documentation

◆ db2mag()

static float db2mag ( float dB)
static

Covert decibels to a magnitude.

Definition at line 70 of file saf_utility_dvf.c.

◆ interpolate_lin()

static float interpolate_lin ( float a,
float b,
float ifac )
static

Linear interpolation between two values.

Definition at line 59 of file saf_utility_dvf.c.

Variable Documentation

◆ headDim

const float headDim = SAF_PI * (0.0875f / 0.09096f)
static

Definition at line 55 of file saf_utility_dvf.c.

◆ numAz_table

const int numAz_table = sizeof(q23) / sizeof(q23[0])
static

Definition at line 51 of file saf_utility_dvf.c.

◆ p11

const double p11[19] = { 12.97, 13.19, 12.13, 11.19, 9.91, 8.328, 6.493, 4.455, 2.274, 0.018, -2.24, -4.43, -6.49, -8.34, -9.93, -11.3, -12.2, -12.8, -13.0 }
static

Table 1: Coefficients for Eqs.

(8), (13), and (14) for generating high-shelf coefficients

Definition at line 38 of file saf_utility_dvf.c.

◆ p12

const double p12[19] = { -4.39, -4.31, -4.18, -4.01, -3.87, -4.1, -3.87, -5.02, -6.72, -8.69, -11.2, -12.1, -11.1, -11.1, -9.72, -8.42, -7.44, -6.78, -6.58 }
static

Definition at line 42 of file saf_utility_dvf.c.

◆ p13

const double p13[19] = { 0.457, 0.455, -0.87, 0.465, 0.494, 0.549, 0.663, 0.691, 3.507, -27.4, 6.371, 7.032, 7.092, 7.463, 7.453, 8.101, 8.702, 8.925, 9.317 }
static

Definition at line 46 of file saf_utility_dvf.c.

◆ p21

const double p21[19] = { -9.69, 234.2, -11.2, -9.03, -7.87, -7.42, -7.31, -7.28, -7.29, -7.48, -8.04, -9.23, -11.6, -17.4, -48.4, 9.149, 1.905, -0.75, -1.32 }
static

Definition at line 39 of file saf_utility_dvf.c.

◆ p22

const double p22[19] = { 2.123, -2.78, 4.224, 3.039, -0.57, -34.7, 3.271, 0.023, -8.96, -58.4, 11.47, 8.716, 21.8, 1.91, -0.04, -0.66, 0.395, 2.662, 3.387 }
static

Definition at line 43 of file saf_utility_dvf.c.

◆ p23

const double p23[19] = { -0.67, 0.142, 3404., -0.91, -0.67, -1.21, -1.76, 4.655, 55.09, 10336., 1.735, 40.88, 23.86, 102.8, -6.14, -18.1, -9.05, -9.03, -6.89 }
static

Definition at line 47 of file saf_utility_dvf.c.

◆ p33

const double p33[19] = { 0.174, -0.11, -1699., 0.437, 0.658, 2.02, 6.815, 0.614, 589.3, 16818., -9.39, -44.1, -23.6, -92.3, -1.81, 10.54, 0.532, 0.285, -2.08 }
static

Definition at line 48 of file saf_utility_dvf.c.

◆ q11

const double q11[19] = { -1.14, 18.48, -1.25, -1.02, -0.83, -0.67, -0.5, -0.32, -0.11, -0.13, 0.395, 0.699, 1.084, 1.757, 4.764, -0.64, 0.109, 0.386, 0.45 }
static

Definition at line 40 of file saf_utility_dvf.c.

◆ q12

const double q12[19] = { -0.55, 0.59, -1.01, -0.56, 0.665, 11.39, -1.57, -0.87, 0.37, 5.446, -1.13, -0.63, -2.01, 0.15, 0.243, 0.147, -0.18, -0.67, -0.84 }
static

Definition at line 44 of file saf_utility_dvf.c.

◆ q13

const double q13[19] = { -1.75, -0.01, 7354., -2.18, -1.2, -1.59, -1.23, -0.89, 29.23, 1945., -0.06, 5.635, 3.308, 13.88, -0.88, -2.23, -0.96, -0.9, -0.57 }
static

Definition at line 49 of file saf_utility_dvf.c.

◆ q21

const double q21[19] = { 0.219, -8.5, 0.346, 0.336, 0.379, 0.421, 0.423, 0.382, 0.314, 0.24, 0.177, 0.132, 0.113, 0.142, 0.462, -0.14, -0.08, -0.06, -0.05 }
static

Definition at line 41 of file saf_utility_dvf.c.

◆ q22

const double q22[19] = { -0.06, -0.17, -0.02, -0.32, -1.13, -8.3, 0.637, 0.325, -0.08, -1.19, 0.103, -0.12, 0.098, -0.4, -0.41, -0.34, -0.18, 0.05, 0.131 }
static

Definition at line 45 of file saf_utility_dvf.c.

◆ q23

const double q23[19] = { 0.699, -0.35, -5350., 1.188, 0.256, 0.816, 1.166, 0.76, 59.51, 1707., -1.12, -6.18, -3.39, -12.7, -0.19, 1.295, -0.02, -0.08, -0.4 }
static

Definition at line 50 of file saf_utility_dvf.c.

◆ sosDiv2PiA

const float sosDiv2PiA = 343.0f / (2.0f * SAF_PI * 0.09096f)
static

Definition at line 56 of file saf_utility_dvf.c.