# Fast Sound Source Localization Based on SRP-PHAT Using Density Peaks Clustering
## 4 Obb-Srp-Phat
### Offline Database Construction  
The key for ODB-SRP-PHAT is to construct an offline database (ODB), which influences the accuracy of the subsequent localization. The data in the ODB are composed of a series of actual locations of the possible sound sources relative to a microphone array located at a place. The basic steps constructing an ODB are as follows:  
Step 1: The possible sound source locations are numbered, i.e., from 1 to \(m\), and the \(i\)-th location is indicated by \(q_{i}\). Step 2: The microphone array device is installed at a place and debugged, and the sound source is put in sequence at each location, i.e., from \(q_{1}\) to \(q_{m}\). Step 3: The microphone array is used to collect the sound signal emitted from each location, and the sound signal is framed. Then SRP-PHAT is used to analyze each frame in turn to obtain the estimated location \((\hat{\theta}_{i,j},\hat{\varphi}_{i,j})\). Step 4: According to the estimated locations by all frames, the actual location \((\theta_{i},\varphi_{i})\) is further determined by a method, which will be discussed later. The determined actual location is stored into the ODB. \[\text{ODB}=\left[ \begin{array}{cccc}q_{1}&\theta_{1}&\varphi_{1}\\ \vdots&\vdots&\vdots\\ q_{i}&\theta_{i}&\varphi_{i}\\ \vdots&\vdots&\vdots\\ q_{m}&\theta_{m}&\varphi_{m}\end{array} \right] \tag{9}\]  
It was found that by simulation analysis without noise and reverberation, the estimated location \((\hat{\theta}_{i,j},\hat{\varphi}_{i,j})\) obtained by analyzing each frame was the same and so completely consistent with the actual location \((\theta_{i},\varphi_{i})\). However, in the real environment, the noise and reverberation are unavoidable. So the estimated location obtained with a signal polluted by noise and reverberation always deviates from the actual location to some degree. How to determine the actual location with the estimated location analyzed by each frame considering noise and reverberation is a problem to be solved. If the estimated locations of all frames for a sound source are plotted as dots in a coordinate system with \(\theta\) as the abscissa and \(\varphi\) as the ordinate, the dots can be regarded as sample points. It was found that the sample points distributed in a different range due to the change of the noise and reverberation. The lower the signal noise ratio (SNR) is and the longer the reverberation time is, the more dispersive the distribution of sample points is, and vice versa. The closer to the actual location \((\theta_{i},\varphi_{i})\) the place is, the larger the density of the sample points is, and vice versa. For each sound source location, the sample points distributed in a cluster, and the densest position of the cluster was typically the actual location of the sound source. In this paper, a clustering algorithm was used to identify the actual location, which should be at the densest position of the sample points. For the classical clustering algorithm K-means, the number and centers of clusters are specified artificially, and the center is updated by iteration. As each point is assigned to the closest center, this method is prone to the effect of the initial selection of the center and poor self-adjusting ability. It is not applicable for analyzing data of non-spherical clusters [22]. Density-based spatial clustering of applications with noise (DBSCAN) can deal with clusters with an arbitrary shape. One chooses a density threshold, discards the points in regions with densities lower than this threshold as noise, and assigns disconnected regions of high density to different clusters. However, choosing an appropriate threshold can be nontrivial [23]. [PERSON] et al. [24] suggested a new efficient density peaks clustering algorithm, i.e., clustering by fast search and finding density peaks (DPC). More effective than the traditional algorithms, such as K-means and DBSCAN, DPC can determine the centers automatically according to the density of sample points, and can handle data with any distribution. The computational load is also small.