AhoTTS & Basque Language Support
Relevant source files
The following files were used as context for generating this wiki page:
The AhoTTS integration provides Basque (EU) language text-to-speech capabilities to the Wikispeech server. This support is implemented via a dedicated adapter that interfaces with an external AhoTTS server, facilitating the synthesis of Basque text into audio while maintaining precise word-level timing information.
The system utilizes specialized Basque linguistic processing for abbreviations, foreign words, and initials to ensure high-quality phonetic output. This integration allows the Wikispeech server to expand its linguistic reach into the Basque language using the AhoTTS engine as a primary backend.
Sources: wikispeech_server/adapters/ahotts_adapter.py:1-25, wikispeech_server/templates/usage.html:85-87
Architecture and Data Flow
The AhoTTS support follows a client-server model where the Wikispeech server acts as a proxy, sending text processing results to an AhoTTS instance and retrieving audio files and timing metadata.
System Interaction
The following diagram illustrates the sequence of events when a request for Basque speech synthesis is processed:
Key Components
AhoTTS Adapter
The ahotts_adapter.py file serves as the primary interface. It contains logic for:
- Text Hashing: Creates unique MD5 hashes based on input text, language, and voice name to manage temporary files.
- Basque Orthography Processing: The
get_orthfunction handles Basque-specific tokens, utilizing specialized lists for units, abbreviations, foreign words, and initials. - Socket Communication (Legacy/Optional): Includes lower-level socket functions (
socket_write_filelength_file,socket_read_filelength_file) for direct binary communication, though the primary method uses HTTP requests.
Sources: wikispeech_server/adapters/ahotts_adapter.py:35-125, wikispeech_server/adapters/ahotts_adapter.py:186-206
Service Configuration
Configuration for AhoTTS is managed via the global Wikispeech configuration file (default.conf).
| Parameter | Description | Source |
|---|---|---|
ahotts_dir | Local directory for AhoTTS-eu-Wikispeech files | default.conf:34 |
ahotts_server_ip | IP address of the remote AhoTTS server | default.conf:35 |
ahotts_server_port | Port number for AhoTTS communication | default.conf:36 |
ahotts_speed | Default speech rate (default: 200) | default.conf:37 |
Data Processing Logic
Basque Tokenization
The get_orth function ensures that Basque-specific linguistics are respected during tokenization. It checks tokens against specials_eu (a sorted collection of units, initials, abbreviations, and foreign words).
def get_orth(utterance):
# Logic to split word parts or preserve special Basque tokens
for word in words:
split_list=word["orth"].split('-')
split_list_initial='-'.join(split_list[:-1])
if (split_list_initial in specials_eu ...):
orth_list.append(word["orth"])
else:
for wordpart in split_list:
orth_list.append(wordpart)
Sources: wikispeech_server/adapters/ahotts_adapter.py:186-206
Audio and Timing Retrieval
AhoTTS returns two primary files for every synthesis request:
- WAV File: The raw audio data.
- WRD File: A text-based timing file containing word boundaries.
The adapter parses the .wrd file to generate tokens with starttime and endtime attributes, which are used by the frontend for highlighting text during playback.
Sources: wikispeech_server/adapters/ahotts_adapter.py:145-183, wikispeech_simple_player.js:150-180
Integration with Voice System
The AhoTTS engine is registered as a voice engine within the server's voice management system. During the server's startup or initialization of a Basque voice, the Voice class triggers testVoice in the AhoTTS adapter to ensure connectivity to the remote server.
Sources: wikispeech_server/voice.py:20-35, wikispeech_server/adapters/ahotts_adapter.py:35-61
Conclusion
AhoTTS support within Wikispeech is a robust integration designed for the Basque language. It leverages remote service calls to handle the complexities of Basque phonetics and timing, providing the necessary infrastructure for accessible Basque content through the Wikispeech ecosystem.
Sources: README.md:1-50, wikispeech_server/wikispeech.py:1-50