How tigregotico/pyahotts works
Project Overview
• AhoTTS is a text-to-speech converter for Basque and Spanish.
• It is a hybrid system: it combines Python bindings (the “pyahotts” package) with a native acoustic engine coded in C/C++ (located in the “src” directory) that implements the core functionality (based on hts_engine and the high-quality vocoder “AhoCoder”).
• The system uses prebuilt voices, linguistic data (dictionaries, PDFs, inf files, etc.), and both language-specific (Basque and Spanish) resources embedded in the package structure.
Main Components
a. Python Bindings Layer:
• Module: “pyahotts”
• Files: __init__.py, version.py, setup.py
• This layer provides a high-level API (as shown in the README’s usage example) and wraps calls to the underlying native libraries.
b. Native Engine / Acoustics Module:
• Source directory (“src”) contains all of the C/C++ code for the HTS engine, AhoCoder functionality, and linguistic processing (e.g., files like HTS_ahocoder.c, HTS_audio.c, etc.).
• This module is responsible for processing input text and producing the audio output.
c. Language Resources:
• Data and models stored under “pyahotts/data_tts”; includes dictionaries (for Spanish and Basque) and voice models (organized further into “aholab_es_female” and “aholab_eu_female”).
• These provide the data for linguistic, prosodic, and acoustic processing.
d. Build/Deployment/CI Components:
• “CMakeLists.txt” at the top level and within “src” for building the native libraries.
• “.github” workflows for tests, releases, and publishing which showcase continuous integration.
Mapping Component Relationships
• The Python bindings (pyahotts) call into the native library (compiled from the “src” files) using mechanisms such as dynamic linking.
• The native TTS engine uses the language resources (dictionaries, voice files, etc.) for synthesis.
• The build system (using CMake) coordinates compilation and packaging of the native engine while the “setup.py” may tie everything together for installation via Python’s packaging ecosystem.
• CI/CD (via GitHub workflows) is used for ensuring code quality and handling releases.
Architectural Patterns & Important Elements
• Layered Architecture: Clear separation between the high-level Python interface and the low-level native processing components.
• Modular Organization: Each subsystem (Python bindings, native engine, data resources, build scripts) is self-contained. This eases maintenance and potential extension (for example, adding new voice models or supporting additional languages).
• The system adheres to a plug-in-like approach when it comes to its voice models and dictionaries – different voices and language-specific resources are organized in separate directories and are loaded based on user input (e.g., “lang” parameter).
Technologies & Frameworks
• C/C++ (with CMake build system) for the core HTS engine and vocoder (AhoCoder).
• Python for bindings and high-level API.
• The project uses CI tools defined within GitHub workflows (e.g., conventional-label, install_tests, publish_stable).