A Rust implementation of OmniVoice TTS inference using the Candle ML framework. Generates speech from text with voice cloning, voice design, and automatic speech recognition support.
--ref-text is omittedgit clone https://github.com/k2-fsa/OmniVoice.git
cd OmniVoice/omnivoice-rs
# CPU
cargo build --release
# macOS GPU (Metal)
cargo build --release --features metal
# NVIDIA GPU (CUDA)
cargo build --release --features cuda
Models are downloaded automatically from HuggingFace on first run.
omnivoice-rs \
--text "Hello, this is a test of the OmniVoice text to speech system." \
--output output.wav
omnivoice-rs \
--text "The quick brown fox jumps over the lazy dog." \
--instruct "female, british accent, high pitch" \
--language en \
--output styled.wav
omnivoice-rs \
--text "This sentence will be spoken in the cloned voice." \
--ref-audio reference.wav \
--ref-text "Transcript of the reference audio." \
--language en \
--output cloned.wav
When --ref-text is omitted, Whisper automatically transcribes the reference audio:
omnivoice-rs \
--text "This sentence will be spoken in the cloned voice." \
--ref-audio reference.wav \
--language en \
--output cloned.wav
The Whisper model (openai/whisper-large-v3-turbo by default) is downloaded only when needed. Use --asr-model to specify a different model.
omnivoice-rs [OPTIONS] --text <TEXT> --output <OUTPUT>
| Flag | Description |
|---|---|
--text | Text to synthesize |
--output | Output WAV file path |
| Flag | Description |
|---|---|
--ref-audio | Reference audio for voice cloning |
--ref-text | Transcript of reference audio (auto-transcribed if omitted) |
--instruct | Voice style instruction (e.g. "male, low pitch, whisper") |
--language | Language of the output text (name or ISO 639 code) |
| Flag | Default | Description |
|---|---|---|
--num-step | 32 | Iterative decoding steps |
--guidance-scale | 2.0 | Classifier-free guidance scale |
--speed | 1.0 | Speaking speed (>1 = faster) |
--duration | auto | Fixed output duration in seconds |
--t-shift | 0.1 | Noise schedule time shift |
--denoise | true | Prepend denoise conditioning token |
--postprocess-output | true | Remove silence, apply fade-in/out |
--position-temperature | 5.0 | Gumbel noise for position selection |
--class-temperature | 0.0 | Token sampling temperature (0 = greedy) |
| Flag | Default | Description |
|---|---|---|
--model | k2-fsa/OmniVoice | Model path or HuggingFace repo |
--asr-model | openai/whisper-large-v3-turbo | Whisper model for ASR |
--device | auto | cpu, cuda, or metal |
The --instruct flag accepts comma-separated attributes:
| Category | English | Chinese |
|---|---|---|
| Gender | male, female | 男, 女 |
| Age | child, teenager, young adult, middle-aged, elderly | 儿童, 少年, 青年, 中年, 老年 |
| Pitch | very low pitch ... very high pitch | 极低音调 ... 极高音调 |
| Style | whisper | 耳语 |
| Accent | american accent, british accent, indian accent, ... | -- |
| Dialect | -- | 四川话, 东北话, 河南话, ... |
| Component | Description |
|---|---|
| LLM backbone | Qwen3-0.6B (28 layers, bidirectional attention) |
| Audio codec | HiggsAudioV2 (DAC + HuBERT, 8 codebooks, 25 fps) |
| Generation | Iterative masked discrete diffusion (32 steps, CFG) |
| ASR | Whisper large-v3-turbo (on-demand) |
| Output | 24 kHz mono WAV |
The model runs on GPU (Metal/CUDA) in FP16, while the audio tokenizer and Whisper always run on CPU in FP32 for numerical stability.
src/
main.rs CLI entry point
config.rs Config deserialization
models/
omnivoice.rs Core model + iterative generation
qwen3_bidirectional.rs Qwen3 backbone (bidirectional)
dac.rs DAC encoder/decoder
hubert.rs HuBERT feature extractor
higgs_audio_v2.rs Audio tokenizer (encode/decode)
rvq.rs Residual vector quantization
semantic_codec.rs Semantic encoder/decoder
whisper_transcribe.rs Whisper ASR integration
utils/
audio.rs WAV I/O, resampling, silence removal
text.rs Text chunking, punctuation
duration.rs Duration estimation
sampling.rs Gumbel sampling, top-k filtering
voice_design.rs Instruct validation
Apache-2.0
Rust
100.0%
A Rust implementation of OmniVoice TTS inference using the Candle ML framework. Generates speech from text with voice cloning, voice design, and automatic speech recognition support.
--ref-text is omittedgit clone https://github.com/k2-fsa/OmniVoice.git
cd OmniVoice/omnivoice-rs
# CPU
cargo build --release
# macOS GPU (Metal)
cargo build --release --features metal
# NVIDIA GPU (CUDA)
cargo build --release --features cuda
Models are downloaded automatically from HuggingFace on first run.
omnivoice-rs \
--text "Hello, this is a test of the OmniVoice text to speech system." \
--output output.wav
omnivoice-rs \
--text "The quick brown fox jumps over the lazy dog." \
--instruct "female, british accent, high pitch" \
--language en \
--output styled.wav
omnivoice-rs \
--text "This sentence will be spoken in the cloned voice." \
--ref-audio reference.wav \
--ref-text "Transcript of the reference audio." \
--language en \
--output cloned.wav
When --ref-text is omitted, Whisper automatically transcribes the reference audio:
omnivoice-rs \
--text "This sentence will be spoken in the cloned voice." \
--ref-audio reference.wav \
--language en \
--output cloned.wav
The Whisper model (openai/whisper-large-v3-turbo by default) is downloaded only when needed. Use --asr-model to specify a different model.
omnivoice-rs [OPTIONS] --text <TEXT> --output <OUTPUT>
| Flag | Description |
|---|---|
--text | Text to synthesize |
--output | Output WAV file path |
| Flag | Description |
|---|---|
--ref-audio | Reference audio for voice cloning |
--ref-text | Transcript of reference audio (auto-transcribed if omitted) |
--instruct | Voice style instruction (e.g. "male, low pitch, whisper") |
--language | Language of the output text (name or ISO 639 code) |
| Flag | Default | Description |
|---|---|---|
--num-step | 32 | Iterative decoding steps |
--guidance-scale | 2.0 | Classifier-free guidance scale |
--speed | 1.0 | Speaking speed (>1 = faster) |
--duration | auto | Fixed output duration in seconds |
--t-shift | 0.1 | Noise schedule time shift |
--denoise | true | Prepend denoise conditioning token |
--postprocess-output | true | Remove silence, apply fade-in/out |
--position-temperature | 5.0 | Gumbel noise for position selection |
--class-temperature | 0.0 | Token sampling temperature (0 = greedy) |
| Flag | Default | Description |
|---|---|---|
--model | k2-fsa/OmniVoice | Model path or HuggingFace repo |
--asr-model | openai/whisper-large-v3-turbo | Whisper model for ASR |
--device | auto | cpu, cuda, or metal |
The --instruct flag accepts comma-separated attributes:
| Category | English | Chinese |
|---|---|---|
| Gender | male, female | 男, 女 |
| Age | child, teenager, young adult, middle-aged, elderly | 儿童, 少年, 青年, 中年, 老年 |
| Pitch | very low pitch ... very high pitch | 极低音调 ... 极高音调 |
| Style | whisper | 耳语 |
| Accent | american accent, british accent, indian accent, ... | -- |
| Dialect | -- | 四川话, 东北话, 河南话, ... |
| Component | Description |
|---|---|
| LLM backbone | Qwen3-0.6B (28 layers, bidirectional attention) |
| Audio codec | HiggsAudioV2 (DAC + HuBERT, 8 codebooks, 25 fps) |
| Generation | Iterative masked discrete diffusion (32 steps, CFG) |
| ASR | Whisper large-v3-turbo (on-demand) |
| Output | 24 kHz mono WAV |
The model runs on GPU (Metal/CUDA) in FP16, while the audio tokenizer and Whisper always run on CPU in FP32 for numerical stability.
src/
main.rs CLI entry point
config.rs Config deserialization
models/
omnivoice.rs Core model + iterative generation
qwen3_bidirectional.rs Qwen3 backbone (bidirectional)
dac.rs DAC encoder/decoder
hubert.rs HuBERT feature extractor
higgs_audio_v2.rs Audio tokenizer (encode/decode)
rvq.rs Residual vector quantization
semantic_codec.rs Semantic encoder/decoder
whisper_transcribe.rs Whisper ASR integration
utils/
audio.rs WAV I/O, resampling, silence removal
text.rs Text chunking, punctuation
duration.rs Duration estimation
sampling.rs Gumbel sampling, top-k filtering
voice_design.rs Instruct validation
Apache-2.0
Rust
100.0%