0
$\begingroup$

I want to play audios on two mobiles with sync. But mobile phones are not in sync. I am trying to find two Mobile phones playing latency so I can pad latency on each phone so they can play together. Currently, I have an app that plays a sawtooth wave(300-12000Hz) of 30ms length and records (plays) it. After that I get that recorded audio and find a correlation of it with the original sawtooth signal. This correlation gives me the latency which tells how late the signal was played. But due to echo and noises, I could not be able to find the exact point where the sawtooth beep was detected. The goal is to find both phone's latency and adjust in a way that both can play in sync. Is sawtooth a good signal for this purpose? Is there any other good way of doing it ?

Any suggestion would highly be appreciated.

$\endgroup$
0
$\begingroup$

Doing this acoustically will be very difficult.

You could try a pulse train or short noise burst and then cross correlate the received signals. This being said, the room will generate a lot of echoes and reverb, the phones microphones need to be configured properly and are really not designed for this type of thing and it might not even be stationary if any one phone is moving.

You might be better off getting both phones on the same clock using their network connection, e.g. something like NTP https://en.wikipedia.org/wiki/Network_Time_Protocol

Even if you have them on some shared clock, you also have to deal with the latency of the drivers and software stack (including buffering, sample rate conversion, OS specific pre-processing) which can be substantial and also vary a lot from phone to phone and from OS to OS and also drift over time.

Once you have that under control you also need to sync the audio clocks. If both phones receive the same digital stream, one will always play it faster then the other, so even if they are perfectly sync'd at the beginning they will drift apart over time.

Finally, since time sync of audio playback is quite tricky there are quite a few patents in this area that cover most viable solutions. If you are looking for a solution that can be commercialized, you should probably do some IP research first. Or perhaps license and existing solution.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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