GCC-PHAT (Generalized cross correlation) always peak at delay=0
40 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have recorded signals from two channels in one microphone array. I want to use gccphat to compute the delay between them.
However, the estimated result is always 0. but when using cross correlation function xcorr, the result is right.
I have searched on the internet, some similar questions are belows:
Have tried with the solution mentioned in these posts, but all fails.
Any suggestion is appreciated!
0 Commenti
Risposte (1)
Sian Jin
il 26 Apr 2024
GCC-PHAT is considered as a wideband DOA algorithm. In theory, we can partition the signal band into N subbands with frequency spacing f. Let's assume the reference signal is not delayed, and the signal from another channel has delay of τ. After cross-correlation, the frequency-domain signal on the n-th subband of the cross-correlation result is , , where is the amplitude. The GCC-PHAT normalizes the amplitude of the cross-correlation result to get . Then, it estimates the delay τ via IFFT. The IFFT requires that the linear phases of the cross-correlation result are preserved.
If the two input signals are narrowband sinusoid signals, although they are truncated, a large portion of the bandwidth are close-to zero. So, it's hard to extract the linear phase information from two pure sinusoid signals. A mitigation for that is adding the same noise with noticeable power for the sinusoid signals from the two channels. In this way, the two signals are wideband signals, and we can extract linear phase information from the cross-correlation result easier.
Another issue for using truncated sinusoid signals is that the FFT leakage of the signal after truncation is large, which might further distort main frequency band of the cross-correlation results to make the linear phase information not-ideal. A mitigation for that is adding windowing functions on the truncated sinusoid signals, which reduces the impact of the FFT leakage to the main part of the frequency band.
I put code here for a demo. The code uses two truncated sinusoid signals as GCC-PHAT inputs. You can tune the added noise power or try to remove the hann window to see the impact on the GCC-PHAT result.
clc;
clear;
%% Input signal
fs = 44000;
dt = 1/fs;
t_end = 1;
t = 0 : dt : t_end;
length_t = length(t);
%% Setting of delay
del_time = 0.1 ;
x0_num = round(del_time/dt);
%% Create input signal
omega = 2*pi;
nsig = 1e-6*randn(size(t));
% Setting the reference signal
y = sin(omega*t);
y = y+nsig;
length_y = length(y);
% Setting of delayed signal
x = sin(omega*t);
x = x+nsig;
% Delaty time 0
x0 = zeros(1,x0_num);
x = [x0,x(:,1:end - length(x0))];
%% Figure
figure(1)
subplot(3,1,1);
stem(t,x);
title('Delayed signal');
subplot(3,1,2);
stem(t,y);
title('Reference signal');
sig = x'.*hann(length(x'));
refsig = y'.*hann(length(y'));
[tau_est,R,lags] = gccphat(sig,refsig,fs);
subplot(3,1,3);
plot(lags,real(R(:,1)))
xlabel('Lag Times (ms)')
ylabel('Cross-correlation')
0 Commenti
Vedere anche
Categorie
Scopri di più su Measurements and Spatial Audio in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!