Audio Playback while Recording.. Error

All your problems with Audio, Video and Images.

Audio Playback while Recording.. Error

Postby vishalgaonkar » Fri Oct 16, 2009 1:21 pm

Hello,

I have a Java application where in I am trying to read Audio samples from the mic into a buffer and then write the samples back to speaker from a buffer for playing.

I have used AudioRecord and AudioTrack interfaces. Below are my configurations for the Record and Track object creation. AudioTrack(0, 8000, 2, 2, playBufSize, 1); AudioRecord(1, 8000, 2, 2, recBufSize);
Using AudioRecord interface I am able to read the samples from mic continiously (8000 sampling rate and 640 samples per read). In the similar way I am also able to write some pcm samples to the speaker from a buffer and play it continuously using the AudioTrack interface (without record).

But when I try to do both record and play simultaneously I am able to only record audio from mic but I am not able to play any samples to speaker. I am getting this error " ------- attemp playback while recording, cheat it! ----- " in the log cat.

I have given the following permissions "android.permission.RECORD_AUDIO" and "android.permission.MODIFY_AUDIO_SETTINGS" in the Manifest file. I didn't find any special permission to play the audio.

Is there anything else that I need to enable?

Thanks in advance,
Vishal
vishalgaonkar
Junior Developer
Junior Developer
 
Posts: 11
Joined: Wed Sep 23, 2009 10:03 am

Top

Postby Silverspitz » Thu Oct 29, 2009 6:58 am

I was able to do audio recording from mic to raw pcm, and then play the recorded pcm to the speaker, using AudioRecord and AudioTrack API's without any problems, and with only the record audio permission being enabled in the manifest xml. With just a little more tweaking I'm quite sure simultaneous playback can be done.

I find your error to be unfamiliar, and I haven't heard of such an error before. In my opinion, its too funny to be an error text coming from any android API's, framework or drivers. Are you sure it wasn't you who wrote that error using System.out.println(), or using Log.e()?

Can you tell me more how did you implement the writing of the pcm data to the speakers? Did you pass the short array extracted from mAudioRecord.read() straight to the mAudioRecord.write()? Did you implement this using a while loop where you do both read and write inside the same cycle?
Silverspitz
Freshman
Freshman
 
Posts: 2
Joined: Wed Oct 28, 2009 6:50 am

Re: Audio Playback while Recording.. Error

Postby helancy » Wed Oct 26, 2011 3:08 am

Designers associated with arsenal football shirts today attempt to make a a number of international football shirts to the followers of which appear to be simular to the very first the football shirt the fact that game enthusiasts put on on the ground, but you can however get a little models about the &
helancy
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Oct 26, 2011 2:41 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 9 guests