views:

318

answers:

4

Hello everybody,

I'm new in Android development and I have the next question/problem.

I'm playing around with the MediaRecorder class to record just audio from the microphone. I'm following the steps indicated in the official site: http://developer.android.com/reference/android/media/MediaRecorder.html

So I have a method that initializes and configure the MediaRecorder object in order to start recording. Here you have the code:


        this.mr = new MediaRecorder();
        this.mr.setAudioSource(MediaRecorder.AudioSource.MIC);
        this.mr.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        this.mr.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        this.mr.setOutputFile(this.path + this.fileName);
        try {
            this.mr.prepare();
        } catch (IllegalStateException e) {
            Log.d("Syso", e.toString());
            e.printStackTrace();
        } catch (IOException e) {
            Log.d("Syso", e.toString());
            e.printStackTrace();
        }

When I execute this code in the simulator, thanks to logcat, I can see that the method setAudioSource(MediaRecorder.AudioSource.MIC) gives the next error (with the tag audio_ipunt) when it is called:


ERROR/audio_input(34): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
ERROR/audio_input(34): VerifyAndSetParameter failed

And then when the method prepare() is called, I get the another error again:


ERROR/PVOMXEncNode(34): PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.PV.amrencnb handle 

If I start to record bycalling the method start()... I get lots of messages saying:


AudioFlinger(34):RecordThread: buffer overflow

Then...after stop and release,.... I can see that a file has been created, but it doesn't seem that it been well recorderd. Anway, if i try this in a real device I can record with no problems, but I CAN'T play what I just recorded.

I gues that the key is in these errors that I've mentioned before. How can I fix them? Any suggestion or help??

Thanks in advanced!!

A: 

Here the same Problem.

opix
The simulator has lots of issues with the audio recording. Lets say that it doesn't work. Your best bet is try your code in a real device!! I could make it work, so if you still have problems, let me know and I'll give you the code I used!
arakn0
A: 

Hi

You got any workaround for the above problem

Please reply

Thanks in Advance

Alex
The simulator has lots of issues with the audio recording. Lets say that it doesn't work. Your best bet is try your code in a real device!! I could make it work, so if you still have problems, let me know and I'll give you the code I used!
arakn0
A: 

The simulator has lots of issues with the audio recording. Lets say that it doesn't work. Your best bet is try your code in a real device!!!

arakn0
A: 

i have the same problem on galaxy s, not emulator

Andrea Scarafoni