2

I need to use speech input to insert text. How can i detect keyword when I'm speaking ?

Can i do this with Android Speech Input or I need external library ? Any ideas ?

Thanks

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
enfix
  • 6,680
  • 12
  • 55
  • 80

3 Answers3

2

Absolutely.

See this for some code that detects the "magic word"

Just launch an Intent with ACTION_RECOGNIZE_SPEECH and then check the results for your keyword. Checking for the keyword can be complicated, but this code should get you started.

https://github.com/gmilette/Say-the-Magic-Word-

gregm
  • 12,019
  • 7
  • 56
  • 78
2

Keyword detection task is different from a speech recognition task. While second tries to understand the text being spoken and check all possible word combinations, keyword spotting usually check two hypothesis - word is here or garbage is here. Its way more efficient to check keyword presence but it requires custom algorithm. You can implement one with the open source speech recognition toolkit like CMUSphinx.

http://cmusphinx.sourceforge.net

Which runs on Android too, you can check

Voice command keyword listener in Android

to see how to integrate it.

Community
  • 1
  • 1
Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
  • Can you please help me out in integrating cmusphinx with android. Also, is there any sample code that I can refer to ? – Roshit Jun 18 '12 at 06:40
  • For integration see the tutorial http://cmusphinx.sourceforge.net/2011/05/building-pocketsphinx-on-android/ if you have any questions you are welcome to ask – Nikolay Shmyrev Jun 20 '12 at 09:23
  • cmusphinx do have a keyword spotting implementation now. http://cmusphinx.svn.sourceforge.net/viewvc/cmusphinx/branches/long-audio-aligner/KeyWordSpotting/" – David Salzer Jan 24 '13 at 06:37
  • How do I look for keywords using default android code? – Ruchir Baronia Jan 28 '16 at 00:20
1

I used the Snowboy library for this task
Website: https://snowboy.kitt.ai
Github: https://github.com/kitt-ai/snowboy

It is a C library but it can be included in Android code using the JNI. The only downside to it is that you have to train it with audio samples if you want to use another keyword than the ones that come with the library.

Fredrik Wallén
  • 438
  • 5
  • 13