Skip to main content

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: Precise estimation of word-level 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
)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ebook_reader_supertonic-1.1.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ebook_reader_supertonic-1.1.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file ebook_reader_supertonic-1.1.1.tar.gz.

File metadata

  • Download URL: ebook_reader_supertonic-1.1.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ebook_reader_supertonic-1.1.1.tar.gz
Algorithm Hash digest
SHA256 d00a030f99f4899d88b2b6991f13a1da49782f77a9b5e67b6b3695206a3fbc64
MD5 e8b728dbee988b9166f85fef0645e0fb
BLAKE2b-256 f9b2173b9b23c1495f2a5eaae4bf965a63e6c98a658031c2775003360b3eaf51

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebook_reader_supertonic-1.1.1.tar.gz:

Publisher: workflow.yml on sezer-muhammed/ReaderAudioEngine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ebook_reader_supertonic-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ebook_reader_supertonic-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 304833ec5e42356999be601d04f0ec0f19c23745df2a2f5cfee4dcc76c1951df
MD5 b588d08cba0d6438e5737f4765265466
BLAKE2b-256 f10d44f76c4b8b7b4acc3d6601192e49ee09afb2e54f7fedf38b48be7e4d8231

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebook_reader_supertonic-1.1.1-py3-none-any.whl:

Publisher: workflow.yml on sezer-muhammed/ReaderAudioEngine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page