**2. SPCA of HRTFs/HRIRs**

## **2.1 Outline**

The SPCA of HRTFs/HRIRs is outlined in this section. It is a matter of course that the SPCA of HRTFs/HRIRs is based on the PCA.

1.Spatial average of a certain set of *M* vectors **g***<sup>m</sup>* ð Þ *m* ¼ 1, ⋯, *M* is calculated as follows:

$$\mathbf{g}\_{\text{av}} = \frac{1}{M} \sum\_{m=1}^{M} \mathbf{g}\_{m} \,. \tag{4}$$

2.Covariance matrix, denoted as **R**, is obtained by calculating the following equation:

$$\mathbf{R} = \frac{1}{M} \sum\_{m=1}^{M} (\mathbf{g}\_m - \mathbf{g}\_{\text{av}}) \cdot (\mathbf{g}\_m - \mathbf{g}\_{\text{av}})^H. \tag{5}$$

It is noted that <sup>H</sup> indicates the Hermitian transpose. The size of the matrix **R** is *N* � *N*, where *N* indicates the size of the vector **g***m*.

3.The computed matrix **R** is decomposed into *N* pairs of PCs (eigenvectors) and eigenvalues by solving the following eigenvalue problem:

$$\mathbf{R} \cdot \mathbf{q}\_k = \lambda\_k \cdot \mathbf{q}\_k. \tag{6}$$

As a result, a set of the eigenvalues and principal components (PCs), *λ<sup>k</sup>* and **q***<sup>k</sup>* ð Þ *k* ¼ 1, ⋯, *N* , is obtained. Note that *λ<sup>k</sup>* are sorted from their largest to smallest, *i. e.*, *λ*<sup>1</sup> ≥ *λ*<sup>2</sup> ≥ *λ*<sup>3</sup> ≥⋯≥ *λN*, and the PCs are also arranged to the corresponding eigenvalues.

4.By using the matrix **Q** with **q***<sup>k</sup>* in its column vector, the weighting vector, **w***m*, corresponding to the *m*-th vector **g***<sup>m</sup>* is calculated as follows:

*Spatial Principal Component Analysis of Head-Related Transfer Functions and Its Domain… DOI: http://dx.doi.org/10.5772/intechopen.104449*

$$\mathbf{w}\_m = \mathbf{Q}^H (\mathbf{g}\_m - \mathbf{g}\_{\text{av}}) . \tag{7}$$

As a result of the SPCA, the weight **w***<sup>m</sup>* is approximated by using **q**<sup>1</sup> � **q***K*ð Þ 1≤*K* ≤ *N* as follows:

$$(\mathbf{w}\_m)\_K = \mathbf{Q}\_K^H (\mathbf{g}\_m - \mathbf{g}\_{\rm av}),\tag{8}$$

where **Q***<sup>K</sup>* is a matrix with its column vectors **q**<sup>1</sup> � **q***K*. Length of the vector ð Þ **w***<sup>m</sup> <sup>K</sup>* becomes *K*.

In the above-mentioned procedure, the vectors and matrices are assumed to have complex values. The Hermitian transpose <sup>H</sup> is changed to the simple transpose, T, if the values of them are real. The value *m* reflects the sound source position, and also the individuals if the HRTFs/HRIRs of multiple individuals are used for assembling the covariance matrix.

The *m*-th vector, **g***m*, is reconstructed by using the PCs as follows:

$$\left(\mathbf{g}\_m\right)\_K = \mathbf{Q}\_K \cdot (\mathbf{w}\_m)\_K + \mathbf{g}\_{\text{av}}.\tag{9}$$

The computed vector, **g***<sup>m</sup>* � � *<sup>K</sup>* in Eq. (9), becomes acceptable approximation when *K* < *N*, but this may have acceptable accuracy in principle when the Cumulative Proportion of Variance (CPV) *R*<sup>2</sup> ð Þ *K* is close to 1.0. The CPV is defined by using the eigenvalues of the covariance matrix, *λ<sup>k</sup>* ð Þ *k* ¼ 1, ⋯, *N* , as follows:

$$R^2(K) = \frac{\sum\_{k=1}^{K} \lambda\_k}{\sum\_{k=1}^{N} \lambda\_k},\tag{10}$$

where *N* is the total number of components, equals to the length of the vector **g***m*ð Þ *m* ¼ 1, ⋯, *M* .

#### **2.2 Domains used for the SPCA of the HRTFs/HRIRs**

Five domains were applied to the assembly of the covariance matrix, based on the previous researches. Kistler *et al.* applied the log-amplitudes of the HRTF [17], Xie dealt the amplitudes of the HRTF [19]. The minimum-phase approximation was assumed in these studies. Chen *et al.* dealt the complex HRTF spectrum [18], and Takane propsed the usage of the complex logarithm of HRTF [24]. At last, Wu *et al.* applied the time domain representation of the HRTFs, *i. e.*, HRIRs [20]. The domains used in these studies are treated as the modeling "domains" in this chapter. The domain "I" corresponds to the application of the HRIR to the SPCA, the domain "C" corresponds to the application of the complex HRTF, The domain "F" corresponds to that of the amplitude of the HRTF, the domain "L" corresponds to that of the logarithm of the HRTF amplitude, and the domain "CL" corresponds to that of the complex logarithm of the HRTF. This is summarized in **Table 1**.

The *m*-th HRIR and HRTF are respectively expressed as **h***<sup>m</sup>* and **H***m*, and **H***<sup>m</sup>* is further decomposed into its amplitude and phase components as follows:

$$\mathbf{H}\_m = \mathbf{A}\_m \exp\left\{ \begin{array}{c} j\Theta\_m \end{array} \right\},\tag{11}$$

where *j* is the imaginary unit. The complex logarithm of **H***<sup>m</sup>* can be written as follows:

$$\log \mathbf{H}\_m = \log \mathbf{A}\_m + j \cdot \text{unwrap}[\Theta\_m] = \mathbf{L}\_m + j \cdot \text{unwrap}[\Theta\_m]. \tag{12}$$

Here the imaginary part of log **H***m*, equal to the phase of the HRTF, is assumed to be unwrapped [24]. The logarithm of the HRTF amplitude vector is defined as **L**, *i.e.*,**L***<sup>m</sup>* � log **A***m*. It is obvious in the domains C, F, L and CL that the frequency spectrum has the following symmetric relations:

$$H\_m(k) = H\_m^\*(N - k), \quad \log H\_m(k) = \left(\log H\_m(N - k)\right)^\*,\tag{13}$$

$$A\_m(k) = A\_m(N - k), \quad L\_m(k) = L\_m(N - k) \quad (k = 1, \cdots, N), \tag{14}$$

where *Hm*ð Þ*k* , *Am*ð Þ*k* , *Lm*ð Þ*k* are the *k*-th component of the vectors **H***m*, **A***<sup>m</sup>* and **L***m*, respectively, and \* denotes the conjugate. The relations in Eqs. (13) and (14) indicate that the vector lengths can be almost halved in these domains. When the covariance matrices assembled in the domains I, C, F, L and CL are respectively denoted as **R**ð Þ<sup>I</sup> , **<sup>R</sup>**ð Þ <sup>C</sup> , **<sup>R</sup>**ð Þ <sup>F</sup> , **<sup>R</sup>**ð Þ <sup>L</sup> and **<sup>R</sup>**ð Þ CL , the size of **<sup>R</sup>**ð Þ<sup>I</sup> is *<sup>N</sup>* � *<sup>N</sup>*, while those of **<sup>R</sup>**ð Þ <sup>C</sup> , **<sup>R</sup>**ð Þ <sup>F</sup> , **<sup>R</sup>**ð Þ <sup>L</sup> and **<sup>R</sup>**ð Þ CL are ð Þ� ð Þþ *<sup>N</sup>=*<sup>2</sup> <sup>1</sup> ð Þ ð Þþ *<sup>N</sup>=*<sup>2</sup> <sup>1</sup> . In this point, the domains C, F, L and CL have the advantage in the compactness compared with the domain I. On the other hand, components of **R**ð Þ <sup>C</sup> and **R**ð Þ CL are complex while those of the covariance matrices in the other domains are real.

The domains I, C, F, L and CL mean that **h***m*, **H***m*, **A***m*, **L***<sup>m</sup>* and log **H***<sup>m</sup>* are respectively the used domains for the SPCA. When their approximations are obtained by using the first *K* PCs, they are respectively denoted as **h**ð Þ<sup>I</sup> *m K* , **H**ð Þ <sup>C</sup> *m <sup>K</sup>*, **<sup>A</sup>**ð Þ <sup>F</sup> *m K* , **L**ð Þ <sup>L</sup> *m <sup>K</sup>* and log **<sup>H</sup>**ð Þ CL *m <sup>K</sup>*. The vectors concerning the HRIR or the HRTF are calculated by using the ones estimated via the SPCA in each domain:

**Domain I:** From **h**ð Þ<sup>I</sup> *m K* , **H**ð Þ<sup>I</sup> *m <sup>K</sup>* is obtained by using Fast Fourier Transform (FFT), and **A**ð Þ<sup>I</sup> *m <sup>K</sup>* is the amplitude corresponding to **<sup>H</sup>**ð Þ<sup>I</sup> *m K*.

**Domain C:** From **H**ð Þ <sup>C</sup> *m <sup>K</sup>*, **<sup>A</sup>**ð Þ <sup>C</sup> *m <sup>K</sup>* is obtained by computing the corresponding amplitude. After the length of the vector **H**ð Þ <sup>C</sup> *m <sup>K</sup>* is increased by applying the relation of Eq. (13), **h**ð Þ <sup>C</sup> *m <sup>K</sup>* is obtained by using inverse FFT (IFFT).

**Domain F:** From **A**ð Þ <sup>F</sup> *m K* , **H**ð Þ <sup>F</sup> *m <sup>K</sup>* is estimated by computing the following equation with its minimum phase components Θð Þ <sup>F</sup> *m <sup>K</sup>* calculated using Hilbert transform [25]:


**Table 1.**

*Names of five domains expressing modeling conditions for the SPCA.*

*Spatial Principal Component Analysis of Head-Related Transfer Functions and Its Domain… DOI: http://dx.doi.org/10.5772/intechopen.104449*

$$\left(\mathbf{H}\_{m}^{(\mathcal{F})}\right)\_{K} = \left(\mathbf{A}\_{m}^{(\mathcal{F})}\right)\_{K} \exp\left\{ \left.j\left(\Theta\_{m}^{(\mathcal{F})}\right)\_{K} \right\}.\tag{15}$$

After the length of the vector **H**ð Þ <sup>F</sup> *m* � � *<sup>K</sup>* is increased by applying the relation of Eq. (14), the IFFT of **H**ð Þ <sup>F</sup> *m* � � *<sup>K</sup>* reveals the estimates of HRIR, denoted as **<sup>h</sup>**ð Þ <sup>F</sup> *m* � � *K* .

**Domain L:** From **L**ð Þ <sup>L</sup> *m* � � *<sup>K</sup>*, **<sup>A</sup>**ð Þ <sup>L</sup> *m* � � *<sup>K</sup>* is obtained by calculating the following equation:

$$\left(\mathbf{A}\_{m}^{(\mathcal{L})}\right)\_{K} = \exp\left\{ \left(\mathbf{L}\_{m}^{(\mathcal{L})}\right)\_{K} \right\}.\tag{16}$$

Then as in the domain F, **H**ð Þ <sup>L</sup> *m* � � *<sup>K</sup>* is estimated by computing its minimum phase components Θð Þ <sup>K</sup> *m* � � *<sup>K</sup>* using Hilbert transform as follows:

$$\left(\mathbf{H}\_{m}^{(\mathcal{L})}\right)\_{K} = \left(\mathbf{A}\_{m}^{(\mathcal{L})}\right)\_{K} \exp\left\{ \left.j\left(\Theta\_{m}^{(\mathcal{L})}\right)\_{K} \right\}.\tag{17}$$

After the length of the vector **H**ð Þ <sup>L</sup> *m* � � *<sup>K</sup>* is increased by applying the relation of Eq. (14), the IFFT of **H**ð Þ <sup>L</sup> *m* � � *<sup>K</sup>* reveals the estimates of HRIR, denoted as **<sup>h</sup>**ð Þ <sup>L</sup> *m* � � .

*K* **Domain CL:** From log **H**ð Þ CL *m* � � *<sup>K</sup>*, **<sup>H</sup>**ð Þ CL *m* � � *<sup>K</sup>* is obtained by calculating the following equation:

$$\left(\mathbf{H}\_{\rm m}^{(\rm CL)}\right)\_{K} = \exp\left\{ \left(\log \mathbf{H}\_{\rm m}^{(\rm CL)}\right)\_{K} \right\}.\tag{18}$$

The following procedure is the same as the domain C. **A**ð Þ CL *m* � � *<sup>K</sup>* is obtained by computing the corresponding amplitude. After the length of the vector **H**ð Þ CL *m* � � *<sup>K</sup>* is increased by applying the relation of Eq. (13), **h**ð Þ CL *m* � � *<sup>K</sup>* is obtained by using inverse FFT (IFFT).
