Documentation

Text To Speech

Description

Text To Speech module allows the user to play voice from the text in many languages, as well as supplies a dedicated screen reader. To achieve that, it takes advantage of the Web Speech API provided by the user's internet browser.

If you want to connect the Text to Speech addon to player you have to set it's ID to: Text_To_Speech1 . Only one Text_To_Speech module should be present on the page.

Properties

The list starts with the common properties, learn more about them by visiting the Modules description section. The other available properties are described below.

Property name Description
Enter Text Text on entering WCAG navigation
Exit Text Text on exiting WCAG navigation
New Page Text played on entering the page while in WCAG navigation. The content of this property will be followed by the title of the page, for example "New page: Page 1". The default value is "New page".
Page title language Language tag used when playing the title of the page (but not the contents of the "New page" property) after entering it while in WCAG navigation. By default, the lesson's language tag will be used.
Configuration List of modules with parameters: ID, Area and Title. When moving between modules using the Tab button in WCAG navigation, the next module will be determined based on the order in which they are listed in this property.
ID ID of the module
Area Name of the area the module is in. Takes one of three values: Main, Header or Footer
Title Text played on selecting the module. This will not be played on entering the WCAG navigation.

There is also an additional property that can be found in the lesson's Settings:

Property name Description
Lang attribute Tag of the language to be used by the lesson. This language will be used whenever a given module does not specify a different tag, as well as when playing the enter text, exit text (defined in 'Enter Text' and 'Exit Text' properties), module's title (defined in 'Title' property) and module's speech texts (defined in 'speech texts' property. More information in the 'Supported modules' section).

Supported commands

Command name Params Description
hide --- Hides the module.
show --- Shows the module.
playTitle area, id, langTag Play module's title from given id. langTag parameter is optional.
speak text, langTag Play provided text. langTag parameter is optional.
playEnterText --- Play enter text (defined in the Enter Text property)
playExitText --- Play exit text (defined in the Exit Text property)
getModulesOrder --- returns list of module ids in correct order

Supported modules:

The list of the modules supported by the Text To Speech module can be found in the documentation.

Supported modules typically will have the following properties:

Property name Description
Lang attribute Tag of the language this module is using (more information in the 'Languages' section). If this value is empty, the lesson's language tag will be used.
Speech texts A list of speech texts to be used. Speech texts are used to provide various additional information and context about the contents of a module (For example, if a module allows for checking it's answers, it might have 'Correct', 'Wrong' and 'Empty' speech texts). Speech texts are always played using the lesson's language (as defined in lesson Setting's 'Lang attribute' property), regardless of the language used by the module.

Additionally, all modules accessible through the WCAG navigation can be added to the list of modules in the Configuration property. However, these modules do not offer any additional TTS functionality beyond reading their title (defined in the Title property).

Browser support

It is important to note that the speech synthesis is a new functionality provided by the user's internet browser. Because of that, Text To Speech module might not work properly on older browsers, and not all languages might be available on all browsers. Internet browsers known to support speech synthesis functionality are listed below:

Desktop

  • Chrome (since version 33)
  • Edge
  • Firefox (since version 49)
  • Safari (since version 7)

Mobile

  • Android
  • Chrome
  • Edge
  • Firefox OS (since version 2.0)
  • Safari Mobile (since version 7.1)

Languages

The available languages, their speech synthesizer voices, as well as tags used to identify them, depend on the end user's operating system, internet browser, any additional libraries they may have installed and their internet connection (some voices are only available remotely and will not work properly without stable internet connection). You can check what languages are available to you on your browser using the following script (use this download link or run the script below by clicking here).

Using the full tag is not always necessary. Listed below are shortened tag, along with full tags they abbreviate.

Shortened tag SpeechSynthesis tag
de de-DE
en en-US
pl pl-PL

Responsive Voice

This addon works with the Responsive Voice library. The library is active after attaching the script. In the lesson edition (Presentation > Preferences), the "Responsive Voice languages" field has been added for entering pairs - language code : full language name. For proper operation, the field must be formatted in JSON style. Example:

{
"en-GB": "UK English Female",
"de-DE": "Deutsch Female"
}

List of available languages ​​can be found on the Responsive Voice website

Downloading the language used for reading - first, the language is downloaded from the "Responsive Voice languages" field, if the language code does not match any available there, language is downloaded from the Responsive Voice library database. Finally, the default language is selected - UK English Male.

Demo presentation

Demo presentation contains examples on how to use the Text To Speech addon.