-
Is there a way to measure the audio output latency programatically? That is, not just the AAudio or Oboe buffer, but also the driver, OS and DAC delays. The context is that, for certain applications, such as rhythm games, accuracy is more important than actual latency. If the total delay is x milliseconds, the app can start sending data x milliseconds before, and accurately synchronize audio and video. What is a good way of calculating, or estimating the full output latency in AAudio or Oboe? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Yes, you can use Note that sometimes an audio device will have digital signal processing after the audio frame has been rendered. It's not unusual to find this on the built-in speaker path where signal processing can be used to improve the resulting sound quality (e.g. make music sound less tinny on those tiny little speakers). For AAudio take a look at this answer on stackoverflow. |
Beta Was this translation helpful? Give feedback.
-
Note that AudioStream::calculateLatencyMillis() is based on the timestamps, which tell you the time a particular frame reached the speaker. You can combine that information with the sample rate to calculate the time any other frame will hit the speaker. |
Beta Was this translation helpful? Give feedback.
Yes, you can use
AudioStream::calculateLatencyMillis
Note that sometimes an audio device will have digital signal processing after the audio frame has been rendered. It's not unusual to find this on the built-in speaker path where signal processing can be used to improve the resulting sound quality (e.g. make music sound less tinny on those tiny little speakers).
For AAudio take a look at this answer on stackoverflow.