Installation & Setup
Relevant source files
The following files were used as context for generating this wiki page:
The Wikispeech server is a Python-based Text-to-Speech (TTS) orchestration layer that integrates various microservices for lexicon lookup, symbol mapping, and speech synthesis. The installation process involves setting up a Python virtual environment, installing system-level dependencies for audio encoding, and configuring connections to various backend engines such as MaryTTS, Piper, or Matcha.
The system relies on opus-tools for audio processing and uses a configuration-driven architecture to manage different voices and text processors across supported languages.
Sources: README.md:1-20, wikispeech_server/wikispeech.py:46-55
Prerequisites and Local Environment Setup
The primary environment for Wikispeech is a Python 3 virtual environment. System-level dependencies include opus-tools, specifically the opusenc utility, which the server checks for during startup.
git clone https://github.com/stts-se/wikispeech-server.git
cd wikispeech-server
sudo apt install opus-tools
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
mkdir wikispeech_server/tmp
Sources: README.md:9-19, wikispeech_server/wikispeech.py:46-55
Core Setup Flow
The following diagram illustrates the sequence of actions required to prepare the server environment:
Sources: README.md:9-25
Configuration Management
Wikispeech uses a hierarchical configuration system. It first looks for a default configuration and then attempts to load a user-specific file based on the system username and hostname.
Configuration File Resolution
The configuration logic in wikispeech_server/config.py follows this priority:
- Command Line Argument: If a path is passed to
bin/wikispeech. - User/Host Config:
wikispeech_server/<user>-<hostname>.conf. - Default Config:
wikispeech_server/default.conf.
Sources: wikispeech_server/config.py:10-38, README.md:27-29
Key Configuration Sections
Configuration is divided into several functional blocks within the .conf files:
| Section | Option | Description |
|---|---|---|
| Server | port | The port the Flask app listens on (Default: 10000). |
| Server | log_level | info, warning, error, or debug. |
| Voice config | config_files | List of JSON files defining textprocessors and voices. |
| Audio settings | audio_tmpdir | Directory for temporary .wav and .opus files. |
| Services | lexicon | URL to the Pronlex/Lexicon server. |
| Services | mapper | URL to the symbol set mapper server. |
| Services | marytts | URL to the MaryTTS process endpoint. |
Sources: wikispeech_server/default.conf:1-33, README.md:31-50
Microservices Integration
The start_wikispeech.sh script automates the initialization of the multi-service architecture. Wikispeech acts as the central hub communicating with specialized servers.
Service Startup Sequence
The start_wikispeech.sh script manages the order of operations to ensure dependencies are available before the main server starts:
- Pronlex: Starts the lexicon server using SQLite.
- Symbolset: Starts the mapper server.
- Wrappers: Initializes Matcha and Piper TTS wrappers.
- Cache Cleanup: Runs
clear_audio_cache.sh. - Main Server: Starts the Flask application after a configurable sleep period (default 20s).
Sources: start_wikispeech.sh:135-170
Deployment and Infrastructure
For production-like environments, the server is often placed behind an Apache proxy. This setup involves linking the temporary audio directory to a webroot and configuring proxy passes.
Apache Proxy Configuration
To expose the Wikispeech API and its generated audio files through Apache, the following proxy settings are utilized:
ProxyPreserveHost On
ProxyPass /wikispeech/ http://127.0.1.1:10000/
ProxyPassReverse /wikispeech/ http://127.0.1.1:10000/
Sources: README.md:110-120
Audio File Accessibility
Audio files generated in the audio_tmpdir must be symlinked to a web-accessible directory if not served directly by Flask:
cd /var/www/html; sudo ln -s ~/git/wikispeech-server/wikispeech_server/tmp/ audio
Sources: README.md:80-90
Verification and Testing
After installation, the setup can be verified using the built-in test scripts or via direct API calls.
- Scripted Test:
build_and_test.shruns a full suite including starting all sub-services and checking their status. - API Verification:
- Ping:
curl http://localhost:10000/ping - Supported Languages:
curl http://localhost:10000/languages - Basic Synthesis:
curl "http://localhost:10000/?lang=sv&input=Ett+test"
- Ping:
Sources: build_and_test.sh:1-130, wikispeech_server/wikispeech.py:80-150, README.md:65-75
Startup Component Validation
The server performs internal validation of its configuration during startup. If run_startup_tests is enabled in the configuration, it will attempt to validate connections to the lexicon and synthesis engines before accepting requests.
Sources: wikispeech_server/wikispeech.py:900-960, wikispeech_server/default.conf:36-42
Summary
Installation and setup of the Wikispeech server require a coordinated effort to configure both the local Python environment and the network-accessible microservices. The system's flexibility allows for local development using default.conf or complex production deployments involving Apache proxies and multiple TTS engines like MaryTTS, Piper, and Matcha.