# A Review on Head-Related Transfer Function Generation for Spatial Audio
## 6 Interpolation
### Nearest Neighbour Interpolation
\begin{bmatrix}l_{11}&l_{12}&l_{ 13}\\ l_{21}&l_{22}&l_{23}\\ l_{31}&l_{32}&l_{33}\end{bmatrix} ^{-1} \begin{bmatrix}p_{1}\\ p_{2}\\ p_{3}\end{bmatrix} , \tag{24}\]  
where \(\mathbf{L}\) is the matrix containing the direction of the three measured points in the Cartesian coordinates, and \(\mathbf{p}\) is the vector that describes the position of the virtual sound source, i.e., the interpolated point. In 1999, [PERSON] et al. (2019) applied inverse-distance weighting (IDW) for HRTF interpolation. IDW is a spatial interpolation that can consider different numbers of measured HRTFs \(N\) according to the number of nearby points. This method is also applied by [PERSON] et al. in (2016), and the equation for the weights computation is as follows:  
\[w_{i}=\frac{d_{i}^{-q}}{\sum_{i=1}^{N}d_{i}^{-q}}, \tag{25}\]  
where \(d_{i}=\cos^{-1}[\sin\theta_{i}\sin\theta+\cos\theta_{i}\cos\theta\cos(\phi_{i }-\phi)]\) is the distance of the \(i\)th point \((\theta_{i},\phi_{i})\), and \(q\) is the distance-decay parameter. In (2019), \(N=4\) and \(q=1\) are imposed, while in (2016), \(N=2\) and different values of \(q\) are considered. All the methods described above can be implemented in both the time and frequency domains by applying the procedures depicted in Figure 7. When the interpolation is performed in the time domain, the impulse responses must be aligned to guarantee the effectiveness of the interpolation as shown in the scheme of Figure 7a. This requirement is assured when minimum-phase (MP) impulse responses are employed (183). Figure 8 compares the HRTF interpolated with the described methods and the measured HRTF, when non-minimum-phase responses are involved. The IDW is applied by imposing \(N=8\) and \(q=0.5\). In this case, bilinear interpolation better fits the measured frequency response. Figure 9 shows the results obtained with minimum-phase responses. The great improvement in all the algorithms that can correctly represent the measured HRTF is evident. The SD values obtained using Equation (2) and the methods in Figures 8 and 9 are calculated in the range [20 Hz; 30 kHz]; these are shown in Table 4. As verified by the frequency response plots, bilinear interpolation gives the best SD values; however, in general, the SD decreases when minimum-phase responses are involved. Figure 6: Setup of (**a**) the bilinear interpolation of (183) and (**b**) the triangular interpolation of (25). When information related to HRIR delays or phases is important, such as when different distances are considered, HRIRs cannot be considered minimum phase. This also occurs when the measurements are performed in real rooms, so the effect of the room response is included in the HRIR, resulting in what is called binaural room responses (BRIRs) [33]. In these cases, every interpolation technique applied in the time domain \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \multicolumn{2}{c}{**Non-Minimum-Phase**} & \multicolumn{2}{c}{**Minimum-Phase**} \\ \hline  & **Left** & **Right** & **Left** & **Right** \\ \hline Linear & 6.6 dB & 9.2 dB & **1.5 dB** & **1.4 dB** \\ \hline Bilinear & **1.5 dB** & **1.4 dB** & **1.5 dB** & **1.4 dB** \\ \hline VBAP & 5.1 dB & 7.7 dB & 3.4 dB & 3.0 dB \\ \hline IDW & 9.2 dB & 9.1 dB & 2.3 dB & 2.2 dB \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Comparison of the SD values obtained with the methods of Figure 8, for non-minimum-phase responses and Figure 9, for minimum-phase ones. The lowest values are highlighted in bold text. Figure 8: Comparison of HRTF interpolation methods with non-minimum-phase HRTF, considering (**a**) the left ear and the (**b**) right ear for the position \((\theta=45^{\circ},\phi=10^{\circ})\) using the MIT-KEMAR database of [41]. Figure 7: Scheme of the nearest neighbour interpolation method applied (**a**) in the time and (**b**) frequency domains.