I' m trying to read recorded data into the short array. I want to continue recording and reading until it is full. My code: http://pastebin.com/r6yuPn82 Unfortunately applications crashes after calling startRecording method. Errors: http://pastebin.com/9jwrPLNc May I kindly ask you to help me fixing it?
1
votes
2 Answers
3
votes
1
votes
Make sure that you're recording before you read from your MIC to the buffer.
See answer in this post saying the the following:
short[] audioData = new short[bufferSize];
int offset =0;
int shortRead = 0;
//start tapping into the microphone
audioRecored.startRecording();
//start reading from the microphone to an internal buffer - chuck by chunk
while (offset < bufferSize)
{
shortRead = audioRecored.read(audioData, offset ,bufferSize - offset);
offset += shortRead;
}
//stop tapping into the microphone
audioRecored.stop();