SiberianGuy
SiberianGuy

Reputation: 25312

How to enable audio recording in Android emulator?

I've found several answers (like this one) that tell it is possible to record audio in Android Emulator. But I didn't succeed in finding any suitable setting in Android Virtual Device Manager and I still get an exception on the line recorder.SetAudioSource(AudioSource.Mic).

Upvotes: 6

Views: 8530

Answers (3)

nkadu1
nkadu1

Reputation: 263

You can record the audio by executing:

adb emu avd hostmicon

Reference:

https://developer.android.com/studio/releases/emulator

Upvotes: 3

nrofis
nrofis

Reputation: 9766

In the documentation of MediaRecorder you can see that:

Note: Currently, MediaRecorder does not work on the emulator.

Even in the last API.

But I saw that in the class AudioRecord, there is no note for this.
More then that, I have found this code:

AudioRecord recorder = new AudioRecord(MediaRecorder.AudioSource.MIC,
        8000, AudioFormat.CHANNEL_CONFIGURATION_MONO,
        AudioFormat.ENCODING_PCM_16BIT, 500000);
recorder.startRecording();

From here. And the code's author said that this code works in the emulator.

Upvotes: 7

Mohamed ALOUANE
Mohamed ALOUANE

Reputation: 5407

found this

You guys are not able to record sound in emulator because the android emulator doesn’t support it yet. This code should only work on the phone.

a Source

Upvotes: 0

Related Questions