# [ACCEPTED]-Time delay estimation between two audio signals-timedelay

Score: 14

The technique you're looking for is called 11 cross correlation. It's a very simple, if somewhat compute 10 intensive technique which can be used for 9 solving various problems, including measuring 8 the time difference (aka lag) between two similar 7 signals (the signals do not need to be identical).

If 6 you have a reasonable idea of your lag value 5 (or at least the range of lag values that 4 are expected) then you can reduce the total 3 amount of computation considerably. Ditto 2 if you can put a definite limit on how much 1 accuracy you need.

Score: 1

A very straight forward thing todo is just 6 to check if the peaks exceed some threshold, the 5 time between high-peak on line A and high-peak 4 on line B is probably your delay. Just try 3 tinkering a bit with the thresholds and 2 if the graphs are usually as clear as the 1 picture you posted, then you should be fine.

Score: 1

Having had the same problem and without 4 success to find a tool to sync the start 3 of video/audio recordings automatically, I 2 decided to make syncstart (github).

It is a command line 1 tool. The basic code behind it is this:

``````import numpy as np
from scipy import fft
from scipy.io import wavfile
assert r1==r2, "syncstart normalizes using ffmpeg"
fs = r1
ls1 = len(s1)
ls2 = len(s2)
ca = np.absolute(corr)
xmax = np.argmax(ca)
if xmax > padsize // 2:
else:
file,offset = in1,xmax/fs
``````

More Related questions