Class: WebAudioTextToSpeech

WebAudioTextToSpeech

new WebAudioTextToSpeech()

Members

_basePluginName

_defaultCtxName

When specifying the implementation file for an Audio Module Context i.e. {"mod": "webAudioTextToSpeech.js", "ctx": CONTEXT} then plugin configuration will be check, if there is an entry for the ctx, i.e. an implementation file name for entry ctx: "webAudioTextToSpeech": { CONTEXT: IMPLEMENTATION_FILE_ENTRY }, Otherwise the plugin configuration's default entry will be used "webAudioTextToSpeech": { CONTEXT: _defaultCtxName }, If no default entry exists, then _defaultImplFile will be used as implementation.
Default Value:
  • "default"

_defaultImplFile

Default implementation for WebAudioTTS: MARY TTS

_instance

protected_loggermmir.Logger

Will be set when specific implementation is initialized.
See:

protected_pluginName

Will be set/"overwritten" by specific implementation.
See:

audioArrayArray.<AudioImpl>

internal field for list of "sentence audio-object". Used in ttsSentenceArray

bufferSize

number of audio-objects that should be pre-fetched/buffered when in sentence-mode.

commandQueue

command-queue in case TTS is currently in use -> if TTS invoked, but currently not ready: add to queue -> after processing current TTS: process next on queue

protectedcreateAudio

Will be set/"overwritten" by specific implementation.

EMPTY_SENTENCE

Placeholder for empty text / sentences: no audio will be created for empty text/sentences, but using this placeholder-audio, pause-durations etc will be applied (e.g. during sentence-mode).

firstSentence

protectedgetLanguages

Will be set/"overwritten" by specific implementation.

protectedgetVoices

Will be set/"overwritten" by specific implementation.

isLoading

isReady

loadIndex

pauseDuration

In sentence mode: pause (in milli-seconds) between reading sentences.

playIndex

sentenceArrayArray.<String>

internal field for list of (text) sentences to be played. Used in ttsSentenceArray

ttsMediaAudioImpl

internal field for single-sentence audio-object. Used in ttsSingleSentence

volume

Methods

_resetCallbacks()

addToCommandQueue()

command-queue
See:

clearCommandQueue()

command-queue

currentFailureCallback()

getSpeechLanguages()

See:

getVoiceParam()

See:

onEndCallback()

onReadyCallback()

playNextAfterPause()

processNextInCommandQueue()

command-queue

setTextToSpeechVolume()

See:
Deprecated
  • use tts instead

    tts(options, onPlayedCallback, failureCallback, onReadyCallback)

    Synthesizes ("read out loud") text.
    Name Type Description
    options String | Array.<String> | PlainObject optional OPTIONAL if String or Array of Strings 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 a PlainObject, 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 with options.success, this argument will supersede the options
    failureCallback function optional OPTIONAL callback that is invoked in case an error occurred:
    failureCallback(error: String | Error)

    NOTE: if used in combination with options.error, this argument will supersede the options
    onReadyCallback 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 with true (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 with options.ready, this argument will supersede the options
    See:

    ttsSentenceArray()

    ttsSingleSentence()