git clone https://github.com/stts-se/wikispeech-server.git
cd wikispeech-server
sudo apt install opus-tools python3-pip
sudo pip3 install -r requirements.txt
mkdir wikispeech_server/tmp
Normally, python3-setuptools
should be installed automatically as a dependency for python3-pip
, but some cases have been reported where you need to install this separately (debian-9.1):
sudo apt install python3-setuptools
python3 bin/wikispeech
For local configuration, make a copy of wikispeech_server/default.conf,
name it <username>-<hostname>.conf
, and edit it as needed.
The file contains settings for:
- Server
- server port (default: 10000)
- log_level (default: warning)
- logger (default: stderr, possible settings: stderr, stdout, syslog, filename)
- flask_debug_mode: python flask setting to reload when files are edited. (default: False)
- Voice config
- config_files_location: Folder for config files (default: wikispeech_server/conf)
- config_files: A list of voice config files to load
- Audio settings
- audio_tmpdir: output directory for soundfiles. This directory needs to exist. (default: ./wikispeech_server/tmp)
- Services
- lexicon: url to lexicon server. (default: http://localhost:8787)
- mapper: url to symbol set mapper server. (default: http://localhost:8771)
- marytts: url to marytts server. (default: http://localhost:59125/process)
- ahotts: various configs for ahotts server. (default: http://localhost:1200)
- Tests
- run_startup_test: Run or don't run a lot of tests - they may fail if configuration is incorrect, or lexicon/marytts servers are not found. (default: True)
- quit_on_error: Quit if a test fails. (default: False)
To test the config file, the script can be run with a config file as argument:
python3 bin/wikispeech <config-file>
If you are developing for Wikispeech, and need to make changes to this repository, make sure you run a test build using build_and_test.sh
before you make a pull request. Don't run more than one instance of this script at once, and make sure no wikispeech servers are already running on the default ports.
google-chrome test.html
(may not work to load the audio, depends on setup)
google-chrome "http://localhost:10000/"
(for usage information)
google-chrome "http://localhost:10000/?lang=sv&input=Ett+test"
(example api call)
started in https://github.com/stts-se/wikispeech-server/wiki
Link the audio file directory in <webroot>
, as defined in default.conf or your local configuration file:
$ cd <webroot>; sudo ln -s <audio_tmpdir> <audio_url_prefix>
example:
$ cd /var/www/html; sudo ln -s ~/git/wikispeech-server/wikispeech_server/tmp/ audio
Audio files generated by the TTS should now be accessible through: http://localhost/audio/ and from outside at http://<HOSTNAME>/audio
Disallow access to non-opus files by adding a .htaccess-file <audio_tmpdir>
with the following content
<FilesMatch "\.*$">
Deny from all
</FilesMatch>
<FilesMatch "\.opus$">
Order deny,allow
Allow from all
</FilesMatch>
Remove directory listing by adding a index.html file in <audio_tmpdir>
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
To access the wikispeech server through apache: Add something like this to your apache config file (for example "/etc/apache2/sites-enabled/000-default.conf") and restart apache (for example with "sudo apache2ctl restart"). You may need to run "sudo a2enmod proxy" and "sudo a2enmod proxy_http" first.
ProxyPreserveHost On
ProxyPass /wikispeech/ http://127.0.1.1:10000/
ProxyPassReverse /wikispeech/ http://127.0.1.1:10000/
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /ws_service/ http://127.0.1.1:8787/
ProxyPassReverse /ws_service/ http://127.0.1.1:8787/
ProxyRequests Off
Link this directory in apache's document root, for example:
cd /var/www/html; sudo ln -s ~/git/wikispeech-server
Test:
google-chrome http://localhost:10000/test.html
google-chrome http://localhost:10000/workflow_demo/test.html
This work was supported by the Swedish Post and Telecom Authority (PTS) through the grant "Wikispeech – en användargenererad talsyntes på Wikipedia" (2016–2017).