Voice recognition in Android emulator

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Voice recognition in Android emulator

Postby zzzzz75 » Tue Dec 22, 2009 7:28 am

hi all
i am very new to android programming. i tried running the voice recognition demo app and at this point in the code

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.       // Check to see if a recognition activity is present
  2.  
  3.         PackageManager pm = getPackageManager();
  4.  
  5.         List<ResolveInfo> activities = pm.queryIntentActivities(
  6.  
  7.                 new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
  8.  
  9.         if (activities.size() != 0) {
  10.  
  11.             speakButton.setOnClickListener(this);
  12.  
  13.         } else {
  14.  
  15.             speakButton.setEnabled(false);
  16.  
  17.             speakButton.setText("Recognizer not present");
  18.  
  19.         }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


I am always getting the following: "Recognizer not present"

i used the SDK to create the targets and am using the emulator on platform "android-2.0.1" (on windows)


any help would be great

thanks in advance
zzzzz75
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Dec 21, 2009 12:08 pm

Top

update

Postby zzzzz75 » Tue Dec 22, 2009 7:30 am

hi
i would like to update this post
i've downloaded the android dev phone (signed-dream_devphone_userdebug-img-14721.zip) - downloaded from http://www.google.com/url?sa=D&q=http:/ ... a7Ezs9XB2A

i now seem to get 1 activity for voice recognition which is great - but am getting an 'audio problem' when running the demo app

any help would be greatly appreciated

thanks
zzzzz75
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Dec 21, 2009 12:08 pm

the same issue here...

Postby mircea273 » Tue Dec 22, 2009 3:39 pm

I have the same issue here. I installed the same image. I am running the emulator on Ubuntu 9.10
Here you have the stacktrace in the log:

12-22 14:36:29.083: WARN/AudioHardwareInterface(30): getInputBufferSize bad sampling rate: 16000
12-22 14:36:29.115: ERROR/AudioRecord(350): Recording parameters are not supported: sampleRate 16000, channelCount 1, format 1
12-22 14:36:29.154: WARN/RecognitionService(350): Audio problem
12-22 14:36:29.154: WARN/RecognitionService(350): java.lang.IllegalStateException: AudioRecord::initCheck() failed - another instance open?
12-22 14:36:29.154: WARN/RecognitionService(350): at com.google.android.voicesearch.endpointer.MicrophoneInputStream.AudioRecordNew(Native Method)
12-22 14:36:29.154: WARN/RecognitionService(350): at com.google.android.voicesearch.endpointer.MicrophoneInputStream.<init>(MicrophoneInputStream.java:61)
12-22 14:36:29.154: WARN/RecognitionService(350): at com.google.android.voicesearch.RecognitionService.setupMicrophone(RecognitionService.java:415)
12-22 14:36:29.154: WARN/RecognitionService(350): at com.google.android.voicesearch.RecognitionService.startRecognitionInternal(RecognitionService.java:261)
12-22 14:36:29.154: WARN/RecognitionService(350): at com.google.android.voicesearch.RecognitionService.access$400(RecognitionService.java:75)
12-22 14:36:29.154: WARN/RecognitionService(350): at com.google.android.voicesearch.RecognitionService$RecognitionRunnable.run(RecognitionService.java:478)
12-22 14:36:29.154: WARN/RecognitionService(350): at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:648)
12-22 14:36:29.154: WARN/RecognitionService(350): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:673)
12-22 14:36:29.154: WARN/RecognitionService(350): at java.lang.Thread.run(Thread.java:1060)
mircea273
Freshman
Freshman
 
Posts: 2
Joined: Tue Dec 22, 2009 3:15 pm

...

Postby mircea273 » Wed Dec 23, 2009 1:44 pm

It seems the microphone line-in is detected with parameters that are not supported. Somebody said it will only work if frequency is 8000. Does anybody have an explanation for this or a workaround? Tried the -audio-in parameter on the emulator but i get the same error. Even when using "none" as the target.
mircea273
Freshman
Freshman
 
Posts: 2
Joined: Tue Dec 22, 2009 3:15 pm

Same issue

Postby vikasnshah » Sat Dec 26, 2009 8:01 am

Here's a thread from another forum which sheds some light.

>
> On Aug 14, 12:06Âpm, David Turner <di...@xxxxxxxxxxx> wrote:
>
>
>
> > It's a current limitation of theemulator'skernel driver that it only
> > supports 8kHz mono audio for recording.
> > Recent changes to the platform image (in Android 1.5) modify the Audio
> > daemon to want 16kHz by default,
> > and hence broke audio recording in theemulator.
>
> > The fix is not trivial unfortunately, because the driver's architecture does
> > not allow for theemulatorto
> > detect whether it should emulate an 8kHz or 16kHz recording mike (and we
> > want to keep a singleemulator
> > binary to support all existing platforms, so breaking 1.0/1.1 for the
> > benefit of 1.5 is not an option currently).
>
> > A correct fix would be to extend the driver to let the emulated hardware
> > what sampling rate it needs, and
> > adapt to it (something theemulatorcan trivially do). This hasn't been
> > fixed yet due to other priorities.
>


So my question is this: do you think you can use a virtual audio device to feed the emulator 8kHZ mono data to make it happy?

Vikas
vikasnshah
Freshman
Freshman
 
Posts: 2
Joined: Sat Dec 26, 2009 7:55 am

Postby zzzzz75 » Sat Dec 26, 2009 5:53 pm

id be happy to feed the emulator 8kHz, i have no clue how to do this
zzzzz75
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Dec 21, 2009 12:08 pm

Top

Doesn't work

Postby vikasnshah » Sat Dec 26, 2009 9:53 pm

I tried using a windows application called Virtual Audio Cable to feed the emulator 8khz mono, to no avail.

Thinking about it further, I realized that the approached won't work. The issue is internal to the interface between the emulator package and the speech recognition package, which is impossible to get at without rebuilding either the emulator or the speech recognition package. Interestingly, another audio requiring apps on the dev phone work fine (sounds recorder). So there might be some kind of workaround if you write a package for the Android phone which presents a virtual audio device INSIDE THE EMULATOR that provides the speech recognition package with what it wants e.g. 16khz audio data. Seems like a lot of work for not a lot of benefit, as this virtual device would only be useful in the emulator itself.
vikasnshah
Freshman
Freshman
 
Posts: 2
Joined: Sat Dec 26, 2009 7:55 am

Postby zzzzz75 » Sat Dec 26, 2009 10:45 pm

thanks
i actually wrote a recorder which works really well, this is very frustrating as i really need the recognition API
do you know of any other emulators that may support this?
zzzzz75
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Dec 21, 2009 12:08 pm

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 8 guests