Class: Speechify

Speechify()

Class that spechifies text inputs and highlights the text while speaking. Reference: https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis

Constructor

new Speechify()

Constructor function. Initializes the Speechify object. Also initializes the window.speechifyReady global flag.

Source:

Members

voice

Source:

voice

Source:

voices

Source:

Methods

_init()

Load SpeechSynthesis voices

Source:

(async) checkBrowserSupport() → {boolean}

Source:
Returns:

True if the browser supports speech synthesis

Type
boolean

(async) getVoiceNames() → {Promise}

Source:
Returns:

Promise that resolves to an array of voice names as strings

Type
Promise

makeReady()

Set global variable speechifyReady to true

Source:

(async) play(audio) → {Promise.<SpeechSynthesisEvent>}

Parameters:
Name Type Description
audio SpeechSynthesisUtterance

The audio to be played

Source:
Returns:

Promise that resolves when the audio is done playing

Type
Promise.<SpeechSynthesisEvent>

reset()

Cancel all speechify audio sequence

Source:

resetHighlight()

Remove all speechify text highlighting

Source:

(async) selectVoiceName(voiceName)

Parameters:
Name Type Description
voiceName string

The name of the voice to be selected

Source:

speechify(text)

Parameters:
Name Type Description
text string

The text to be speechified

Source:

speechifyHighlight(element)

Speechify the the innerHTML of an element and highlight the text while speaking.

Parameters:
Name Type Description
element obj

DOM element to speechify and highlight text

Source:

terminate()

Remove all speech audio and text highlights

Source: