android - How can I pass an audio file as input instead of recorded voice to Google search voice? -
the following code can recognise voice using google voice search when speak microphone.
how can pass audio file input instead of microphone google search voice?
private void startvoicerecognitionactivity() { intent intent = new intent(recognizerintent.action_recognize_speech); intent.putextra(recognizerintent.extra_language_model, recognizerintent.language_model_free_form); intent.putextra(recognizerintent.extra_prompt, "speech recognition demo"); startactivityforresult(intent, voice_recognition_request_code); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == voice_recognition_request_code && resultcode == result_ok) { // fill list view strings recognizer thought have heard arraylist<string> matches = data.getstringarraylistextra( recognizerintent.extra_results); mlist.setadapter(new arrayadapter<string>(this, android.r.layout.simple_list_item_1, matches)); } super.onactivityresult(requestcode, resultcode, data); }
you cannot pass audio file through android speech recognition api (as of android v4.3).
Comments
Post a Comment