Introduction & Project Scope
Relevant source files
The following files were used as context for generating this wiki page:
The Wikispeech server is a Flask-based application designed to provide a centralized interface for Text-to-Speech (TTS) synthesis, specifically tailored for the Wikispeech project. It acts as a middleware that orchestrates various microservices, including lexicon servers, symbol set mappers, and multiple TTS engines (such as MaryTTS, Piper, and Matcha) to transform text or SSML input into high-quality audio.
The scope of the project encompasses text processing (tokenization, G2P mapping), synthesis management through specialized adapters, and audio delivery. It supports a range of languages including English, Swedish, Arabic, and others, providing an extensible framework for adding new voices and text processors.
Sources: README.md:1-5, wikispeech_server/wikispeech.py:64-70, wikispeech_server/templates/usage.html:13-33
System Architecture
The project follows a microservice-oriented architecture where the Wikispeech server serves as the primary gateway. It communicates with several backend services via HTTP to fulfill synthesis requests.
Core Components
- Wikispeech Server: The main Flask application handling API requests, configuration, and orchestration.
- Textprocessor: Handles language-specific logic, including tokenization and initial markup generation.
- Adapters: Specialized modules (e.g.,
piper_adapter.py,matcha_adapter.py) that interface with external TTS engines. - External Services:
- Lexicon Server (Pronlex): Provides word lookups and phonetic transcriptions.
- Mapper (SymbolSet): Translates phonetic symbols between different sets (e.g., IPA to X-SAMPA).
- TTS Engines: External servers like MaryTTS, Matcha, or Piper that perform the actual synthesis.
Sources: wikispeech_server/wikispeech.py:461-480, wikispeech_server/config-sample.conf:17-22, build_and_test.sh:26-90
High-Level Component Interaction
The diagram below illustrates how the Wikispeech server coordinates external services during a typical synthesis request.
Explanation: The Wikispeech server receives input, processes it via language-specific text processors (utilizing Lexicon and Mapper services), and then routes the processed markup to a TTS engine via an adapter to generate audio.
Sources: wikispeech_server/wikispeech.py:220-250, wikispeech_server/adapters/README.md:1-25
Functional Scope
API Capabilities
The server exposes several endpoints for interaction:
| Endpoint | Method | Description |
|---|---|---|
/ | GET/POST | Main synthesis entry point. Accepts lang and input. |
/textprocessing | GET/POST | Processes text into structured JSON markup without synthesis. |
/synthesis | GET/POST | Synthesizes audio from pre-processed JSON markup. |
/options | GET | Returns available parameters and documentation in JSON format. |
/languages | GET | Lists all supported languages. |
/lexserver | GET | Proxy connection to the lexicon server for lookup/updates. |
Sources: wikispeech_server/wikispeech.py:90-185, wikispeech_server/options.py:5-40, wikispeech_server/wikispeech.py:537-545
Processing Workflow
The system employs a specific pipeline for transforming raw text into audio.
- Tokenization: Breaking input text into sentences and tokens.
- G2P (Grapheme-to-Phoneme): Determining phonetic transcriptions using lexicons or fallback algorithms.
- Markup Generation: Creating a structured "utt" (utterance) object containing paragraphs, sentences, and tokens.
- Synthesis: Sending the markup to the selected voice adapter.
- Audio Conversion: Converting raw engine output (e.g., WAV) to OPUS for web delivery.
Explanation: Sequence of operations from initial client request to the final delivery of audio and timing information.
Sources: wikispeech_server/wikispeech.py:240-300, wikispeech_server/wikispeech.py:650-685, workflow_demo/README.md:5-15
Project Scope & Boundaries
Included Features
- Multi-Engine Support: Support for Flite, eSpeak-ng, MaryTTS, Matcha, and Piper.
- Audio Delivery: Base64-encoded audio data or direct URLs for generated files.
- Timing Information: Token-level timestamps (start/end times) returned in JSON metadata for "play-along" highlighting.
- Configuration Management: Support for local
.conffiles and JSON-based voice/processor definitions. - Demo Utilities: Includes a
workflow_demoandtest.htmlfor verifying installations.
Sources: README.md:21-48, wikispeech_server/wikispeech.py:284-300, wikispeech_server/config-sample.conf:1-15
External Dependencies
The Wikispeech server relies on several external system requirements:
- opus-tools: Specifically
opusencfor converting WAV output to OPUS. - Python Environment: Flask, Flask-CORS, and Requests.
- Backend Services: Must have active instances of the Lexicon and Mapper services for full functionality.
Sources: README.md:8-15, wikispeech_server/wikispeech.py:75-85, build_and_test.sh:16-24
Configuration and Extensibility
The project is designed to be highly configurable via a main configuration file (defaulting to default.conf or user-specified hostname-based files).
Configuration Sections
| Section | Key Parameters | Description |
|---|---|---|
| Server | port, log_level, logger | Basic Flask server settings. |
| Voice config | config_files | List of JSON files defining text processors and voices. |
| Audio settings | audio_tmpdir | Path for temporary storage of generated audio files. |
| Services | lexicon, mapper, matcha, piper | URLs to external microservices. |
Sources: wikispeech_server/config-sample.conf:1-30, README.md:30-45
Summary
The Wikispeech server provides a robust, extensible scope for TTS synthesis by abstracting the complexities of multiple engines and language-specific processing into a unified REST API. Its modular architecture via adapters and external services ensures that it can scale and adapt to new synthesis technologies as they emerge.
Sources: wikispeech_server/wikispeech.py:1-50, workflow_demo/README.md:1-20