$ show kxxt/aspeak
aspeak is a text-to-speech client for Azure TTS API, written in Rust. It provides a CLI, a Rust library, and Python bindings. The core functionality synthesizes speech from plain text or SSML using either the REST or WebSocket API. The architecture is modular: the library defines two synthesizer types (`RestSynthesizer` and `WebsocketSynthesizer`) with a unified trait, and a CLI wraps these for command-line use. The Python binding exposes a `SpeechService` class. The codebase demonstrates solid Rust engineering with builder patterns, comprehensive error handling, and support for proxies, custom audio formats, and rich SSML options. It is well-tested with unit and integration tests, has CI/CD pipelines, and is actively maintained.
The LLM identified 3 files worth highlighting for reuse:
Generates SSML XML from text and options (voice, pitch, rate, style, role). Uses the `xml-rs` crate to build the SSML tree. It is a self-contained module that can be reused in any project needing to produce Azure TTS SSML, with minimal dependencies (only `TextOptions` and `RichSsmlOptions`). Demonstrates clean XML generation with optional attributes.
Provides parsing functions for pitch, rate, and style_degree CLI arguments. Validates and converts complex input formats (e.g., '440Hz', '+1.5st', 'x-slow', '0.5f') into the expected SSML string representations. Includes comprehensive unit tests. This module is standalone and could be extracted into a separate crate for validating TTS parameters.
Implements custom async network connection logic for WebSocket synthesizer, supporting direct connections, SOCKS5 proxies, and HTTP CONNECT proxies. Uses `tokio-socks` and `hyper` to tunnel through proxies. The module is self-contained and demonstrates non-trivial async networking, making it reusable for other projects that need to establish WebSocket connections through various proxy types.