# Adaptive Binaural Cue-Based Amplitude Panning in Irregular Loudspeaker Configurations
## 2 Methods
### Gain and Time Delay Optimization Stage  
Following the equalization of the magnitude frequency responses of the left and right loudspeakers using the inverse filter, the gain and delay need to be determined to create the virtual sound source. Given gains \(g_{L}\) and \(g_{\mathrm{R}}\) applied to the left and right loudspeakers, respectively, the resulting sound pressures at the listener's left and right ears, denoted as \(p_{\mathrm{L}}(t)\) and \(p_{\mathrm{R}}(t)\), are calculated using the measured BRIRs as  
\[p_{\mathrm{L}}(t)=g_{L}\cdot c_{L}*\mathrm{BRIR}_{\mathrm{LL}}(t-\Delta t)*s(t )+g_{\mathrm{R}}\cdot c_{\mathrm{R}}*\mathrm{BRIR}_{\mathrm{LR}}(t)*s(t) \tag{5}\]  
and  
\[p_{\mathrm{R}}(t)=g_{L}\cdot c_{L}*\mathrm{BRIR}_{\mathrm{RL}}(t-\Delta t)*s(t )+g_{\mathrm{R}}\cdot c_{\mathrm{R}}*\mathrm{BRIR}_{\mathrm{RR}}(t)*s(t), \tag{6}\]  
where \(*\) is defined as the convolution operation symbol. \(c_{L}\) and \(c_{\mathrm{R}}\) are the inverse filters for the left and right loudspeakers, respectively. The terms \(\mathrm{BRIR}_{\mathrm{LL}}\), \(\mathrm{BRIR}_{\mathrm{LR}}\), \(\mathrm{BRIR}_{\mathrm{RL}}\), and \(\mathrm{BRIR}_{\mathrm{RR}}\) represent the BRIR from each loudspeaker to each ear. The first subscript indicates the ear (L for left ear, R for right ear), and the second subscript indicates the loudspeaker(L for left loudspeaker, R for right loudspeaker). Additionally, \(\Delta t\) represents the time delay of the left loudspeaker. The ITD and the IACC are calculated as  
\[\text{ITD}=\underset{|\tau|\leq 1\text{ ms}}{\text{argmax}}\bigg{(}\int_{t_{1}}^{t_{2}}p_{ \text{L}}(t)p_{\text{R}}(t+\tau)\text{d}t\bigg{)} \tag{7}\]  
and  
\[\text{IACC}=\underset{|\tau|\leq 1\text{ ms}}{\text{max}}\left(\frac{\int_{t_{1}}^{t_{ 2}}p_{\text{L}}(t)p_{\text{R}}(t+\tau)\text{d}t}{\sqrt{\int_{t_{1}}^{t_{2}} \left(p_{\text{L}}^{2}(t)\text{d}t\int_{t_{1}}^{t_{2}}p_{\text{R}}^{2}(t) \text{d}t\right)}}\right), \tag{8}\]  
where integration limits \(t_{1}\) and \(t_{2}\) are the start and end moments of the signal. Prior to calculating the ITD and IACC, the sound pressure signals from both ears are subjected to low-pass filtering with a cutoff frequency of 1500 Hz. The ITD refers to the time difference between the arrival of a sound at each ear, serving as a key cue for sound localization. Low-frequency ITD cues, particularly those from content below 1500 Hz, are robust and dominate the directional cues at higher frequencies [23]. With a fixed time delay, the ITD depends solely on the gains of the left and right loudspeakers. By adjusting the gains, the ITD of the left and right ear signals can be aligned with the target ITD of the real sound source at the desired azimuth angle \(\alpha\), expressed as  
\[g_{\text{L}}^{\text{opt}}(\alpha,\Delta t)=\underset{0\leq\beta_{\text{L}} \leq 1}{\text{argmin}}|\text{ITD}-\text{ITD}_{\text{Tar}}(\alpha)|. \tag{9}\]  
To maintain a constant sound pressure level (SPL) across different angles, the gains of the left and right loudspeakers satisfy the constraint  
\[\left(g_{\text{L}}^{\text{opt}}(\alpha,\Delta t)\right)^{2}+\left(g_{\text{R }}^{\text{opt}}(\alpha,\Delta t)\right)^{2}=1. \tag{10}\]  
In the experiment, multiple combinations of gains and time delays may minimize the ITD error. To determine the optimal gains and time delay, we propose maximizing the mean IACCs of \(N\) target azimuths as the selection criterion:  
\[\Delta t^{\text{opt}}=\underset{\Delta t}{\text{argmax}}\frac{1}{N}\underset {\alpha}{\text{IACC}^{\text{opt}}}(\alpha), \tag{11}\]  
where IACC\({}^{\text{opt}}(\alpha)\) corresponds to the virtual sound source formed by the gains \(g_{\text{L}}^{\text{opt}}(\alpha,\Delta t)\) and \(g_{\text{R}}^{\text{opt}}(\alpha,\Delta t)\). The IACC was chosen as the criterion due to its strong, monotonic relationship with listener sensitivity to ITD, which increases as the IACC value rises [33]. Although Equations (9) and (11) cannot be solved directly, the optimal gains and time delay can be determined through parameter scanning within a defined value range.