- Load the audio signals and extract the audio data from each microphone.
- Calculate the cross-correlation between each of the microphone pairs. You can use MATLAB’s inbuilt ‘xcorr’ function to find the cross-correlation. You can refer the following documentation for more information: https://www.mathworks.com/help/matlab/ref/xcorr.html
- The maximum (or minimum if the signals are negatively correlated) of the cross-correlation function indicates the point in time where the signals are best aligned, i.e., the time delay between the two signals corresponds to the peak in the cross-correlations found in previous step2. You can use the ‘max’ function to find the peak and its corresponding index.
- You can refer the following documentation on cross-correlation: https://en.wikipedia.org/wiki/Cross-correlation
- You can use the time-delay values along with propagation speed and the length of audio waves to find the TDOA as described in the documentation.