Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable audio recording in Android emulator?

Tags:

android

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).

like image 705
SiberianGuy Avatar asked Oct 17 '14 17:10

SiberianGuy


People also ask

How do I enable microphone on emulator?

hi try by enabling the audio recording support while creating the virtual device in emulator... While creating device go to hardware part and select new button. A dialog will appear in which select the property combo and select "Audio Recording Support" and give k and apply... Hope it helps...

How can I use microphone in Android emulator?

If you want to use the host audio data, you can enable that option by going to Extended Controls > Microphone and enabling Virtual microphone uses host audio input. This option is automatically disabled whenever the emulator is restarted.

How do I get audio permission on Android?

Android Set Permissions to Record Audio To record an audio and save it in device, our app must tell the user that it will access the device's audio input and storage, for that we need to set multiple permissions such as RECORD_AUDIO, STORAGE and WRITE_EXTERNAL_STORAGE in our manifest file.


1 Answers

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.

like image 190
nrofis Avatar answered Sep 30 '22 18:09

nrofis