From MediaWiki.org
Jump to navigation Jump to search
This is the documentation for installing and configuring Wikispeech. If you are looking for help on how to use it, see Help:Extension:Wikispeech.
MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: beta
Wikispeech logo.svg
Implementation Page action , Ajax, API
Description Reads page text out loud using text-to-speech
Author(s) Sebastian Berlin, André Costa, Karl Wettin and Igor Leturia
Latest version 0.1.4 (2020-05-19)
MediaWiki >= 1.35
Database changes Yes
License GNU General Public License 2.0 or later
  • $wgWikispeechSkipBackRewindsThreshold
  • $wgWikispeechSpeechoidUrl
  • $wgWikispeechUtteranceTimeToLiveDays
  • $wgWikispeechNamespaces
  • $wgWikispeechRemoveTags
  • $wgWikispeechFeedbackPage
  • $wgWikispeechVoices
  • $wgWikispeechContentSelector
  • $wgWikispeechHelpPage
  • $wgWikispeechUtteranceFileBackendName
  • $wgWikispeechUtteranceFileBackendContainerName
  • $wgWikispeechKeyboardShortcuts
  • $wgWikispeechListenMaximumInputCharacters
  • $wgWikispeechSegmentBreakingTags
  • wikispeech-listen
Translate the Wikispeech extension if it is available at translatewiki.net
Check usage and version matrix.
Vagrant role wikispeech
Issues Open tasks · Report a bug

The Wikispeech project aims to create an open source text-to-speech tool to make Wikimedia's projects more accessible for people that have difficulties reading for different reasons. Wikispeech will be available as a MediaWiki extension. More information can be found on the project page; this page is just about the Wikispeech extension itself.


Diagram over some typical interaction between the components in Wikispeech.


The extension uses a service for TTS operations, such as creating audio for utterances called Speechoid. Speechoid consists of a main server, a lexicon server, TTS engines and any additional components that may be required for certain languages.

To prepare an utterance for playing, the extension sends a request to the service. This request contains the utterance as text, which language it is in and which voice to use. The service processes the text using a lexicon and one of the installed TTS engines, depending on what voice is being used. Once the audio has been generated, a response is returned with a URL to the audio file along with some information that will enable highlighting and skipping. This is then used by the extension to actually play the utterance to the user and the process is repeated for the following utterances as needed.

Main Wikispeech Server[edit]


The main server has a web API that includes an endpoint for generating speech. It handles internal communication between the underlying servers, listed below.



A lexicon server with its own API. Holds information about lexicon entries and has endpoints for lookup and manipulation of them. When processing an utterance, words are looked up in the lexicon and if there is a matching entry it is used for the pronunciation.

TTS engines[edit]

The server supports having multiple TTS engines. Which one is used for a certain utterance depends on which voice is given in the request.



Comes with support for Arabic, English and Swedish.

Additional Components[edit]



Used to vocalize Arabic text.



Symbolset is a repository for handling phonetic symbol sets and mappers/converters between different symbol sets and languages.


  • Download and place the file(s) in a directory called Wikispeech in your extensions/ folder.
  • Run Composer to install PHP dependencies, by issuing composer install in the extension directory. (See T173141 for potential complications.)
  • Add the following code at the bottom of your LocalSettings.php : wfLoadExtension( 'Wikispeech' );
  • Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Setting up Speechoid[edit]

The Wikispeech extension requires Speechoid to generate audio. Detailed instructions for installing Speechoid can be found on /Installing_Speechoid.

Basic configuration[edit]

For the Wikispeech extension to be able to communicate with Speechoid, you need to specify the service's URL. You can do this by adding the following line to LocalSettings.php :

$wgWikispeechSpeechoidUrl = 'URL';

where URL is the URL to your Speechoid instance.

Complete list of configuration options[edit]

Option Default value Documentation
The URL to use for the Speechoid service.
    "span": "mw-editsection",
    "table": true,
    "sup": "reference",
    "div": [
Map of HTML tags that should be removed completely, i.e. including any content. Keys are tag names and the values determine whether a tag should be removed, as follows:
  • If true, remove all tags of that type.
  • If an array, remove tags whose class matches any of the strings in the array.
  • If false, tags of that type will not be removed. This can be used in LocalSetting.php to override default criteria.
As the text is segmented, segment breaks are added when these tags are encountered. This is useful e.g. for headings, that usually don't trigger segmentation since they're not complete sentences.
List of the namespace indices, for which Wikispeech is activated.
    "playStop": {
        "key": 32,
        "modifiers": [
    "skipAheadSentence": {
        "key": 39,
        "modifiers": [
    "skipBackSentence": {
        "key": 37,
        "modifiers": [
    "skipAheadWord": {
        "key": 40,
        "modifiers": [
    "skipBackWord": {
        "key": 38,
        "modifiers": [
Shortcuts for Wikispeech commands. Each shortcut defines the key pressed (as key code[1]) and any modifier keys (ctrl, alt or shift).
If an utterance has played longer than this (in seconds), skipping back will rewind to the start of the current utterance, instead of skipping to previous utterance.
Help page for Wikispeech. If defined, a button that takes the user here is added next to the player buttons.
"Wikispeech feedback"
Feedback page for Wikispeech. If defined, a button that takes the user here is added next to the player buttons.
The selector for the element that contains the text of the page. Used internally, but may change with MediaWiki version.
    "ar": [
    "en": [
    "sv": [
The voices that will show up in the user settings. Available voices can be found at the /synthesis/voices on the Speechoid service.


This is a subset the CSS rules that are most interesting for a non-developer.

Selector Default values Documentation
background-color: rgb( 200, 170, 255 );
The visual highlighting for the sentence that is currently being recited.
background-color: rgb( 255, 200, 140 );
The visual highlighting for the word that is currently being recited.