Android speech recognize prompt by audio instead of just text -


currently have working speech recognition recognizerintent.extra_prompt shown text on mobile on wearable watch.

is there way or other option make prompt speak (play audio)?

have tried voiceinteraction api limited picking option , have start through 1 of system voice command.

    private static final int speech_request_code = 0;   // create intent can start speech recognizer activity     private void displayspeechrecognizer() {         intent intent = new intent(recognizerintent.action_recognize_speech);         intent.putextra(recognizerintent.extra_language_model, recognizerintent.language_model_free_form);         intent.putextra(recognizerintent.extra_prompt, "how can you?");         // start activity, intent populated speech text         startactivityforresult(intent, speech_request_code);     }      // callback invoked when speech recognizer returns.     // process intent , extract speech text intent.     @override     protected void onactivityresult(int requestcode, int resultcode,                                     intent data) {         if (requestcode == speech_request_code && resultcode == result_ok) {             list<string> results = data.getstringarraylistextra(                     recognizerintent.extra_results);             string spokentext = results.get(0);             log.d(tag, "spokentext: " + spokentext);             // spokentext         }         super.onactivityresult(requestcode, resultcode, data);     } 

i think on track. have use voice interaction api have voice interaction, google voice actions recognizes many spoken , typed action requests , creates android intents them.

according video recording voice interaction api:

whether app uses system or custom voice actions, there might times when app ask user follow-up question before performing action. example, after music app launches when user says “play music”, may want ask user “what genre?” or when home automation app hears user “ok google, turn on lights”, might want ask “which room?” voice interaction api lets android m apps ask follow-up questions these.

in codelab, you'll learn how add voice interactions app voice interaction api. voice interaction api allows users of app confirm actions , select list of options using voice.

note:

the google voice interaction api lets activity interact user using speech input that:

  • confirms action (for example, "are sure?")
  • selects list of options

helpful references:


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -