Server Configuration
Relevant source files
The following files were used as context for generating this wiki page:
The Wikispeech server configuration system manages the operational environment, external service integrations, and voice-specific processing pipelines. It utilizes a hierarchical configuration loading mechanism that supports default settings, user-specific overrides, and command-line arguments to ensure flexibility across different deployment environments.
The configuration facilitates the integration of various Text-to-Speech (TTS) components, including text processors and synthesis engines, by defining service URLs and file paths for audio processing.
Sources: wikispeech_server/config.py:1-35, README.md:28-56
Configuration Loading Mechanism
The server employs a specific priority order when loading configuration files. It uses the configparser library to read .conf files.
Loading Logic
- Command Line Argument: If a path is provided as the first argument when running the script, the server attempts to load that file exclusively.
- Default Configuration: If no argument is provided, the server loads
wikispeech_server/default.conf. - User/Host Override: After loading the default, the server searches for a file named
<username>-<hostname>.conf. If found, these settings override the defaults.
The diagram above illustrates the decision tree used by the config.py module to determine which configuration settings are active at runtime.
Sources: wikispeech_server/config.py:10-35
Core Configuration Sections
The configuration files are organized into functional blocks using standard INI-style sections.
Server Section
Defines the basic network and logging behavior of the Flask application.
| Option | Description | Default Value |
|---|---|---|
port | The network port the server listens on. | 10000 |
log_level | Verbosity of logs (info, debug, warning, error). | info |
logger | Output destination (stderr, stdout, syslog, filename). | stderr |
flask_debug_mode | Enables Flask's auto-reload on file changes. | False |
Sources: wikispeech_server/default.conf:1-10, README.md:32-37
Voice and Audio Settings
These settings control where voice definitions are stored and how temporary audio files are handled.
| Section | Option | Description |
|---|---|---|
| Voice config | config_files_location | Directory containing JSON voice configurations. |
| Voice config | config_files | List of specific JSON files to load for voices/textprocessors. |
| Audio settings | audio_tmpdir | Local path for temporary WAV and OPUS file generation. |
Sources: wikispeech_server/default.conf:12-23, wikispeech_server/wikispeech.py:816-830
External Service Integration
The server acts as an orchestrator, delegating specific tasks to external microservices. These are configured in the [Services] section.
The server connects to specialized engines for phonetic mapping, dictionary lookups, and neural synthesis.
Sources: wikispeech_server/config-sample.conf:19-25, wikispeech_server/default.conf:25-33
Service Endpoint Definitions
- Mapper: Used for symbol set mapping (e.g., IPA to SAMPA).
- Lexicon: Provides phonetic transcriptions for words.
- Synthesizers: External engines like MaryTTS, Matcha, or Piper that convert processed text to audio.
Sources: wikispeech_server/wikispeech.py:539-543, wikispeech_server/default.conf:25-33
Runtime Configuration Options
The options.py module defines the parameters acceptable by the API endpoints, which are validated against the server's loaded configuration.
| Parameter | Type | Required | Description |
|---|---|---|---|
lang | String | Yes | ISO 639-1 code (e.g., 'en', 'sv'). |
input | String | Yes | Text or Markup to be processed. |
textprocessor | String | No | Specific processor name (defaults to 'default'). |
voice | String | No | Specific voice name (defaults to 'default'). |
input_type | String | No | Format of input: text or ssml. |
output_type | String | No | Format of output: json or html. |
Sources: wikispeech_server/options.py:7-45, wikispeech_server/wikispeech.py:183-205
Startup and Testing Configuration
The [Tests] section controls the server's behavior during the initialization phase to ensure that all configured backends are reachable.
run_startup_tests: WhenTrue, the server performs a suite of tests on startup (lexicon lookup, textprocessing, and synthesis) to verify the configuration.quit_on_error: If enabled, the server will terminate immediately if a startup test fails.load_components_on_error: IfTrue, the server will continue to load even if backend services are down, resulting in 500 errors only when the specific component is called.
Sources: wikispeech_server/wikispeech.py:51-57, wikispeech_server/default.conf:35-41
Conclusion
The Wikispeech server configuration is a robust system designed to support complex TTS workflows by externalizing service locations and processing logic. By separating core server settings from voice-specific JSON configurations, the system allows for modular scaling and easy adaptation to various languages and synthesis technologies.