mmir.env.media.WebspeechAudioInput
Classes
Members
-
protected,readonly_pluginName
-
- Default Value:
- "webspeechAudioInput"
Methods
-
cancelRecognition()
-
getRecognitionLanguages()
-
initialize()
-
-
recognize()
-
Start speech recognition with end-of-speech detection: the recognizer automatically tries to detect when speech has finished and triggers the status-callback accordingly with results.
NOTE: no end event, if recognize() is stopped via stopRecord()
-
asyncstartRecord(options, statusCallback, failureCallback)
-
Start speech recognition (without end-of-speech detection): after starting, the recognition continues until
stopRecord
is called.Name Type Description options
PlainObject optional OPTIONAL options for Automatic Speech Recognition: { success: OPTIONAL Function, the status-callback (see arg statusCallback) , error: OPTIONAL Function, the error callback (see arg failureCallback) , language: OPTIONAL String, the language for recognition (if omitted, the current language setting is used) , intermediate: OTPIONAL Boolean, set true for receiving intermediate results (NOTE not all ASR engines may support intermediate results) , results: OTPIONAL Number, set how many recognition alternatives should be returned at most (NOTE not all ASR engines may support this option) , mode: OTPIONAL "search" | "dictation", set how many recognition alternatives should be returned at most (NOTE not all ASR engines may support this option) , eosPause: OTPIONAL "short" | "long", length of pause after speech for end-of-speech detection (NOTE not all ASR engines may support this option) , disableImprovedFeedback: OTPIONAL Boolean, disable improved feedback when using intermediate results (NOTE not all ASR engines may support this option) }
statusCallback
function optional OPTIONAL callback function that is triggered when, recognition starts, text results become available, and recognition ends. The callback signature is: callback( text: String | "", confidence: Number | Void, status: "FINAL"|"INTERIM"|"INTERMEDIATE"|"RECORDING_BEGIN"|"RECORDING_DONE", alternatives: Array<{result: String, score: Number}> | Void, unstable: String | Void )
Usually, for status"FINAL" | "INTERIM" | "INTERMEDIATE"
text results are returned, where"INTERIM": an interim result, that might still change "INTERMEDIATE": a stable, intermediate result "FINAL": a (stable) final result, before the recognition stops
If present, theunstable
argument provides a preview for the currently processed / recognized text.
NOTE that when usingintermediate
mode, status-calls with"INTERMEDIATE"
may contain "final intermediate" results, too.
NOTE: if used in combination withoptions.success
, this argument will supersede the optionsfailureCallback
function optional OPTIONAL callback function that is triggered when an error occurred. The callback signature is: callback(error)
NOTE: if used in combination withoptions.error
, this argument will supersede the options -
stopRecord()