Skip to content
English
  • There are no suggestions because the search field is empty.

How to Change the Speed of the Assist Text-to-Speech Function?

Overview

In Assist, the speed of the text-to-speech function can be adjusted with an additional script for specific languages. This article explains how the reading speed is automatically changed as soon as the text-to-speech function is activated. The example provided refers to the English language and can be applied to other languages as well.


Requirements

  • Assist is already correctly integrated on your website.

  • The following script complements the existing Assist integration code.

  • The code must be inserted below the Assist integration code.


How the Adjustment Works

The script listens for an Assist event.

Once the text-to-speech function is activated, Assist checks the language of your website.

If the language is English, the current reading speed will be adjusted.


Code for Changing the Reading Speed

Insert the following code below the Assist integration code on your website:

 
<script>
// listen for the eyeable event
document.addEventListener("eyeable:event", function (e) {
// check if dark mode or contrast were enabled
if (e.detail === "Screenreader_Enabled" && document.documentElement.lang.toLowerCase().includes("en")) {
let oldSpeed = eyeAble_getVar("SpeechRate");
let newSpeed = oldSpeed;
if (oldSpeed === 1) {
newSpeed = 0.8;
}
eyeAble_setVar("SpeechRate", newSpeed);
}
});
</script>

Adjustment for Other Languages

The language is detected via the lang attribute in the HTML document. Standard language codes are used for this purpose.

  • English:

    document.documentElement.lang.toLowerCase().includes("en")
  • German:

    document.documentElement.lang.toLowerCase().includes("de")

The respective language code can be adjusted according to the language of your website.