• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Synchronizing AudioTrack and AudioRecord

Sir^Knigget

Newbie
Sep 30, 2009
11
0
Hello,
My application uses AudioTrack in streaming mode and AudioRecord simultaneously.
My problem is that I start them at the same time, but I have no guarantee that they will actually start playback\recording in the same timestamp.
The reason I need this kind of accuracy is because I use echo cancellation (subtracting audio played to speaker from the recording). My echo canceller doesn't require an exact delay, but the delay introduced between AudioTrack and AudioRecord moves in the range of 250ms (between different runs), and that's too much - each run is different because they start themselves asynchronously. The API doesn't provide me a way to make sure they start in the same time, so I thought about measuring this starting delay somehow and then using it in my calculation.
Does anyone have an idea how to do that, utilizing their API or in any other way?

Thanks for any help!
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones