Synchronizing AudioTrack and AudioRecord

All your problems with Audio, Video and Images.

Synchronizing AudioTrack and AudioRecord

Postby Sir^Knigget » Thu Jan 21, 2010 1:10 pm

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 playbackrecording 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!
Sir^Knigget
Freshman
Freshman
 
Posts: 9
Joined: Wed Sep 30, 2009 6:00 pm

Top

Postby Draffodx » Fri Jan 22, 2010 2:03 pm

Would


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. synchronize(AudioRecord){
  2.  
  3.  
  4.  
  5. //Do AudioTrack here
  6.  
  7.  
  8.  
  9. }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


be any help?
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Postby Sir^Knigget » Sun Jan 24, 2010 10:07 am

I'm not talking about thread safety. I'm talking about having both objects actually start their playbackrecording mechanism in the same time. Calling play()startRecording() in the exact same time doesn't guarantee that (like calling Thread.start() twice in the same time), and that's my issue.
Sir^Knigget
Freshman
Freshman
 
Posts: 9
Joined: Wed Sep 30, 2009 6:00 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google Feedfetcher and 12 guests