Matcha-TTS ONNX Models
This repo contains full end-to-end Matcha-TTS ONNX graphs with the HiFiGAN vocoder embedded.
Code:
https://github.com/thewh1teagle/Matcha-TTS/tree/feature/train-on-phonemes
Python wrapper package:
https://pypi.org/project/matcha-onnx/
Files
matcha-english.onnx- original pretrained English/LJSpeech Matcha-TTS exported to ONNX.matcha-he-en.onnx- Hebrew + English IPA fine-tuned single-speaker model exported to ONNX.matcha-he-en.ckpt- latest PyTorch Lightning checkpoint for the Hebrew + English model.sample-he-en.wav/sample-he-en.m4a- sample generated frommatcha-he-en.ckpt.sample-he-en.txt- exact sample phonemes and synthesis settings.
Both ONNX files include metadata for:
matcha.symbolsmatcha.sample_ratematcha.n_timestepsmatcha.embedded_vocodermatcha.n_spks
Usage
Use the matcha-onnx package. It reads the symbol table, sample rate, and step count from ONNX metadata.
pip install matcha-onnx
wget -O matcha.onnx https://huggingface.co/thewh1teagle/matcha-tts/resolve/main/matcha-english.onnx
import soundfile as sf
from matcha_onnx import MatchaOnnx
tts = MatchaOnnx("matcha.onnx")
samples, sr = tts.create("Hello from Matcha TTS.", speed=0.95)
sf.write("audio.wav", samples, sr)
For the Hebrew + English model, input must be IPA phonemes, not raw Hebrew or English graphemes.
wget -O matcha-he-en.onnx https://huggingface.co/thewh1teagle/matcha-tts/resolve/main/matcha-he-en.onnx
from matcha_onnx import MatchaOnnx
tts = MatchaOnnx("matcha-he-en.onnx")
samples, sr = tts.create("sˈimu lˈev nosʔˈim jekaʁˈim.", is_phonemes=True)
Audio config: mono, 22050 Hz.