Skip to main content

Hebrew Text-to-Speech inference using ONNX and TensorRT

Project description

Blue

Text-to-speech inference with ONNX Runtime; optional TensorRT acceleration on NVIDIA GPUs.

PyPI version   Try Live Demo on Hugging Face   lightbluetts.com

Hebrew, English, Spanish, Italian, and German — samples and a live demo on the site and Space above.

Install

Requires Python 3.12+ (see requires-python in pyproject.toml).

Users (PyPI)

pip install blue-onnx

Optional accelerators (PyPI): install the extra, then drop the stock CPU wheel so a single build owns onnxruntime:

  • Intel OpenVINO: pip install "blue-onnx[openvino]" then pip uninstall onnxruntime
  • NVIDIA CUDA: pip install "blue-onnx[gpu]" then pip uninstall onnxruntime

This repository

git clone https://github.com/maxmelichov/BlueTTS.git
cd BlueTTS
uv sync

Optional extras:

uv sync --extra openvino   # Intel OpenVINO EP (then: uv pip uninstall onnxruntime)
uv sync --extra gpu        # NVIDIA CUDA ORT (then: uv pip uninstall onnxruntime)

The default environment uses the stock onnxruntime CPU wheel. OpenVINO and CUDA (gpu) are optional; each adds a second ONNX Runtime distribution until you remove the stock CPU wheel so the accelerator build owns the onnxruntime import (uv pip uninstall onnxruntime, or the same with pip after a PyPI install with [openvino] or [gpu]). Do not combine the openvino and gpu extras. For TensorRT, use uv sync --extra tensorrt in TensorRT. For voice or ONNX export, add --extra export in Models (with the PyTorch checkpoint download).

Models

ONNX bundle (slim graph; notmax123/blue-onnx-v2):

uv run hf download notmax123/blue-onnx-v2 --repo-type model --local-dir ./onnx_models

The Hub bundle does not include per-voice style JSON; use the sample voices/*.json from this repository (or on GitHub), or export a new voice from a reference clip (see exports/README.md, PyTorch weights below). If you use pip without uv, the same CLI is available after install because blue-onnx depends on huggingface-hub — run hf download ... with the same arguments.

Optional

  • Hebrew G2P:
    wget -O model.onnx https://huggingface.co/thewh1teagle/renikud/resolve/main/model.onnx
    
  • PyTorch checkpoints (notmax123/blue-v2) for exporting new voice JSON and ONNX: uv sync --extra export then
    uv run hf download notmax123/blue-v2 --repo-type model --local-dir ./pt_models
    

Usage

Examples below use voices/female1.json from this repo, or a JSON you produced with exports/export_new_voice.py.

Quick start

import soundfile as sf
from blue_onnx import BlueTTS

tts = BlueTTS(
    onnx_dir="onnx_models",
    style_json="voices/female1.json",
    renikud_path="model.onnx",
)

samples, sr = tts.synthesize("שלום, זהו מודל דיבור בעברית.", lang="he")
sf.write("output.wav", samples, sr)

mixed = "שלום לכולם, <en>welcome to the presentation</en>, <es>espero que lo disfruten</es>."
samples, sr = tts.synthesize(mixed, lang="he")
sf.write("mixed_output.wav", samples, sr)

If you are editing this repo without installing the package, use from src.blue_onnx import BlueTTS (as in examples/) or put src on PYTHONPATH.

Examples

Outputs go to examples/out/ when run from the repo root.

uv run python examples/basic.py   # he / en / es / it / de + mixed in one run
uv run python examples/mixed.py
uv run python examples/app.py --lang en --text "Hello world."

Edit onnx_dir and voice JSON in each example if your paths differ. See examples/voices.md for app.py and voice selection.

TensorRT (NVIDIA only)

  1. Dependencies:
uv sync --extra tensorrt
uv pip install tensorrt-cu12   # separate install; see astral-sh/uv#14313
  1. Build engines (details in scripts/README.md):
uv run python scripts/create_tensorrt.py \
  --onnx_dir onnx_models --engine_dir trt_engines --precision fp32 --config config/tts.json

Citations

@ARTICLE{2025arXiv250323108K,
       author = {{Kim}, Hyeongju and {Yang}, Jinhyeok and {Yu}, Yechan and {Ji}, Seunghun and {Morton}, Jacob and {Bous}, Frederik and {Byun}, Joon and {Lee}, Juheon},
        title = "{SupertonicTTS: Towards Highly Efficient and Streamlined Text-to-Speech System}",
      journal = {arXiv e-prints},
     keywords = {Audio and Speech Processing, Machine Learning, Sound},
        pages = {arXiv:2503.23108},
}
@article{kim2025training,
  title={Training Flow Matching Models with Reliable Labels via Self-Purification},
  author={Kim, Hyeongju and Yu, Yechan and Yi, June Young and Lee, Juheon},
  journal={arXiv preprint arXiv:2509.19091},
  year={2025}
}
@misc{yi2025robustttstrainingselfpurifying,
      title={Robust TTS Training via Self-Purifying Flow Matching for the WildSpoof 2026 TTS Track},
      author={June Young Yi and Hyeongju Kim and Juheon Lee},
      year={2025},
      eprint={2512.17293},
      archivePrefix={arXiv},
      primaryClass={cs.SD},
      url={https://arxiv.org/abs/2512.17293},
}

Acknowledgments

Hebrew G2P uses renikud. Thanks to thewh1teagle.

License

MIT

Voice cloning and responsibility

This software can produce speech that mimics a reference voice. The maintainers and contributors are not responsible for what you do with it—compliance with law, consent from voice owners, and ethical use are entirely your responsibility. Do not use it to deceive, impersonate without permission, or infringe anyone’s rights.

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

blue_onnx-0.2.4.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

blue_onnx-0.2.4-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file blue_onnx-0.2.4.tar.gz.

File metadata

  • Download URL: blue_onnx-0.2.4.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for blue_onnx-0.2.4.tar.gz
Algorithm Hash digest
SHA256 f136924c03bc559039a206b38f71ba33b87ed61e8afa0c8c3403294820ab6cb5
MD5 abf22ce1e4c5725f8f09c43f7a4c4875
BLAKE2b-256 d605ceb2764e1f7426fdea154cac4dd87dfa19a7f24d5f759103feb0f1a4877d

See more details on using hashes here.

File details

Details for the file blue_onnx-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: blue_onnx-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for blue_onnx-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1b829b19b4c6f2353b24908103c8b12c88bc25fab37f30976e109092dcbf89e5
MD5 5c21a06118a505a9f914e6a5c1c9684d
BLAKE2b-256 183ca976ec12185661a7c877a6c8e97442f4c3fbfed6999fbe628c5095d6bc01

See more details on using hashes here.

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