# Binaural Auralization of Room Acoustics with a Highly Scalable Wave-Based Acoustics Simulation
## 2 Theory
### Binaural Auralization Based on Ambisonics and HRTF  
Ambisonics is a sound field reproduction method based on the spherical harmonics expansion of sound fields in which frequency-domain sound pressure is expressed as [29]  
\[p(\mathbf{r},\omega)=4\pi\sum_{l=0}^{\infty}\sum_{m=-l}^{l}\dot{j}_{l}(kr)Y_{l,m}a_ {l,m}. \tag{20}\]In that equation, \(k\) and \(r\) respectively stand for the wave number and radius in a polar coordinate system. In addition, \(j_{l}\) represents the \(l\)-th order spherical Bessel function. The expansion coefficient for spherical harmonics is represented by \(a_{l,m}\). \(Y_{l,m}\) is the real spherical harmonics, denoted as  
\[Y_{l,m}= \begin{cases}N_{l}^{0}P_{l}^{0}(\cos\phi)&(m=0),\\ \sqrt{2}N_{l}^{m}P_{l}^{m}(\cos\phi)\cos m\theta&(0<m),\\ \sqrt{2}N_{l}^{m}P_{l}^{-m}(\cos\phi)\sin m\theta&(m<0),\end{cases}  \tag{21}\]  
with  
\[N_{l}^{m}=\sqrt{\frac{2l+1}{4\pi}\frac{(l-|m|)!}{(l+|m|)!}}, \tag{22}\]  
and \(P_{l}^{m}\) represents the associated Legendre function. In addition, \(\theta\) and \(\phi\) respectively signify the elevation and azimuth in the spherical coordinate system. Equation (20) can be rewritten with an equation of plane wave in Cartesian coordinates as  
\[p(\mathbf{r},\omega)=\sum_{l=0}^{\infty}\sum_{m=-l}^{l}a_{l,m}\int_{0}^{2\pi}\int_ {0}^{\pi}Y_{l,m}e^{\mathrm{i}(kx\gamma_{x}+ky\gamma_{y}+k\tau_{2}\tau_{2})} \sin\theta\mathrm{d}\theta\mathrm{d}\phi, \tag{23}\]  
with  
\[\gamma_{x}=\sin\theta\cos\phi,\ \ \gamma_{y}=\sin\theta\sin\phi,\ \ \gamma_{z}=\cos\theta. \tag{24}\]  
The latter expression is useful to evaluate \(a_{l,m}\) in the Cartesian coordinate system, as explained in Section 2.3. For sound field reproduction by Ambisonics, time-domain expansion coefficients \(A_{l,m}\) up to a desired order must be acquired to produce the Ambisonics signal \(\mathbf{A}\). They are assessed by placement of a virtual microphone array [30] or numerical differentiation of nodal sound pressure on a computational grid or mesh [31] of numerical acoustical models. Ambisonics designates the procedure for evaluating \(A_{l,m}\) encoding. This study uses numerical differentiation for encoding. Once \(\mathbf{A}\), which consists of \(A_{l,m}\), is evaluated, the driving signal vector \(\mathbf{G}\) for the loudspeaker array can be decoded as  
\[\mathbf{G}=\mathbf{dA}, \tag{25}\]  
with the decoding matrix \(\mathbf{d}\). The driving signal vector \(\mathbf{G}\) consists of \(L\) signals with different polar directions against a listener who is placed in the center of the loudspeaker array. It is defined as  
\[\mathbf{G}=[g_{1}(\theta_{1},\phi_{1}),g_{2}(\theta_{2},\phi_{2}),...,g_{L}(\theta _{L},\phi_{L})]^{T}, \tag{26}\]  
where \(g_{i}(\theta_{i},\phi_{i})\) is \(i\)-th loudspeaker's driving signal, which is located in the direction \((\theta_{i},\phi_{i})\). Actually, \(L\) should be larger than \((l+1)^{2}\) for \(l\)-th order Ambisonics decoding. Various methods are available to calculate \(\mathbf{d}\) for both regular and irregular loudspeaker layouts. This study uses mode-matching decoding (pseudo-inverse) method for conversion of FOA signals to the speaker array, designated as the 'Cube'. In the Cube layout, eight speakers are placed at the vertices of the cube. Other methods include Max-rE decoding [15; 16] to improve sound localization at higher frequencies. For Ambisonics decoding and rotation of signals, we used the HOA library [32]. The BRIR vectors \(B_{\text{left}}\) and \(B_{\text{right}}\) were created using a sum of the convolutions of the driving signals and HRIRs as  
\[B_{\text{left}}=\sum_{i=1}^{L}H_{\text{left}}(\theta_{i},\phi_{i})*g_{i}( \theta_{i},\phi_{i}), \tag{27}\]  
\[B_{\text{right}}=\sum_{i=1}^{L}H_{\text{right}}(\theta_{i},\phi_{i})*g_{i}( \theta_{i},\phi_{i}). \tag{28}\]Therein, \(H_{\text{left}}(\theta_{i},\phi_{i})\) and \(H_{\text{right}}(\theta_{i},\phi_{i})\) are HRIRs on left and right ears for the direction \((\theta_{i},\phi_{i})\).