I want to introduce a new feature into my app: permanent voice recognition.
First of all I followed these posts:
Voice recognition
Speech recognition in Android
Offline Speech Recognition In Android (JellyBean)
and more others, plus other posts from different websites.
Problem:
What actually I'm trying to do is to have a permanent voice recognition without displaying google's voice activity. For example: When I start the application the voice recognition should start and listen. When the recognizer matches some words then my app will do different actions accordingly. I do not like to press a button every time I want to do voice recognition, and also I do not like to appear anything on the screen to talk to. Can I do that?
Any suggestions are welcome. Thank you! :)
Android can use voice recognition without any GUI. You can use SpeechRecognizer class to do this. But google doesn't allow you to use theirs voice tools for long time recognition. After 5-7 seconds of silence it will be stopped.
If you want to use limited comands vocabulary, you can use offline continious recognition like PocketSphinx.
For long time recognition you can use:
intent.putExtra("android.speech.extra.DICTATION_MODE", true);
Related
I'm trying to make an alarm clock Android app that could be stopped with voice recognition.
For that, I'm using the Google Speech Recognition API (+ this code to do voice recognition continuously).
It works fine, until I play music at the same time. The voice recognition becomes way less efficient in this case.
This problem is logical, since the music adds some noise which makes recognition harder. But since the music played is known, I was wondering if it was possible to tell Google to try to ignore these additional noise. I know there exists some filter in signal processing to do that (like Kalman filter or Wiener filter).
So my question is:
Is it possible to apply a filter with Google voice recognition to ignore a known noise? Or is there another voice recognition library that allows that?
Edit: It's not a duplicate, since the problem is not the same. But interesting suggestion though.
Google Voice Recognition will already be optimised to detect speech, regardless of any background ambient noise 'type'.
Rather than using Google's native Voice Recognition, supplied via their 'Now/Assistant' application, you can use their Cloud Speech API which offers some enhancements.
The recognizer is designed to ignore background voices and noise
without additional noise-canceling. However, for optimal results,
position the microphone as close to the user as possible, particularly
when background noise is present.
The above is no doubt true generally across their Voice Recognition System.
Use word and phrase hints to add names and terms to the vocabulary and
to boost the accuracy for specific words and phrases.
For short queries or commands, use StreamingRecognize with
single_utterance set to true. This optimizes the recognition for short
utterances and also minimizes latency.
https://cloud.google.com/speech/docs/best-practices
I have implemented the pocketsphinx keyword spotting tool in my app and have it running in a sticky service. Keyword spot works great! The problem is that i can no longer use anything related to google speech while it's running (navigation, camera, video, speech to text). Does anybody have any suggestions on how to make them play nicely together?
Or even some kind of receiver for anything related to google speech so that I know to cancel sphinx?
Android to date doesn't provide any way to arbitrate microphone access.
See for details https://code.google.com/p/android/issues/detail?id=61643
You can stop the recognizer in onStop when activity stops.
I'm using voice speech recognition from Android API.
I followed successfully this tutorial:
http://code4reference.com/2012/07/tutorial-android-voice-recognition/#comment-335
But I've an unsolved question.
How cain I remove the screen that appear when calling RecognizerIntent??
I'm talking about removing google and microphone button that advice that I'm using speech recognition.
I need to remove this small screen because I need to do other things on screen while that is recognizeing my voice.
You need to write a service class that call createSpeechRecognizer. You can get an idea of how to do it in my answer at Android Speech Recognition as a service on Android 4.1 & 4.2
You'd need to work at a lower level than this example. What this example does is launch an app that does voice recognition for you and sends you the results. That app is drawing the UI, and you can't stop it. What you'd need to do is write an app against the service that actually does the voice recognition (basicly, exactly what that intent is doing). You can probably find an example of this in the Android keyboard code, as they provide a custom UI against Google voice.
You cannot do this. The screen is not displayed by your app, but is displayed by the voice recognition API instead, and you cannot control it.
In any case, that screen is a standard for voice recognition on the device, and users are familiar with it. It would be something of an anti pattern to remove it and conduct voice recognition. With the screen there, users will know that voice recognition is active, and that the microphone is picking up sound as it provides that feedback.
Use SpeechRecognizer. The Intent mechanism is similar.
For convienience use the recognizeDirectly method in this helper class
my app uses the RecognizerIntent to record the user's voice and doing some speech recognition.
Now, I'd like to compare the results to some open source speech recognition engines. Most of them take an audio file as input. My thought was, to capture the sound from the Android's microphone, and start the RecognizerIntent at the same time. But it seems, that accessing the microphone is exclusive.
Is it possible to use the RecognizerIntent with a recorded audio stream?
Is it possible to access the microphone simultaneously with two Activites?
I have tried to find a solution to the same problem and have not had success. One other approach we explored was to access the web service that Google uses for recognition. I posted a question at Google's voice search speech recognition service, but it still goes unanswered.
There was a good post at Voice recognition on android with recorded sound clip? that dealt with this question and I believe the answer came from a Google employee.
Unfortunately the answer to both of your questions is no, but there are plans to extend this for Gingerbread and 3.0: http://www.mobiclue.com/android-3-0-gingerbread-features-supported-phones.html
I know for sure that is possible to use RecognizerIntent and save the audio, the question is how?
You can see in Google Keep Android applications doing it once you click in the microphone.
I am aware of android's voice recognition capabilities but I have seen some applications like vligo for example that are able to detect a given sentence, how is this possible? as far as I know you can't set up android's api to do that.