Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As far as I know there is still no way to directly send an audio clip to Google for transcription. However, Froyo (API level 8) introduced the <a href="http://developer.android.com/reference/android/speech/SpeechRecognizer.html" rel="nofollow">SpeechRecognizer</a> class, which provides direct access to the speech recognition service. So, for example, you can start playback of an audio clip and have your Activity start the speech recognizer listening in the background, which will return results after completion to a user-defined listener callback method.</p> <p>The following sample code should be defined within an Activity since SpeechRecognizer's methods must be run in the main application thread. Also you will need to add the <a href="http://developer.android.com/reference/android/Manifest.permission.html#RECORD_AUDIO" rel="nofollow">RECORD_AUDIO</a> permission to your AndroidManifest.xml.</p> <pre> <code> boolean available = SpeechRecognizer.isRecognitionAvailable(this); if (available) { SpeechRecognizer sr = SpeechRecognizer.createSpeechRecognizer(this); sr.setRecognitionListener(new RecognitionListener() { @Override public void onResults(Bundle results) { // process results here } // define your other overloaded listener methods here }); Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); // the following appears to be a requirement, but can be a "dummy" value intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, "com.dummy"); // define any other intent extras you want // start playback of audio clip here // this will start the speech recognizer service in the background // without starting a separate activity sr.startListening(intent); } </code> </pre> <p>You can also define your own speech recognition service by extending <a href="http://developer.android.com/reference/android/speech/RecognitionService.html" rel="nofollow">RecognitionService</a>, but that is beyond the scope of this answer :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload