A high-quality Flow-Matching based Text-to-Speech library using ONNX.
Project description
ebook-reader-supertonic
A high-quality Flow-Matching based Text-to-Speech library using ONNX. This is a Python port of the Supertonic-2 web implementation.
Features
- 10 Unique Voice Styles: Professional male and female voices.
- Auto-Downloader: Automatically fetches models from HuggingFace to a global cache (
~/.cache/ebook_reader_supertonic). - Word Timestamps: Heuristic estimation by default, with optional Vosk-based extraction (offline ASR) for better word timing.
- Adjustable Parameters: Control speed (0.9 - 1.4) and diffusion steps (3 - 14).
- Lightweight Inference: Runs on CPU/GPU via ONNX Runtime.
Installation
pip install ebook-reader-supertonic
Quick Start
from ebook_reader_supertonic import SupertonicTTS, VOICE_STYLES, MIN_SPEED, MAX_SPEED
# 1. Initialize engine
# Models are automatically cached in ~/.cache/ebook_reader_supertonic
engine = SupertonicTTS()
# 2. Synthesize
# Returns:
# - audio: np.ndarray (float32, normalized -1 to 1)
# - sample_rate: int (44100)
# - word_timestamps: List[Dict] -> [{'word': str, 'start': float, 'end': float}]
audio, sr, word_timestamps = engine.synthesize(
text="Hello! Welcome to ebook-reader-supertonic.",
voice='F5',
speed=1.0,
steps=10,
# timestamps_backend="auto", # 'estimate' (default), 'vosk', or 'auto'
# vosk_model_path="path/to/vosk/model", # or set env VOSK_MODEL_PATH
)
Vosk auto-download (optional)
If you use timestamps_backend="auto" or "vosk" and no model path is configured, the package can auto-download the pinned model vosk-model-en-us-0.22-lgraph into ~/.cache/vosk.
Environment variables:
VOSK_MODEL_PATH: use an existing local model directory (disables download).VOSK_CACHE_DIR: override cache base (default~/.cache/vosk).VOSK_OFFLINE=1: forbid downloads (error for"vosk", fallback to estimate for"auto").EBOOK_READER_VOSK_AUTO_DOWNLOAD=0: disable auto-download behavior.
3. Calculate Total Duration
duration = len(audio) / sr print(f"Generated {duration:.2f}s of audio")
4. Access Word Timing
for segment in word_timestamps: print(f"{segment['word']}: {segment['start']}s -> {segment['end']}s")
5. Save to file
engine.save_wav(audio, "output.wav")
## API Reference
### `SupertonicTTS.synthesize(text, voice='M3', steps=10, speed=1.0, lang=None)`
- **Parameters**:
- `text` (str): Text to synthesize.
- `voice` (str): Voice ID (`F1-F5`, `M1-M5`).
- `steps` (int): Diffusion steps (`MIN_STEPS=3` to `MAX_STEPS=14`).
- `speed` (float): Speed factor (`MIN_SPEED=0.9` to `MAX_SPEED=1.4`).
- `lang` (str): Manual language override (e.g., 'en', 'ko'). Auto-detects if None.
- **Returns**: `(audio_data, sample_rate, word_timestamps)`
### `VOICE_STYLES`
A list of Pydantic models containing voice metadata:
```python
voice = VOICE_STYLES[0]
print(voice.id) # 'F1'
print(voice.gender) # 'female'
print(voice.description) # 'Correct and natural...'
Author
Izzet Sezer sezer@imsezer.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ebook_reader_supertonic-1.3.1.tar.gz.
File metadata
- Download URL: ebook_reader_supertonic-1.3.1.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32f47a1da4ebd016d6a8954bb1dc5b2eeef879659617d401fae30d08b30eceb4
|
|
| MD5 |
c84f924730c7ea4cd6abb29b3ccda651
|
|
| BLAKE2b-256 |
3ff826046467ad7cbb770f2dc201d1572dece1b9493e2e26886625791d698e49
|
Provenance
The following attestation bundles were made for ebook_reader_supertonic-1.3.1.tar.gz:
Publisher:
workflow.yml on sezer-muhammed/ReaderAudioEngine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ebook_reader_supertonic-1.3.1.tar.gz -
Subject digest:
32f47a1da4ebd016d6a8954bb1dc5b2eeef879659617d401fae30d08b30eceb4 - Sigstore transparency entry: 864122368
- Sigstore integration time:
-
Permalink:
sezer-muhammed/ReaderAudioEngine@2eedaf838cff32ed9a464c5ef1cc1c9ed37723ee -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/sezer-muhammed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@2eedaf838cff32ed9a464c5ef1cc1c9ed37723ee -
Trigger Event:
push
-
Statement type:
File details
Details for the file ebook_reader_supertonic-1.3.1-py3-none-any.whl.
File metadata
- Download URL: ebook_reader_supertonic-1.3.1-py3-none-any.whl
- Upload date:
- Size: 20.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
204ad803f382c55e69509fee8e9009583f57fa008b7094ebfa8252bdf9828601
|
|
| MD5 |
16cc82cc9ece0f5ce0211e0a88c3f03e
|
|
| BLAKE2b-256 |
b0617573593aa4ff7c86f96d422f1639ad0b9916d6c677af89f7c2a64c9a04c0
|
Provenance
The following attestation bundles were made for ebook_reader_supertonic-1.3.1-py3-none-any.whl:
Publisher:
workflow.yml on sezer-muhammed/ReaderAudioEngine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ebook_reader_supertonic-1.3.1-py3-none-any.whl -
Subject digest:
204ad803f382c55e69509fee8e9009583f57fa008b7094ebfa8252bdf9828601 - Sigstore transparency entry: 864122376
- Sigstore integration time:
-
Permalink:
sezer-muhammed/ReaderAudioEngine@2eedaf838cff32ed9a464c5ef1cc1c9ed37723ee -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/sezer-muhammed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@2eedaf838cff32ed9a464c5ef1cc1c9ed37723ee -
Trigger Event:
push
-
Statement type: