1

I'm using the following pseudo code to get audio using audioRecord and play it audioTrack for eg a hearing aid project.

your_audio_thread_run() 
{ 
declare audio buffer 
create AudioRecord 
create AudioTrack 
start both 

while(1) 
{ 
 capture mic to buffer 
 write buffer to output track 
 } 
 }

Please correct me if I'm wrong: audioRecord and audioTrack are created on the same thread so when the audio is captured using audioRecord, your_audio_thread_run will block and will have to wait until the buffer is filled out. Am i right? In this scenario there will be delay until sound is output to audioTrack.

Should i use 2 threads, one for audioRecord and another for audioTrack?If so how?

Mehdi Fanai
  • 4,021
  • 13
  • 50
  • 75
  • I'm also trying to tackle this type of problem. Did you find resolution? – Raevik Oct 23 '13 at 17:05
  • Good discussion of this topic here: http://stackoverflow.com/questions/6959930/android-need-to-record-mic-input – Raevik Oct 23 '13 at 17:21

0 Answers0