# Sound Localization Framework for Construction Site Monitoring
## 4 Construction Sound Localization Framework (CSLF)
### Key Components of the Sound-Based Localization Approach
#### 4.2.2 Time Delay Calculation Approach  
To perform sound localization using the TDOA localization technique, the arrival time delay of each receiver is calculated by comparing the recorded sound spectrum of a certain receiver to that of a different receiver [30]. In TDOA, the signal generated by the sound source reaches each microphone with different phase information, and this phase information is converted to time information to figure out the TDOA. Generalized Cross Correlation-Phase Transform (GCC-PHAT) in the frequency domain is a method of figuring out the TDOA. GCC-PHAT whitens the incoming signal to remove the frequency's sound pressure and uses the phase delay to estimate the position. GCC-PHAT is mainly used in specific environments for reducing the echo and lowering the noises [20; 31; 32; 33].  
The GCC-PHAT-based TDOA uses a correlation in a mathematical theoretical approach. The correlation indicates the similarity between the signals and the correlation function is divided into auto-correlation function and cross-correlation function. The auto-correlation function shows the correlation with the time-shifted or frequency-shifted version of itself. On the other hand, the cross-correlation function shows the similarities between the different signals [20; 31; 32; 33]. The cross-correlation in Equation (1) is obtained by setting the signal from the sound source to the first microphone as \(x_{1}(t)\), and the signal from the sound source to the second microphone as \(x_{2}(t)\).  
\[R_{x_{1}x_{2}}(\tau)=\iint_{\infty}^{\infty}x_{1}(t)x_{2}(t-\tau)dt \tag{1}\]  
In \(R_{x_{1}x_{2}}(\tau)\) calculated from Equation (1), the \(\tau\)-value showing the biggest value is the TDOA between the microphones. Thus, the TODA is expressed as Equation (2).  
\[\hat{\tau}=argmaxR_{x_{1}x_{2}}(\tau) \tag{2}\]  
While the cross-correlation function can be used for the calculation in the time scale, this slows down the processing speed because the cross-correlation's calculation amount exponentially increases depending on the number of samples. As a result, it is hard to apply the cross-correlation function on occasions that require real-time processing. Thus, the GCC method with a calculation amount that is relatively less is adopted. Equation (3) shows the Fourier Transform (FT) of Equation (1).  
\[R_{x_{1}x_{2}}(\tau)=\frac{1}{2\pi}\iint_{\infty}^{\infty}W(\omega)X_{1}(\omega ){X_{2}}^{*}(\omega)e^{i\omega\tau}d\omega \tag{3}\]  
When the frequency weighting function is \(W(\omega)=1\), the according formula is set to GCC, and this weighting function is adjusted appropriately to reduce the noise and echo. One of the weighting functions that is mainly used is the PHAT-based weighting function which whitens and removes the sound pressure level in the frequency domain.  
\[W(\omega)=\frac{1}{|X_{1}(\omega){X_{2}}^{*}(\omega)|} \tag{4}\]  
When the weighting function is given as above, the according formula is set to GCC-PHAT. The delayed time can be figured out like Equation (2) by using the \(\tau\)-value for the maximum value of \(R_{x_{1}x_{2}}(\tau)\) in calculating the delayed time from the sound source to the two microphones [20; 31; 32; 33].  
Furthermore, generalized cross-correlation analysis minimizes the effect of noise in the sound data, considering that it is simpler and requires fewer computing resources compared to conventional cross-correlation methods. Therefore, it is suitable for use on mobile phones and IoT devices.