From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png

Release status:Extension status beta

Wikispeech logo.svg
ImplementationTemplate:Extension#type other (invalid type)
DescriptionTemplate:Extension#description Integrates Wikispeech into MediaWiki for text-to-speech functionality
  • Sebastian Berlin
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
  • $wgWikispeechServerUrl
  • $wgWikispeechRemoveTags
  • $wgWikispeechNamespaces
  • $wgWikispeechKeyboardShortcuts
  • $wgWikispeechSkipBackRewindsThreshold
Hooks usedTemplate:Extension#hook

Translate the Wikispeech extension if it is available at translatewiki.net

Check usage and version matrix.
Vagrant roleMediaWiki-Vagrant#Using roles wikispeech


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. Stable release is planned for 2017.

User guide[edit]

See Help:Extension:Wikispeech.


For the General User:

For the Advanced User:

Setting up Wikispeech[edit]

These are the instructions to install the TTS server on wmflabs.org.

Creating an instance[edit]

Follow instructions on https://wikitech.wikimedia.org/wiki/Help:Instances#Creating_an_instance:

  1. Log in to https://horizon.wikimedia.org and go to the wikispeech project (in top bar).
  2. ComputeOverview and check that there are instances available.
  3. Create a Security Group:
    • ComputeAccess & SecurityCreate Security Group; Name: TTS-provider
      • Manage RulesAdd Rule; Port: 10000, Remote: CIDR, CIDR:
  4. Open Launch Instance dialogue (ComputeInstancesLaunch Instance):
    1. Details: only set Instance Name: wikispeech-tts
    2. Source: Select boot source: Image, under Available: add ubuntu-14.04-trusty
    3. Flavor: Under Available: add m1.medium (marytts uses ~ 1.1 GB on local machine)
    4. Security Groups: Under Available: add default, TTS-provider, web-server
  5. Make services accessible through proxy, DNSWeb proxiesCreate proxy
    1. Hostname: wikispeech-tts, Backend instance: wikispeech-tts, Backend port: 10000
    2. Hostname: wikispeech-tts-audio, Backend Instance: wikispeech-tts, Backend port: 80

To ssh to the new instance, see: https://wikitech.wikimedia.org/wiki/Help:Getting_Started#Project_Instances

Install TTS server[edit]

The TTS server consists of three components: MaryTTS (TTS platform), pronlex (a pronunciation lexicon database) and wikispeech_mockup (wikispeech API).

Install MaryTTS[edit]

  1. Log into wikispeech-tts
  2. Install java: $ sudo apt install openjdk-8-jdk (Java 8 is needed for Arabic. If it can't be installed the normal way, see https://askubuntu.com/questions/464755/how-to-install-openjdk-8-on-14-04-lts/464894#464894 under, Original Message)
  3. Create a user to run the server: $ sudo useradd -m tts-agent -p <password>
  4. Become this user: $ sudo su - tts-agent
  5. Clone marytts-installer repo: $ git clone https://github.com/marytts/marytts-installer.git
  6. Follow instructions to install English voices
  7. To install Swedish and Arabic:
    1. $ cd marytts-installer/installed
    2. $ wget https://github.com/HaraldBerthelsen/marytts/releases/download/v5.9-alpha/marytts-lang-sv-6.0-SNAPSHOT.jar
    3. $ wget https://github.com/HaraldBerthelsen/marytts/releases/download/v5.9-alpha/voice-stts_sv_nst-hsmm-5.2.jar
    4. $ wget https://github.com/HaraldBerthelsen/marytts-lang-ar/releases/download/v0.1-alpha/marytts-lang-ar-6.0-SNAPSHOT.jar
    5. $ wget https://github.com/HaraldBerthelsen/voice-ar-nah-hsmm/releases/download/v5.2/voice-ar-nah-hsmm-5.2.jar

Install pronlex[edit]

Follow the instructions at https://github.com/stts-se/pronlex/tree/master/install/standalone.

Install wikispeech_mockup[edit]

Following instruction at https://github.com/stts-se/wikispeech_mockup.

Install Mishkal (for Arabic)[edit]

  1. $ cd ~/marytts-installer/installed
  2. wget http://repo1.maven.org/maven2/org/glassfish/javax.json/1.0.4/javax.json-1.0.4.jar
  3. $ cd ~
  4. git clone https://github.com/linuxscout/mishkal.git
  5. $ cd mishkal
  6. In mishkal/tashkeel/tashkeel.py, change line 385 from:
    • vocalized_text = u" ".join([vocalized_text, self.display(word, format_display)])
    • to:
    • vocalized_text = u" ".join([vocalized_text, self.display(voc_word, format_display)])
  7. Run webserver with: $ python interfaces/web/mishkal-webserver.py

Make audio files accessible[edit]

  1. Install apache: $ sudo apt install apache2
  2. Link the audio file directory in /var/www/html: $ cd /var/www/html && sudo ln -s ~/wikispeech_mockup/wikispeech_mockup/tmp/ audio

Audio files generated by the TTS should now be accessible through: http://wikispeech-tts-audio.wmflabs.org/audio/.

  • Disallow access to non-opus files by adding a .htaccess-file in ~/wikispeech_mockup/wikispeech_mockup/tmp/ with the following content
<FilesMatch "\.*$">
  Deny from all
<FilesMatch "\.opus$">
  Order deny,allow
  Allow from all
  • Remove directory listing by adding a index.html file in ~/wikispeech_mockup/wikispeech_mockup/tmp/ with something like the following content:

This is a service to serve Wikispeech audio files. There is really never any reason to see this page.

  • To also display this page in the root directory (instead of apache default): $ cd /var/www/html/ && sudo rm index.html && sudo ln -s audio/index.html

Update the server with the new path[edit]

In ~/wikispeech_mockup/wikispeech_mockup/wikispeech.py, in synthesise(), change:

audio_url = "%s/%s/%s" % (hostname,config.config.get("Audio settings","audio_url_prefix"),opus_audio)


audio_url = "%s/%s/%s" % ("//wikispeech-tts-audio.wmflabs.org",config.config.get("Audio settings","audio_url_prefix"),opus_audio)

Start processes in screen[edit]

As user tts-agent:

  1. $ script /dev/null, needed to get screen running (http://serverfault.com/a/116830)
  2. $ screen
  3. Start MaryTTS
    1. $ cd ~/marytts-installer/
    2. $ ./marytts
  4. Create new window: Ctrl+a, c
  5. Start pronlex
    1. $ cd ~/go/src/github.com/stts-se/pronlex/lexserver/
    2. $ go run *.go
  6. Create new window
  7. Start wikispeech.py
    1. $ cd ~/wikispeech_mockup/
    2. $ python3 wikispeech.py

You can now detach the screen Ctrl+a, d and resume with $ screen -r. Note that $ script /dev/null is required to run screen each time you become tts-agent.

Basic configuration for MediaWiki-Wikispeech[edit]

Complete list of configuration options[edit]

Option Default value Documentation
The URL for the TTS server to use.
    "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.
List of the namespaces, for which Wikispeech is activated, using constant names.
    "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.


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.

Setting Wikispeech up on shared hosting[edit]

See Extension:Wikispeech/Installation on a shared host


See also[edit]