Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is it impossible to use the Speech Recorder on the Android emulator?

I am trying to run the Speech Recorder that comes with the Android 2.2 emulator. The problem is that the moment I click the "Record" button:

enter image description here

It aborts with an error message "The application Speech Recorder (process com.android.speechrecorder) has stopped unexpectedly. Please try again."

enter image description here

The problem is that trying again doesn't help.

Now, I searched StackOverflow and I combed the entire Internet and I found many reports of the same problem, without any working solution.

My conclusion is that, for some strange reason, the Android emulator is capable of using the Windows audio device for output, but not for input.

Why is that?

I know that other virtualization software (e.g. VMWare) have no problem using both output and input sections of the host's audio device.

Also, if Speech Recorder never worked for the emulator for anyone, why put it there?

Surely this has worked for someone. Is there a way to make Speech Recorder work for me, too?

I am using Windows XP 32-bit and my AVD is defined with an SD card (mounted upon start).

Update: I followed the suggestion by @Klaus to try and see whether any exceptions are thrown. I did so by simply typing ddms.bat at the command line to launch a stand-alone version of DDMS (with a logcat display at the bottom). Sure enough, I receive the following exception upon clicking the "Record" button:

03-29 14:16:58.195: ERROR/AudioRecord(303): Could not get audio input for record source 1
03-29 14:16:58.195: ERROR/srec_jni(303): initCheck error -22 
03-29 14:16:58.205: DEBUG/SpeechRecorderActivity(303): run audio capture thread
03-29 14:16:58.205: WARN/dalvikvm(303): threadid=8: thread exiting with uncaught exception (group=0x4001d800)
03-29 14:16:58.215: ERROR/AndroidRuntime(303): FATAL EXCEPTION: Thread-9
03-29 14:16:58.215: ERROR/AndroidRuntime(303): java.lang.NullPointerException
03-29 14:16:58.215: ERROR/AndroidRuntime(303):     at com.android.speechrecorder.SpeechRecorderActivity$4.run(SpeechRecorderActivity.java:192)
03-29 14:16:58.285: WARN/ActivityManager(59):   Force finishing activity com.android.speechrecorder/.SpeechRecorderActivity
03-29 14:16:58.904: DEBUG/dalvikvm(59): GC_FOR_MALLOC freed 13324 objects / 656184 bytes in 197ms
03-29 14:16:59.915: INFO/ARMAssembler(59): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x20db68:0x20dc24] in 1247352 ns
03-29 14:17:05.251: DEBUG/SpeechRecorderActivity(303): stopRecording

How do I proceed from here? I didn't write the Speech Recorder app, so I don't know what causes the NullPointerException at SpeechRecorderActivity.java line 192. I believe this has something to do with an earlier logcat message:

Could not get audio input for record source 1

But the question again is why?

Why wasn't it able to "get audio input for record source 1"?

like image 913
srf Avatar asked Mar 29 '11 12:03

srf


People also ask

How do I record audio on my Android emulator?

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

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 do I use voice recorder on Android?

Some Android™ devices, like the Samsung Galaxy S20+ 5G, come with a voice recording app pre-installed. Hit the red record button when you want to start the recording, and then once again to stop it. From here, you can hit the button again to continue recording, or save the file to your recording archive.

Where is the voice recorder on Android?

Open the App Drawer by swiping up from the bottom of your screen. 2. If you don't immediately see the Voice Recorder app, you may need to open a folder that will likely have the phone's name as its label (Samsung, e.g.). Do so, then tap the Voice Recorder app.


1 Answers

The reason you're having this issue is that the emulator doesn't have an audioInput to hook. Your best bet is to plug a real device in and do testing there.

like image 163
Chris Cashwell Avatar answered Oct 04 '22 00:10

Chris Cashwell