Folks,
I am reading audio off the devices's microphone. Here is the pseudo code that is being run in a background thread:
while(true) {
if (stopRecordingRequested()) {
break;
}
int bytesRead = recorder.read(in, inSize);
// do the processing
}
What I noticed is that method "read" returns data even if there is silence in the room.
I am thinking a tight loop such as the one above may simply peg the CPU even when the room is silent.
Is it possible to configure the audio recorder such that read() just waits until there is some noise?
Or, perhaps there is a different technique that doesn't peg the CPU.
Thank you in advance for your help.