Spherical harmonics and Ambisonics functions. Please refer to the
Spherical Harmonic Definitions page for background information
on spherical harmonics.
Calculate the spherical harmonic order n and degree m for a linear coefficient index, according to the FuMa (Furse-Malham) Channel Ordering Convention.
Calculate the FuMa channel index for a given spherical harmonic order n and degree m, according to the FuMa (Furse-Malham) Channel Ordering Convention.
Calculate the spherical harmonic order n and degree m for a linear
coefficient index, according to the FuMa (Furse-Malham)
Channel Ordering Convention.
This implementation uses the second order Hankel function, see [5] for an
overview of the corresponding sign conventions.
References
Parameters:
n_max (int) – The spherical harmonic order
kr (ndarray, float) – Wave number * radius
arraytype (str) – Array configuration. Can be omnidirectional microphones mounted on a
'rigid' sphere or on a virtual 'open' sphere, or 'cardioid'
microphones on an open sphere. Default is 'rigid'.
Calculate the FuMa channel index for a given spherical harmonic order n
and degree m, according to the FuMa (Furse-Malham)
Channel Ordering Convention.
Radiation function in SH for a vibrating spherical cap.
Includes the radiation impedance and the propagation to a arbitrary
distance from the sphere.
The sign and phase conventions result in a positive pressure response for
a positive cap velocity with the intensity vector pointing away from the
source [8], [9].
TODO: This function does not have a test yet.
References
Parameters:
n_max (integer) – Maximal spherical harmonic order
rad_sphere (float) – Radius of the sphere
k (ndarray, float) – Wave number
distance (float) – Radial distance from the center of the sphere
density_medium (float) – Density of the medium surrounding the sphere. Default is 1.2.
for air.
speed_of_sound (float) – Speed of sound in m/s. Default is 343.0.
Returns:
R – Radiation function in diagonal matrix form with shape
\([K \times (n_{max}+1)^2~\times~(n_{max}+1)^2]\)
Renormalize spherical harmonics coefficients or basis functions.
Parameters:
data (ndarray) – Data which should be renormalized, either spherical harmonics
coefficients or basis functions.
channel_convention (str) – Channel convention of the data which should be renormalized. Valid
conventions are “ACN” or “FuMa”.
current_norm (str) – Current normalization. Valid normalizations are “N3D”, “NM”,
“maxN”, “SN3D”, or “SNM”.
target_norm (str) – Desired normalization. Valid normalizations are “N3D”, “NM”
“maxN”, “SN3D”, or “SNM”.
axis (integer) – Axis along which the renormalization should be applied. The axis
contains the spherical harmonics coefficients and must hence have
\(Q = (N+1)^2\) channels with \(N\) being the spherical
harmonics order of data.
Calculates the SID indices up to spherical harmonic order n_max.
The SID indices were originally proposed by Daniel [10], more recently
ACN indexing has been favored and is used in the AmbiX format [11].
Parameters:
n_max (int) – The maximum spherical harmonic order
Returns:
sid_n (ndarray, int) – The SID indices for all orders
sid_m (ndarray, int) – The SID indices for all degrees
normalization (str, optional) – Normalization convention, either 'N3D', 'NM', 'maxN',
'SN3D', or 'SNM'.
(maxN is only supported up to 3rd order)
channel_convention (str, optional) – Channel ordering convention, either 'ACN' or 'FuMa'.
The default is 'ACN'.
(FuMa is only supported up to 3rd order)
condon_shortley (bool or str, optional) – Whether to include the Condon-Shortley phase term. If True or
'auto', Condon-Shortley is included, if False it is not
included. The default is 'auto'.
normalization (str, optional) – Normalization convention, either 'N3D', 'NM', 'maxN',
'SN3D', or 'SNM'.
(maxN is only supported up to 3rd order)
channel_convention (str, optional) – Channel ordering convention, either 'acn' or 'fuma'.
The default is 'acn'.
(FuMa is only supported up to 3rd order)
condon_shortley (bool or str, optional) – Whether to include the Condon-Shortley phase term. If True or
'auto', Condon-Shortley is included, if False it is not
included. The default is 'auto'.
Returns:
grad_theta (ndarray, complex) – Gradient with regard to the co-latitude angle.
grad_azimuth (ndarray, complex) – Gradient with regard to the azimuth angle.
normalization (str, optional) – Normalization convention, either 'N3D', 'NM',
'maxN', 'SN3D', or 'SNM'.
(maxN is only supported up to 3rd order)
channel_convention (str, optional) – Channel ordering convention, either 'ACN' or 'FuMa'.
The default is 'ACN'.
(FuMa is only supported up to 3rd order)
condon_shortley (bool or str, optional) – Whether to include the Condon-Shortley phase term. If True,
Condon-Shortley is included, if False or 'auto', it is not
included. The default is 'auto'.
Returns:
grad_theta (ndarray, float) – Gradient with respect to the co-latitude angle.
grad_phi (ndarray, float) – Gradient with respect to the azimuth angle.
normalization (str, optional) – Normalization convention, either 'N3D', 'NM', 'maxN',
'SN3D', or 'SNM'.
(maxN is only supported up to 3rd order)
channel_convention (str, optional) – Channel ordering convention, either 'ACN' or 'FuMa'.
The default is 'ACN'.
(FuMa is only supported up to 3rd order)
condon_shortley (bool or str, optional) – Whether to include the Condon-Shortley phase term. If True,
Condon-Shortley is included, if False or 'auto', it is not
included. The default is 'auto'.