Skip to main content

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

Metadata

Release files for ebook-reader-supertonic 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ebook-reader-supertonic 1.3.3
File Size Uploaded
ebook_reader_supertonic-1.3.3.tar.gz 22.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ebook-reader-supertonic 1.3.3
File Interpreter ABI Platform
ebook_reader_supertonic-1.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 45.3 kB

Release files / ebook_reader_supertonic-1.3.3.tar.gz

Download URL ebook_reader_supertonic-1.3.3.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cfc986d40771e1df1a43d9637c7fff70606c79e5648b02a5c9a9b7a1004e335d
BLAKE2b-256 checksum
How to use checksums
7cdb4834a7d38e8e746e6a885a7f82d19a7bb0d0ec314dcd55e2cacd59936d92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 28, 2026.

Transparency log

Release files / ebook_reader_supertonic-1.3.3-py3-none-any.whl

Download URL ebook_reader_supertonic-1.3.3-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fd7e0350cd52b2df70a0416f843d220f6706c66022db15a871a112946aef23b
BLAKE2b-256 checksum
How to use checksums
9726cf54e0b81918ea13377d876b2a13c4ddbec155cf8bf32cca6e6a3c20a8c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.3 This release

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.1.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page