mmir.env.media.WebAudioTextToSpeech
Members
-
readonly_basePluginName
-
- Default Value:
- "audiotts"
-
readonly_defaultImplFile
-
Default implementation for WebAudioTTS: MARY TTS
- Default Value:
- "ttsMary.js"
-
protected_loggermmir.tools.Logger
-
Will be set when specific implementation is initialized.
- See:
-
initImpl
-
protected_pluginName
-
Will be set/"overwritten" by specific implementation.
- See:
-
initImpl
-
bufferSize
-
number of audio-objects that should be pre-fetched/buffered when in sentence-mode.
-
protectedcreateAudio
-
Will be set/"overwritten" by specific implementation.
-
protecteddestroySynthesizer
-
Will be set/"overwritten" by specific implementation.
-
protectedgetLanguages
-
Will be set/"overwritten" by specific implementation.
-
protectedgetVoices
-
Will be set/"overwritten" by specific implementation.
-
protectedinitSynthesizer
-
Will be set/"overwritten" by specific implementation.
Methods
-
staticmmir.env.media.WebAudioTextToSpeech.initialize()
-
-
cancelSpeech()
-
Cancel current synthesis.
-
destroySpeech(successCallback, failureCallback)
-
Destroy the speech synthesizer instance and free up system resources. NOTE: may not be supported by all synthesizer implementations (e.g. if the impl. does not block system resources etc) IMPORTANT: pluins that support destroySpeech() should also support initializeSpeech().
Name Type Description successCallback
function optional callback in case of success: successCallback(didDestroy: boolean)
in case, the plugin does not support destroySpeech(),successCallback(false)
will be invokedfailureCallback
function optional callback that will be invoked in case of an error: failureCallback(error)
- See:
-
getSpeechLanguages()
-
get list of supported languages for TTS (may not be supported by all plugins).
-
getVoices(options, successCallback, failureCallback)
-
get list of supported voices for TTS (may not be supported by all plugins).
Name Type Description options
String | VoiceOptions optional OPTIONAL if String, the language code (optionally with country code) for which the voices should be listed. if VoiceOptions: options.language: {String} OPTIONAL the language code options.details: {Boolean} OPTIONAL if TRUE the returned list contains VoiceDetail objects with {name: STRING, language: STRING, gender: "female" | "male" | "unknown"} successCallback
function the success callback: successCallback(Array ) failureCallback
function the error callback: failureCallback(err) -
initializeSpeech(successCallback, failureCallback)
-
Re-initialize the speech synthesizer instance: should be called after invoking
destroySpeech()
(and its success-callback returned
true
) before continuing to use the synthesizer instance. NOTE: may not be supported by all synthesizer implementations IMPORTANT: pluins that support initializeSpeech() should also support destroySpeech().Name Type Description successCallback
function optional callback in case of success: successCallback(didDestroy: boolean)
in case, the plugin does not support initializeSpeech(),successCallback(false)
will be invokedfailureCallback
function optional callback that will be invoked in case of an error: failureCallback(error)
- See:
-
setTextToSpeechVolume(newValue)
-
Set the volume for the speech synthesis (text-to-speech).
Name Type Description newValue
Number TODO specify format / range -
textToSpeech()
-
- Deprecated
- use
tts
instead
- use
-
tts(options, onPlayedCallback, failureCallback, onReadyCallback)
-
Synthesizes ("read out loud") text.
Name Type Description options
String | Array.<String> | PlainObject optional OPTIONAL if String
orArray
ofString
s synthesizes the text of the String(s).
For an Array: each entry is interpreted as "sentence"; after each sentence, a short pause is inserted before synthesizing the the next sentence
for aPlainObject
, the following properties should be used:{ text: String | String[], text that should be read aloud , pauseDuration: OPTIONAL Number, the length of the pauses between sentences (i.e. for String Arrays) in milliseconds , language: OPTIONAL String, the language for synthesis (if omitted, the current language setting is used) , voice: OPTIONAL String, the voice (language specific) for synthesis; NOTE that the specific available voices depend on the TTS engine , success: OPTIONAL Function, the on-playing-completed callback (see arg onPlayedCallback) , error: OPTIONAL Function, the error callback (see arg failureCallback) , ready: OPTIONAL Function, the audio-ready callback (see arg onReadyCallback) }
onPlayedCallback
function optional OPTIONAL callback that is invoked when the audio of the speech synthesis finished playing: onPlayedCallback()
NOTE: if used in combination withoptions.success
, this argument will supersede the optionsfailureCallback
function optional OPTIONAL callback that is invoked in case an error occurred: failureCallback(error: String | Error)
NOTE: if used in combination withoptions.error
, this argument will supersede the optionsonReadyCallback
function optional OPTIONAL callback that is invoked when audio becomes ready / is starting to play. If, after the first invocation, audio is paused due to preparing the next audio, then the callback will be invoked with false
, and then withtrue
(as first argument), when the audio becomes ready again, i.e. the callback signature is:onReadyCallback(isReady: Boolean, audio: IAudio)
NOTE: if used in combination withoptions.ready
, this argument will supersede the options