1. Check out our companion app, Forums for Android! Download from Google Play

Synchronizing AudioTrack and AudioRecord

Discussion in 'Application Development' started by Sir^Knigget, Jan 21, 2010.

  1. Sir^Knigget

    Sir^Knigget Member
    Thread Starter

    Sep 30, 2009
    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!


Share This Page