2

I would be interested in making an app Android that starts functions with vocal commands (example: instead of clicking on the button, use a voice command). My idea was to use speech recognition to store a result in a variable, and if the result corresponds to a keyword set, the function is started.

The questions I have are two:

  • How to start within an app speech recognition using a voice command?
  • How to make to use the speech recognition result for my purposes? Thanks for your help
UmAnusorn
  • 10,420
  • 10
  • 72
  • 100

2 Answers2

0

You can use Android SpeechRecognizer

This service allows access to the speech recognizer. Do not instantiate this class directly, instead, call createSpeechRecognizer(Context) This is the easiest way to implement built-in speech recognition. This way will return multiple answer.

For example, you say "bat". The voice recognition will come with answer "bat", "bad", "brat" ... However, you can choose the best answer which is in the first index.

SpeechRecognizer Document

Another new feature "Google Voice Action" This feature will allow Google Now to call and pass data to your app.

You can also begin with a sample code from github e.g.

Speech-Recognition-Tutorial---LightBulb-Example

SpeechRecognitionView

UmAnusorn
  • 10,420
  • 10
  • 72
  • 100
0

For your first question, I'd consider using PocketSphinx for Android for the first part. I was able to use it for continuous, offline wake word recognition. Then for the actual command the user is giving, I switched to a cloud based solution (IBM's Watson in my case).

See https://cmusphinx.github.io/wiki/tutorialandroid/ for details on PocketSphinx.

For your second question, it depends on the solution you use. Most solutions I've seen return the text to you along with confidence ratings and possible alternatives.