Android audio delay - how to calculate delay

773 views Asked by At

i understand that there are some issues why android can't ply low latency audio and has a >100ms delay on everything (well.. actually vibrations are faster as audio!!! Shame on you!).. but is there some possibility to figure out how much earlier i need to run the sound to actually be on time?

e.g. how to calculate audio delay?

Im creating a rhythm game and i need to play "ticks" in sync with music. Im using libGDX Sound - e.g. sound pool - play() now.

Any suggestions?

1

There are 1 answers

0
Pedro Sacramento On

Your app could emit a sound with the speaker and then use the microphone to detect the sound emited by itself (something similar to remote.js).

Even though there are many variables involved (the mic will also have a latency), you can make the device calibrate it self by continuously trying to guess how long the sound will take to be detected, and emiting it again and again until your guess gets "fine tuned".