This PR implements improvements to the TTS system as described in issue #28.
Key changes:
- Text Chunking: Implemented a sentence-aware text chunker that splits long texts into smaller segments (~100 tokens/400 chars) for pipelined audio generation. This prevents crashes on large texts and improves perceived performance.
- Markdown Sanitization: Added a markdown sanitizer to strip formatting characters (bold, italics, headers, links, code blocks) before text is sent to the TTS engine.
- Hardware Acceleration: Added a 'provider' configuration option to enable GPU acceleration in sherpa-onnx (cpu, cuda, coreml, directml, tensorrt).
- Configurable Options: Added
provider, chunk_size, and sanitize_markdown to the [tts] configuration section, with examples in configs/default.toml.
Verification:
- Added
internal/tts/text_utils_test.go to verify sanitization and chunking logic.
- Verified build and existing tests pass with
make build and make test.
This PR implements improvements to the TTS system as described in issue #28.
Key changes:
- **Text Chunking:** Implemented a sentence-aware text chunker that splits long texts into smaller segments (~100 tokens/400 chars) for pipelined audio generation. This prevents crashes on large texts and improves perceived performance.
- **Markdown Sanitization:** Added a markdown sanitizer to strip formatting characters (bold, italics, headers, links, code blocks) before text is sent to the TTS engine.
- **Hardware Acceleration:** Added a 'provider' configuration option to enable GPU acceleration in sherpa-onnx (cpu, cuda, coreml, directml, tensorrt).
- **Configurable Options:** Added `provider`, `chunk_size`, and `sanitize_markdown` to the `[tts]` configuration section, with examples in `configs/default.toml`.
Verification:
- Added `internal/tts/text_utils_test.go` to verify sanitization and chunking logic.
- Verified build and existing tests pass with `make build` and `make test`.