Time Offsets and Correction using cross-correlation method

Background and AIM

Enrique and Josh have proposed a solution to time offset problem based on system transfer functions. (Enrique Perez Gonzalez, Josh Reiss "Determination and correction of individual channel time offsets for signals involved in an audio mixture", 125th AES Convention, San Francisco, USA, October 2008 - Paper 1). This project is trying to propose another approach as mentioned at end of the paper using cross-correlation algorithm.

Phase 1 (Matlab concept approval)

1) Problem: slight time offset between two signals from same sources causes the comb filter effect which is sometimes audible. 

Fig 1 Comb filter Effect

Figure 1 shows comb filter effect. Red line is spectrum of pseudo white with 44100Hz sampling frequency, 2 second long. Blue line is spectrum of mixing of two exact same pseudo white noise with 1 ms delay (to match the parameter of paper-1). Theoretically 1ms delay is around 44 samples delay.

2) find delay time of two signal using cross-correlation approach. The plot shows the delay of one channel is about 44 samples. This diagram uses offline (whole signal in 2second ) data therefore the results are quite clear.

3) Real time consideration: At real time situation, the signals are buffered as frames then the frames are processed continuously frame by frame. So lets take 1024 samples of original signal as a frame which is not unrealistic.  The following diagram shows the result which also clearly demonstrates the detectable delay.

4) Second frame with swapped input positions. cross-correlation shows the correct delay time and the also the position information (+ indicates delay, - indicates in advance) 

5) Correction algorithm implemented in Matlab,

a) find the peak value position (index).
b) calculate the correct delay (inserting zeros) according to the index of peak value. 
b) apply the correct delay to the signal which is in advance of another signal.
The following diagram shows the after correction the two signal are aligned.

6) Performance comparison (TODO)

Test algorithm using different noise polluted and distorted real audio signal. To be able to compare with Enrique's algorithm, it is better to using same testing signals.

Phase 2 MaxMsp implementation


Phase 3 Hardware implementation