Downloads · 30 days
0
Hinotsuba/OpenVoice-ONNX-v2
OpenVoice-ONNX-v2 is a audio-to-audio model from Hinotsuba. Use it for the audio-to-audio task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This repository provides the speaker encoder and tone color converter from OpenVoice V2 in ONNX format for local voice cloning and voice conversion. The models can run through ONNX Runtime in C, C++, Python, Rust, and…
Downloads · 30 days
0
Access
Public
Updated Oct 11, 2026
Repo size
161 MB
Likes
0
Public
Click a slice to open those files.
.onnx161 MB · 100%
From the Hugging Face model README
This repository provides the speaker encoder and tone color converter from OpenVoice V2 in ONNX format for local voice cloning and voice conversion. The models can run through ONNX Runtime in C#, C++, Python, Rust, and other supported environments without a PyTorch runtime.
The original architecture and model weights were developed by MyShell and the OpenVoice contributors. See the upstream OpenVoice project.
The converter takes speech audio and changes its voice characteristics using source and target speaker embeddings. A separate text-to-speech system supplies the base speech when generating audio from text.
| File | Purpose |
|---|---|
tone_extract.onnx | Extracts a 256-dimensional speaker embedding from a reference spectrogram. |
tone_color.onnx | Converts a source spectrogram using source and target speaker embeddings. |
tone_config.json | Audio preprocessing parameters and OpenVoice V2 network configuration. |
LICENSE | Original MIT license and copyright notice. |
Download files using:
https://huggingface.co/Hinotsuba/OpenVoice-ONNX-v2/resolve/main/{filename}
Use a specific repository revision in place of main when pinning a deployment.
All floating-point tensors use float32. Both graphs have a fixed batch size
of 1. frames denotes the number of spectrogram frames, not waveform samples.
tone_extract.onnx| Direction | Name | Type | Shape | Meaning |
|---|---|---|---|---|
| Input | input | float32 | [1, frames, 513] | Reference audio magnitude spectrogram, with time before frequency. |
| Output | tone_embedding | float32 | [1, 256] | Speaker embedding. |
Reshape the extracted embedding to [1, 256, 1] before passing it to the converter.
tone_color.onnx| Direction | Name | Type | Shape | Meaning |
|---|---|---|---|---|
| Input | audio | float32 | [1, 513, frames] | Source audio magnitude spectrogram, with frequency before time. |
| Input | audio_length | int64 | [1] | Number of source spectrogram frames. |
| Input | src_tone | float32 | [1, 256, 1] | Embedding of the source or base voice. |
| Input | dest_tone | float32 | [1, 256, 1] | Embedding of the target voice. |
| Input | tau | float32 | [1] | Explicit latent perturbation scale. |
| Output | converted_audio | float32 | [1, 1, length] | Mono waveform at 22050 Hz; the first two axes are batch and channel. |
For a single unpadded input, set audio_length[0] to frames. Read
converted_audio[0, 0, :] to obtain the one-dimensional waveform. These samples
are audio data; encoding them as WAV or another format is the caller's responsibility.
Prepare the spectrogram outside the ONNX graphs. The same preprocessing applies to reference audio and source audio; only the tensor axis order differs.
Decode and resample to mono float PCM at 22050 Hz, using the conventional
PCM amplitude scale of approximately [-1, 1]. Then match the upstream
spectrogram_torch implementation:
| Parameter | Value |
|---|---|
FFT size (n_fft / filter_length) | 1024 |
| Hop length | 256 |
| Window length | 1024 |
| Window | Periodic Hann |
| Padding before STFT | Reflect padding, 384 samples on each side |
| STFT centering | false |
| FFT normalization | false |
| Frequency bins | One-sided, 513 bins |
| Spectrum values | Linear magnitude: sqrt(real * real + imag * imag + 1e-6) |
Use a library with these settings or reproduce the same window, padding, FFT scaling, and magnitude calculation. The graphs expect this linear spectrum, with no mel projection or logarithmic scaling.
tone_extract.onnx. Reshape the
results to [1, 256, 1] for src_tone and dest_tone.[1, 513, frames].tone_color.onnx with the source spectrogram, its frame count, both
embeddings, and an explicit tau value.converted_audio and encode or play it at
22050 Hz. Resample separately if the output device needs another rate.These models are used by Tsubaki TTS Engine for local C#/.NET text-to-speech with Piper synthesis, OpenVoice V2 voice cloning, and audio streaming without a Python runtime.
tautau is a required ONNX input and has no automatic default. In the upstream
Python implementation, the internal voice_conversion() method defaults to
1.0, while the public ToneColorConverter.convert() method
defaults to 0.3.
This export contains a fixed noise tensor. tau scales the latent
perturbation drawn from that tensor: lower values reduce the perturbation, and
0 removes its contribution. Repeated CPU calls with identical inputs and
tau values produced identical output in verification. Fresh noise is not
sampled on each call.
The converter's fixed noise tensor has shape [1, 192, 32768], limiting a single
conversion to 32768 spectrogram frames despite the dynamic time axis.
At a hop length of 256 and output rate of 22050 Hz, this corresponds to
approximately 380 seconds of output audio. Split longer audio into shorter
chunks before conversion.
| Model | ONNX opset | ONNX IR version | Export producer metadata |
|---|---|---|---|
tone_extract.onnx | 11 | 6 | PyTorch 2.1.2 |
tone_color.onnx | 17 | 8 | PyTorch 2.1.2 |
CPU inference was verified with ONNX Runtime 1.29.0, including dynamic frame
counts and explicit tau values. Execution-provider support and performance
depend on the runtime, hardware, and application.
The export script and exact upstream checkpoint revision are not included in this package. The metadata above describes the distributed ONNX files.
The original OpenVoice V2 architecture and weights are released by MyShell and the OpenVoice contributors under the MIT License. The ONNX model files in this repository are distributed under the same terms.
Commercial and non-commercial use are permitted under the MIT License.
Preserve the copyright and permission notice when redistributing the files.
See LICENSE for the full original notice, including
Copyright 2024 MyShell.ai.
Upstream project: myshell-ai/OpenVoice.