Tuesday 15 April 2014

android - How to use voice recognition and auto write the words -


I am creating a new app and I have to use voice recognition to write words that the user said and Some algorithmic them, which API I will use or a library?

Thanks

Two methods enough for a basic understanding of speech for text conversion Is:

  Private zero prompt icon () {intent = new intent (RecognizerIntent.ACTION_RECOGNIZE_SPEECH); Intent.putExtra (RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); Intent.putExtra (RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault ()); Intent.putExtra (RecognizerIntent.EXTRA_PROMPT, getString (R.string.speech_prompt)); Try {StartActivityForResult (intent, REQ_CODE_SPEECH_INPUT); } Catch (ActivityNotFoundException a) {toast. Make text (getApplicationContext (), getString (R.string.speech_not_supported), toast .LENGTH_SHORT). Show (); }} / ** * Receiving speech input * * / / Overactive Active Result on Intride Protected Z (Int Requestcode, Inc Results, Results Data) {super.onActivityResult (requestCode, Resultscode, Data); Switch (requestcode) {case REQ_CODE_SPEECH_INPUT: {if (resultcode == RESULT_OK & amp; null! = Data) {ArrayList & lt; String & gt; Results = Data .getStringArrayListExtra (RecognizerIntent.EXTRA_RESULTS); TxtSpeechInput.setText (result.get (0)); }         break; }}}  

I can share a complete project which is also available online. Download the sample project from


No comments:

Post a Comment