HoaLibrary  2.0
High Order Ambisonics Library
 All Classes Namespaces Functions Enumerations Enumerator
Functions
Hoa Namespace Reference

The high order ambisonic namespace. More...

Functions

double min (const double v1, const double v2)
 The minimum function. More...
 
double max (const double v1, const double v2)
 The maximum function. More...
 
double clip_minmax (const double value, const double min, const double max)
 The clipping function. More...
 
double clip_min (const double value, const double low)
 The minimum clipping function. More...
 
double clip_max (const double value, const double high)
 The maximum clipping function. More...
 
long double factorial (long n)
 The factorial. More...
 
unsigned long double_factorial (long n)
 The double factorial. More...
 
double associated_legendre (int l, int m, const double x)
 The associated Legendre polynomials. More...
 
double legendre_normalization (const int l, const int m)
 The legendre normalization. More...
 
double spherical_harmonics_azimuth (const int l, const int m, const double phi)
 The azimuth part of the spherical harmonics function. More...
 
double spherical_harmonics_elevation (const int l, const int m, const double theta)
 The elevation part of the spherical harmonics function. More...
 
double spherical_harmonics (const int l, const int m, const double phi, const double theta)
 The spherical harmonics function. More...
 
double wrap (double value, const double low, const double high)
 The wrapping function. More...
 
double wrap_twopi (const double value)
 The wrapping function over \(2\pi\). More...
 
double wrap_360 (const double value)
 The wrapping function in degrees. More...
 
double ordinate (const double radius, const double azimuth)
 The ordinate converter function. More...
 
double abscissa (const double radius, const double azimuth)
 The abscissa converter function. More...
 
double radius (const double x, const double y)
 The radius converter function. More...
 
double azimuth (const double x, const double y)
 The azimuth converter function. More...
 
std::string int_to_string (int aValue)
 The int to string conversion. More...
 

Detailed Description

The high order ambisonic namespace.

This namespace have all the standard methods and functions necessary for ambisonic processing.

Function Documentation

double Hoa::abscissa ( const double  radius,
const double  azimuth 
)
inline

The abscissa converter function.

This function takes a radius and an azimuth value and convert them to an abscissa value.

Parameters
radiusThe radius value (greather than 0).
azimuthThe azimuth value (between \(0\) and \(2\pi\)).
Returns
The abscissa value.
See Also
ordinate

Definition at line 379 of file HoaMath.h.

double Hoa::associated_legendre ( int  l,
int  m,
const double  x 
)
inline

The associated Legendre polynomials.

The function computes the associated Legendre polynomial \form#2 that is a part of the formula that compute the spherical harmonic coefficient where l is the band and the m is the argument of a spherical harmonic and x is the cosinus of the elevation. It uses three recurrence formulas :

\[P(l, l)(x) = (-1)^l \times (2l - 1)!! \times (1 - x^2)^{0.5l}\]

\[P(l + 1, l)(x) = x \times (2l + 1) \times P(l, l)\]

\[P(l + 1, m)(x) = \frac{(2l + 1) \times x \times P(m, l) - (l + m) \times P(m, l - 1)}{(l - m + 1)}\]

with \(0 \leq l\) and \(-l \leq m \leq +l\)

Parameters
lThe band of the spherical harmonic.
mThe argument of the spherical harmonic.
xThe cosinus of the elevation.
Returns
The function return the associated Legendre polynomial of x for l and m.
See Also
legendre_normalization
spherical_harmonics

Definition at line 169 of file HoaMath.h.

double Hoa::azimuth ( const double  x,
const double  y 
)
inline

The azimuth converter function.

This function takes an abscissa and an ordinate value and convert them to an azimuth value.

Parameters
xThe abscissa value.
yThe ordinate value.
Returns
The azimuth value.
See Also
radius

Definition at line 407 of file HoaMath.h.

double Hoa::clip_max ( const double  value,
const double  high 
)
inline

The maximum clipping function.

The function clips a number at a maximum value.
If \(x > max\), \(f(x) = max\) else \(f(x) = x\).

Parameters
valueThe value to clip.
highThe high boundary.
Returns
The function return the clipped value.
See Also
clip_minmax
clip_min

Definition at line 102 of file HoaMath.h.

double Hoa::clip_min ( const double  value,
const double  low 
)
inline

The minimum clipping function.

The function clips a number at a minimum value.
If \(x < min\), \(f(x) = min\) else \(f(x) = x\).

Parameters
valueThe value to clip.
lowThe low boundary.
Returns
The function return the clipped value.
See Also
clip_minmax
clip_max

Definition at line 83 of file HoaMath.h.

double Hoa::clip_minmax ( const double  value,
const double  min,
const double  max 
)
inline

The clipping function.

The function clips a number between boundaries.
If \(x < min\), \(f(x) = min\) else if \(x > max\), \(f(x) = max\) else \(f(x) = x\).

Parameters
valueThe value to clip.
minThe low boundary.
maxThe high boundary.
Returns
The function return the clipped value.
See Also
clip_min
clip_max

Definition at line 62 of file HoaMath.h.

unsigned long Hoa::double_factorial ( long  n)
inline

The double factorial.

The function computes the double factorial, the product of all the odd integers up to some odd positive integer :\n

\[n!! = n \times (n - 2) \times (n - 4) \times {...} \]

Parameters
nThe interger.
Returns
The function return the double factorial of n.
See Also
factorial

Definition at line 140 of file HoaMath.h.

long double Hoa::factorial ( long  n)
inline

The factorial.

The function computes the factorial, the product of all positive integers less than or equal to an integer.

\[n! = n \times (n - 1) \times (n - 2) \times {...} \]

Parameters
nThe interger.
Returns
The function return the factorial of n.
See Also
double_factorial

Definition at line 119 of file HoaMath.h.

std::string Hoa::int_to_string ( int  aValue)
inline

The int to string conversion.

The function converts a interger to a string.

Parameters
valueThe value to convert.
Returns
The function return value in a string format.

Definition at line 18 of file HoaUtils.h.

double Hoa::legendre_normalization ( const int  l,
const int  m 
)
inline

The legendre normalization.

The function normalizes the associated Legendre polynomial over \form#8 : \n

if \( m = 0\)

\[K(l) = \sqrt{\frac{2 \times l + 1}{4\pi}}\]

else

\[K(l, m) = \sqrt{2 \times \frac{2 \times l + 1}{4\pi} \times \frac{(l - |m|)!}{(l + |m|)!}}\]

with \(0 \leq l\) and \(-l \leq m \leq +l\)

Parameters
lThe band of the spherical harmonic.
mThe argument of the spherical harmonic.
Returns
The function return the normalization of the associated Legendre polynomial for l and m.
See Also
associated_legendre
spherical_harmonics

Definition at line 203 of file HoaMath.h.

double Hoa::max ( const double  v1,
const double  v2 
)
inline

The maximum function.

This function returns the maximum value between two values

Parameters
v1The first value.
v2The low boundary.
Returns
The maximum value.
See Also
min

Definition at line 42 of file HoaMath.h.

double Hoa::min ( const double  v1,
const double  v2 
)
inline

The minimum function.

This function returns the minimum value between two values

Parameters
v1The first value.
v2The low boundary.
Returns
The maximum value.
See Also
min

Definition at line 25 of file HoaMath.h.

double Hoa::ordinate ( const double  radius,
const double  azimuth 
)
inline

The ordinate converter function.

This function takes a radius and an azimuth value and convert them to an ordinate value.

Parameters
radiusThe radius value (greather than 0).
azimuthThe azimuth value (between \(0\) and \(2\pi\)).
Returns
The ordinate value.
See Also
abscissa

Definition at line 365 of file HoaMath.h.

double Hoa::radius ( const double  x,
const double  y 
)
inline

The radius converter function.

This function takes an abscissa and an ordinate value and convert them to a radius value.

Parameters
xThe abscissa value.
yThe ordinate value.
Returns
The radius value.
See Also
azimuth

Definition at line 393 of file HoaMath.h.

double Hoa::spherical_harmonics ( const int  l,
const int  m,
const double  phi,
const double  theta 
)
inline

The spherical harmonics function.

The function computes the spherical harmonics coefficient for the angles \(\phi\) and \(\theta\) in radian.

\[Y(l, m, \phi, \theta) = Y_{azimuth}(l, m, \phi) \times Y_{elevation}(l, m, \theta)\]

Parameters
lThe band of the spherical harmonic.
mThe argument of the spherical harmonic.
phiThe azimuth.
thetaThe elevation.
Returns
The function return the coefficient for phi and theta for the spherical harmonics of band l and argument m.
See Also
spherical_harmonics_azimuth
spherical_harmonics_elevation

Definition at line 283 of file HoaMath.h.

double Hoa::spherical_harmonics_azimuth ( const int  l,
const int  m,
const double  phi 
)
inline

The azimuth part of the spherical harmonics function.

The function computes the azimuth coefficient of the spherical harmonic \form#12 for an angle \form#13 in radian :\n

if \( m \geq 0\)

\[Y_{azimuth}(l, m, \phi) = cos(m \times \phi)\]

else

\[Y_{azimuth}(l, m, \phi) = sin(-m \times \phi)\]

with \(0 \leq l\) and \(-l \leq m \leq +l\)

Parameters
lThe band of the spherical harmonic.
mThe argument of the spherical harmonic.
phiThe azimuth.
Returns
The function return the azimuth coefficient for phi of the spherical harmonic of band l and argument m.
See Also
spherical_harmonics_elevation
spherical_harmonics

Definition at line 242 of file HoaMath.h.

double Hoa::spherical_harmonics_elevation ( const int  l,
const int  m,
const double  theta 
)
inline

The elevation part of the spherical harmonics function.

The function computes the elevation coefficient of the the spherical harmonic \form#12  for an angle \form#17 in radian. It uses the associated Legendre polynomial and applies the Legendre normalization :

\[Y_{elevation}(l, m, \theta) = N(l, m) \times P(l, m, cos(/theta)\]

with \(0 \leq l\), \(-l \leq m \leq +l\) and \(N\) the normalization and \(P\) the associated Legendre polynomial.

Parameters
lThe band of the spherical harmonic.
mThe argument of the spherical harmonic.
thetaThe elevation.
Returns
The function return the elevation coefficient for theta of the spherical harmonic of band l and argument m.
See Also
legendre_normalization
associated_legendre
spherical_harmonics_azimuth
spherical_harmonics

Definition at line 265 of file HoaMath.h.

double Hoa::wrap ( double  value,
const double  low,
const double  high 
)
inline

The wrapping function.

The function wraps a number between boundarys.

Parameters
valueThe value to wrap.
lowThe low boundary.
highThe high boundary.
Returns
The function return the wrapped value.
See Also
wrap_twopi

Definition at line 298 of file HoaMath.h.

double Hoa::wrap_360 ( const double  value)
inline

The wrapping function in degrees.

The function wraps a number between \(0\) and \(360°\).

Parameters
valueThe value to wrap.
Returns
The wrapped value.
See Also
wrap, wrap_twopi

Definition at line 345 of file HoaMath.h.

double Hoa::wrap_twopi ( const double  value)
inline

The wrapping function over \(2\pi\).

The function wraps a number between \(0\) and \(2\pi\).

Parameters
valueThe value to wrap.
Returns
The function return the wrapped value.
See Also
wrap, wrap_360

Definition at line 322 of file HoaMath.h.