2
$\begingroup$

Can GCC-PHAT be used to detect multiple time-delays (that is, having multiple acoustic sources simultaneously)? The documentation for the gccphat(sig,refsig) function says that it assumes both sig and refsig came from a single source.

If it is the case that gccphat(sig,refsig) can indeed only take into account a single source, can you recommend other approaches I could try to detect multiple sources? I am fairly new to this field so I could appreciate all the help. Thanks.

$\endgroup$
2
  • $\begingroup$ Some context would be great. What framework are you using exactly? $\endgroup$ Nov 3, 2019 at 18:24
  • 1
    $\begingroup$ In general, the GCC-PHAT-algorithm can work for multiple sources provided they result in different delays. In this case, you can just take the N highest peaks instead of one. $\endgroup$ Nov 3, 2019 at 18:25

3 Answers 3

1
$\begingroup$

The theory behind the Generalised Cross-Correlation - GCC - (in general, not just the PHAT version of it) uses the cross-correlation of the recorded signals to estimate the delay between them. I am sure you are already aware of that, but if you consider the fact that cross-correlation cannot always differentiate between the different (temporal) components of the signal stream (i.e. different sources), it means that the method works best for single sources.

The method Jonas Schwarz proposes is one possible solution to that, but it may or may not work all the time. I created two different signals, each comprised of three (different) harmonics and delayed one of them in respect to the other by 450 samples. Then I summed them and duplicated the sum with an addition of a delay to the duplicate of 50 samples. Finally, I added a little bit of noise (doesn't really change much but still a nice thing to try). The sampling rate I used is 1 KHz, so it is easy to convert from samples to seconds. You can see the plots below

GCC

As you can see the main pick is very well localised and it is right on spot. Now, the next higher is annotated. The value given is about 560, which is definitely off. This, of course, is an oversimplified example here, but as you can see, you can't always be sure that the second peak will necessarily correspond to the second source.

Another approach that has been used in other techniques (such as the broadband MUSIC algorithm) is to divide the spectrum into bands (such as with the use Fourier analysis, or filterbanks) and perform the GCC algorithm in each band. This assumes that in each band only one source will dominate (in a sense, this is the same as considering incoherent sources). From there, you could either use histograms (see 3D Localization of Multiple Audio Sources Utilizing 2D DOA Histograms by Delikaris-Manias et al., DOA Estimation with Histogram Analysis of Spatially Constrained Active Intensity Vector by Delikaris-Manias et al. and references therein) or any other way to estimate the direction of the sources (or even the number of them).

However, you have to keep in mind that, as mentioned above, this will not work under all circumstances. Various approaches as to how to use the acquired cross-correlation functions can be found in Considering the Second Peak in the GCC Function for Multi-Source TDOA estimation with Microphone Array by D. Bechler and K. Kroschel and in Time-Delay Estimation via Linear Interpolation and Cross Correlation by J. Benesty et al.

Finally, a well structured (in my opinion of course) paper with quite some useful information is Real-Time Multiple Sound Source Localization and Counting using a Circular Microphone Array by Pavlidi et al. The authors in this paper have proposed various methods on how one could approach the problem of localisation (angle estimation only, not distance) and various improvements that have found to work quite well. Keep in mind though that this refers to a circular microphone array.

$\endgroup$
1
$\begingroup$

The previous answer shows a good practical example, I'll try to show theoretically what the GCC-PHAT function looks like with multiple sources. For reference, please see my answer on source localization with GCC-PHAT.

Two sources

You will need 2 mics to estimate TDOA (time-difference of arrival) of 2 sources. Let the sources be denoted by $s_{1,2}$, and the mics be $x_{1,2}$. Let the TDOA from $i$th source to $j$th mic be $\tau_{ij}$ and let the uncorrelated noise picked up by the mics be $n_{1,2}$. The microphone signals are a weighted sum of the delayed source signals,

$x_1(t) = \alpha_1 s_1(t-\tau_{11}) + \alpha_2 s_2(t - \tau_{21}) + n_1(t) \\ x_2(t) = \beta_1 s_1(t - \tau_{12}) + \beta_2 s_2(t-\tau_{22}) + n_2(t)$

If we take the Fourier transform and look at this in the frequency domain, we get

$\begin{bmatrix} X_1(\omega) \\ X_2(\omega) \end{bmatrix} = \begin{bmatrix} \alpha_1 e^{-j\omega \tau_{11}} & \alpha_2 e^{-j\omega \tau_{21}} \\ \beta_1 e^{-j\omega \tau_{12}} & \beta_2 e^{-j\omega \tau_{22}} \end{bmatrix} \begin{bmatrix} S_1(\omega) \\ S_2(\omega) \end{bmatrix} + \begin{bmatrix} N_1 (\omega) \\ N_2 (\omega) \end{bmatrix}$

Now, the cross power spectrum is $\Phi_{x_1,x_2}(\omega) = X_1(\omega)^* X_2(\omega)$. If we assume the sources to be uncorrelated, then

$\Phi_{x_1,x_2}(\omega) = \alpha_1^* \beta_1 e^{-j\omega (\tau_{12} - \tau_{11})} \Phi_{s_1,s_1}(\omega) + \alpha_2^* \beta_2 e^{-j\omega (\tau_{22} - \tau_{21})} \Phi_{s_2,s_2}(\omega) $

Here,$\Phi_{s_i,s_i}(\omega)$ is the power spectrum of the $i$th source and the cross power spectra of the sources is 0 since they are uncorrelated. For simplicity, we denote the relative difference in phase as $\tau_1$ and $\tau_2$ and assume the linear weights to be real, $\alpha, \beta \in \mathbb{R}$. The GCC-PHAT function at lag $l$ is defined as

$R_{x_1,x_2}(l) = \int_{-\pi}^{\pi} \frac{\Phi_{x_1, x_2}(\omega)}{|\Phi_{x_1, x_2}(\omega)|} e^{j\omega l} d\omega \\ = \int_{-\pi}^{\pi} \frac{\alpha_1 \beta_1 e^{-j\omega \tau_1} \Phi_{s_1,s_1}(\omega) + \alpha_2 \beta_2 e^{-j\omega \tau_2} \Phi_{s_2,s_2}(\omega)}{\sqrt{\alpha_1^2 \beta_1^2 \Phi_{s_1,s_1}^2(\omega) + \alpha_2^2 \beta_2^2 \Phi_{s_2,s_2}^2(\omega) + 2\alpha_1 \alpha_2 \beta_1 \beta_2 \Phi_{s_1, s_1}(\omega) \Phi_{s_2, s_2}(\omega) \cos \left(\omega(\tau_2 - \tau_1)\right)}} e^{j\omega l} d\omega $

Let us assume the sources to be white, thus their power spectra are flat, $\Phi_{s_i, s_i}(\omega) = g_i$.

$R_{x_1,x_2}(l) = \int_{-\pi}^{\pi} \frac{\alpha_1 \beta_1 e^{-j\omega\tau_1}g_1 + \alpha_2 \beta_2 e^{-j \omega \tau_2} g_2}{\sqrt{\alpha_1^2 \beta_1^2 g_1^2 + \alpha_2^2 \beta_2^2 g_2^2 + 2\alpha_1 \alpha_2 \beta_1 \beta_2 g_1 g_2 \cos \left(\omega(\tau_2 - \tau_1)\right)}} e^{j\omega l} d\omega $

This is not a trivial integral to solve (I don't know if a closed-form solution exists). The best approximation you can make is when $\tau_1 - \tau_2 \approx 0$. In that case, the integral becomes

$R_{x_1,x_2}(l) = \frac{1}{\alpha_1\beta_1g_1 + \alpha_2 \beta_2 g_2}\int_{-\pi}^{\pi} \left(\alpha_1 \beta_1 e^{-j\omega\tau_1}g_1 + \alpha_2 \beta_2 e^{-j \omega \tau_2} g_2 \right)e^{j\omega l} d\omega \\ = \frac{1}{\alpha_1\beta_1g_1 + \alpha_2 \beta_2 g_2} \left(\alpha_1 \beta_1 g_1 \delta(l - \tau_1) + \alpha_2 \beta_2 g_2 \delta(l - \tau_2)\right) $

This function will show two peaks at $\tau_1$ and $\tau_2$ respectively (in this case these peaks will be almost overlapping since $\tau_1 \approx \tau_2$, so there's essentially one peak), from which you can calculate the TDOA.

But $\tau_1 - \tau_2 \approx 0$ requires a very specific configuration -- when the distance between the microphones is the same as the distance between the sources. I am attaching a drawing to illustrate this

Source-mic configuration for accurate TDOA estimation

P.S. - I will edit the answer to illustrate the N source case when I get more time.

$\endgroup$
1
$\begingroup$

In my experience, yes, it is possible to detect multiple acoustic sources simultaneously using the GCC-PHAT algorithm (or an adaptation of it). In practice, you can only locate multiple sound sources if they have similar loudness, if you want to detect them simultaneously.

I don't use MATLAB, but it looks like you need to analyse the R output value as opposed to the simple tau output form the gccphat(sig,refsig) function. You will need to work with the raw cross-correlation between the signals, R (a special form of convolution), and look for multiple peaks in the output.

The image below is the output from a GCC-PHAT algorithm over time, where the microphone array (in this case a linear array of 8 of them) is turning over time. The "sin(θ)" value is equivalent to τ (tau) in this case. GCC PHAT using a linear array

You can see two distinct sound sources in this case. You can tell that I use a form of auto-gain to normalise each snapshot, and this has the result of occluding the signal from one of the sound sources at any one time - the sound sources vary in amplitude over time.

The same signal above is passed through a peak detector to produce the plot below:

enter image description here

It is pretty good, and the noise isn't too thick in this situation. And GCC suppresses a LOT of noise. But it is clear that the power of one sound source occludes the other most of the time.

Bear in mind that I combined the cross-correlations of 8 microphones here, though (23 possible cross-correlations), and did a lot of filtering. If you only use 2 microphones, you will end up with a lot of sidelobes at certain frequencies - if you try to find more than one peak in that signal, you can very easily mistake a side lobe for a secondary sound source.

Using multiple microphone pairs can suppress these sidelobes, but you are also looking at more complexity and diving deeper into the intricacies of DSP.

So in short, yes, it is possible to locate multiple sources using the GCC method, but because of sidelobes, it is not a trivial task. I am actively working on this problem, so will try to update this answer over time.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.