# Interaural Level Difference Optimization of Binaural Ambisonic Rendering
## 2 Methods  
### Binaural Rendering of Ambsonic Signals  
A monophonic sound signal \(S\) can be encoded into Ambsonic format \(\beta\) with Ambsonic order \(M\) for a given location on the sphere of azimuth \(\theta\) (for the region \(-180^{\circ}<\theta\leq 180^{\circ}\)) and elevation \(\phi\) (for the region \(-90^{\circ}\leq\phi\leq 90^{\circ}\)) by  
\[\beta_{k}=SY_{mn}^{\sigma} \tag{2}\]  
where \(k\) is the Ambsonic channel, of which the total number is calculated as \(K=(M+1)^{2}\), and \(Y_{mn}^{\sigma}\) are the three-dimensional full normalized (N3D) SH functions, defined as  
\[Y_{mn}^{\sigma}(\theta,\phi)=\sqrt{\epsilon_{m}(2m+1)\frac{(m-n)!}{4\pi(m+n)! }}P_{mn}(\sin\phi)\times\left\{ \begin{array}{l}\cos(n\theta),\text{if }\sigma=+1\\ \sin(n\theta),\text{if }\sigma=-1\end{array} \right. \tag{3}\]  
where \(\sigma=\pm 1\), \(P_{mn}(\sin\phi)\) are the associated Legendre functions [32] of order \(m\) and degree \(n\) and \(\epsilon_{m}=2-\delta_{n,0}\) where \(\delta_{n,0}=1\) when \(n=0\) and \(\delta_{n,0}=0\) otherwise. To accurately decode three-dimensional Ambsonic signals, a spherical array of loudspeakers distributed with at least semi-regularity is necessary with a number of loudspeakers \(L\geq K\). A re-encoding matrix \(\mathbf{C}\) with \(K\) rows and \(L\) columns is calculated by encoding the position of each loudspeaker into SH coefficients using (3). A mode matching decoding matrix \(\mathbf{D}\) is then calculated from the pseudo-inverse of \(\mathbf{C}\)[14] such that  
\[\mathbf{D}=\mathbf{C}^{T}(\mathbf{C}\mathbf{C}^{T})-1 \tag{4}\]  
where transposition is notated by a superscript \({}^{T}\). Decode matrices also follow with \(K\) rows and \(L\) columns. Dual-band decoding is used in this study, which has been shown to produce perceptually optimal localization [33]. Pseudo-inverse mode matching decoding with basic channel weighting is used for frequencies up to \(f_{alias}\), calculated using (1). Above \(f_{alias}\), where the sound field is inadequately reconstructed, pseudo-inverse decoding with Max \(\mathbf{r_{E}}\) channel weighting is used, which aims to reproduce the magnitude of the energy vector as close to 1 as possible for all directions [14,34]. The low frequency decode matrix \(\mathbf{D}^{basic}\) is generated as in (4), and the high-frequency matrix with Max \(\mathbf{r_{E}}\) channel weightings \(\mathbf{D}^{Max\ r_{E}}\) is calculated from \(\mathbf{D}^{basic}\) by  
\[\mathbf{D}_{m}^{Max\ r_{E}}=\mathbf{D}_{m}^{basic}g_{m} \tag{5}\]  
where \(g_{m}\) are the SH channel weightings calculated from differentiation of the energy vector \(r_{E}\) with respect to \(g_{m}\) ([35], p. 132), such to maximize the magnitude of \(r_{E}\). In practice, Max \(\mathbf{r_{E}}\) weighting reduces the amplitude of higher-order components, which changes the shape of the virtual polar patterns produced by the loudspeaker components, reducing out of phase sounds. The HRIRs for each loudspeaker are encoded into the SH domain by multiplication of the decoding matrix \(\mathbf{D}\) gain coefficients with the HRIRs for each loudspeaker, followed by summation of the resulting SH channels for each loudspeaker:  
\[\mathbf{D}^{SH}=\sum_{l=1}^{L}H_{l}\mathbf{D}_{l} \tag{6}\]  
to produce virtual loudspeaker binaural decoders (repeated for both left and right signals of the HRIRs and both basic and Max \(\mathbf{r_{E}}\) decoding matrices). Finally, the basic and Max \(\mathbf{r_{E}}\) decoders are combined through a linear-phase crossover network at a cutoff frequency \(f_{c}=f_{alias}\), with Chebyshev windowing [36] and a filter order of 128 to produce the dual-band decoder \(\mathbf{D}^{SH}\). Binaural Ambsonic rendering \(B\) is achieved through a summation of each SH channel of the encode \(\beta_{K}\) convolved with each SH channel of the decoder \(\mathbf{D}_{K}^{SH}\):  
\[B=\sum_{k=1}^{K}\beta_{k}*\mathbf{D}_{k}^{SH} \tag{7}\]  
where \(*\) denotes convolution (repeated for both left and right signals of the decoder).