Is It Possible to Record Audio Through Android Emulator?

后端 未结 3 815
梦如初夏
梦如初夏 2021-01-23 04:31

I am Working On a Medical Project and the app can able to record the conversation between doctor and patient and send it for Transcription.

Assignment :

相关标签:
3条回答
  • 2021-01-23 05:14

    No. It is not possible to use the emulator for recording sound. You will have to code the logic of your program and then to deploy the actual apk to your phone, in order to test its functionality.

    check this link as an official reference: http://developer.android.com/intl/es/guide/topics/media/audio-capture.html

    0 讨论(0)
  • 2021-01-23 05:22

    Recording audio is possible at least in the standard 2.3.3 emulator on Windows 7; I have tried it and it works. However, the recorded audio did sound a bit weird (slow) in my case. I did not investigate the cause.

    You need to add audio recording + playback support to the emulator (Android SDK and AVD manager -> Virtual devices -> Edit -> Hardware -> New). Then use the [MediaRecorder API][1] to record (MediaRecorder.AudioSource.MIC).

    Code is:

    fMediaRecorder= new MediaRecorder();
    fMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    fMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
    fMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    
    fMediaRecorder.setAudioChannels(1);
    fMediaRecorder.setAudioSamplingRate(8000);
    
    fMediaRecorder.setOutputFile(fTmpFile.getAbsolutePath());
    
    fMediaRecorder.prepare();
    
    fMediaRecorder.start();
    

    You also need

    < uses-permission android:name="android.permission.RECORD_AUDIO"/>

    in your AndroidManifest.xml.

    Works for me, but Audio IS distorted.

    0 讨论(0)
  • 2021-01-23 05:26

    YES, you can, just enable "Virtual microphone uses host audio input". Also, the app should ask for permission, you should allow it to use your audio.

    Image of How to enable Android emulator audio

    To make sure that the problem is not your app, you can go to google chrome in the emulator and use this web app -> https://online-voice-recorder.com/ just to make sure that the audio recording is working.

    0 讨论(0)
提交回复
热议问题