qwen3_tts_rs
App Listed
A Rust implementation of the Qwen3 Text-to-Speech (TTS) model inference.
- Downloads
- 204
- Dependents
- Not applicable
- Stars
- 237
- Forks
- 40
- Contributors
- 2
- Commits
- 115
- Latest release
About
Qwen3 TTS - Rust CLI tools
A Rust implementation of the Qwen3 Text-to-Speech (TTS) model inference. Provides three cross-platform CLI tools suitable for agentic skills for AI agents and bots.
- tts — generate speech from text with named speaker voices
- voice_clone — clone a voice from reference audio
- api_server — OpenAI-compatible HTTP API server
Supports two backends: libtorch (via the tch crate, cross-platform with optional CUDA) and MLX (Apple Silicon native via Metal GPU).
Learn more:
- A Rust implementation / CLI for Qwen3's ASR (Automatic Speech Recognition or Speech-to-Text) models
- An OpenAI compatible API server for audio / speech
- An OpenClaw SKILL for voice generation. Copy and Paste to your lobster to install it
Quick Start
Install binaries, models, and reference audio for your platform:
curl -sSf https://raw.githubusercontent.com/second-state/qwen3_tts_rs/main/install.sh | bash
cd qwen3_tts_rs
The installer detects your OS, CPU, and NVIDIA GPU (if present), then sets up everything in ./qwen3_tts_rs/.
Text-to-Speech
Generate speech with a named speaker using the CustomVoice model:
Read the full README
./tts models/Qwen3-TTS-12Hz-0.6B-CustomVoice "Hello world, this is a test." Vivian english
# Output: output.wav (24 kHz)
Voice Cloning
Clone a voice from reference audio using the Base model (ICL mode):
./voice_clone models/Qwen3-TTS-12Hz-0.6B-Base reference_audio/trump.wav \
"Hello, this is a voice cloning test." english \
"Angered and appalled millions of Americans across the political spectrum"
# Output: output_voice_clone.wav (24 kHz)
API Server
Start the OpenAI-compatible API server with the CustomVoice model:
./api_server models/Qwen3-TTS-12Hz-0.6B-CustomVoice --port 8080
Then call the endpoint:
curl -X POST http://localhost:8080/v1/audio/speech \
-H "Content-Type: application/json" \
-d '{"input": "Hello world!", "voice": "alloy"}' \
-o output.wav
Reference
tts — Text-to-Speech
tts <model_path> [text] [speaker] [language] [instruction]
| Argument | Default | Description |
|---|---|---|
model_path | (required) | Path to model directory |
text | "Hello! This is a test..." | Text to synthesize (max ~4096 chars) |
speaker | Vivian | Speaker name (see below) |
language | english | Language: english, chinese, japanese, korean |
instruction | (empty) | Voice style instruction (1.7B models only) |
Output: output.wav (24 kHz, 16-bit PCM)
Available speakers (CustomVoice models): Vivian, Serena, Ryan, Aiden, Uncle_fu, Ono_anna, Sohee, Eric, Dylan
Instruction examples (1.7B CustomVoice only):
"Speak in an urgent and excited voice""Speak happily and joyfully""Speak slowly and calmly""Speak in a whisper"
voice_clone — Voice Cloning
voice_clone <model_path> <ref_audio> [text] [language] [ref_text]
| Argument | Default | Description |
|---|---|---|
model_path | (required) | Path to model directory |
ref_audio | (required) | Path to reference WAV file |
text | "Hello! This is a test..." | Text to synthesize |
language | english | Language |
ref_text | (none) | Transcript of reference audio (enables ICL mode, higher quality) |
Output: output_voice_clone.wav (24 kHz, 16-bit PCM)
Preparing reference audio: Must be mono 24 kHz 16-bit WAV. Convert with ffmpeg:
ffmpeg -i input.m4a -ac 1 -ar 24000 -sample_fmt s16 reference.wav
Example:
./voice_clone models/Qwen3-TTS-12Hz-0.6B-Base reference_audio/trump.wav \
"Hello, this is a voice cloning test." english \
"Angered and appalled millions of Americans across the political spectrum"
api_server — OpenAI-Compatible API
api_server <model_path> [--host 127.0.0.1] [--port 8080]
| Option | Default | Description |
|---|---|---|
model_path | (required) | Path to model directory |
--host | 127.0.0.1 | Bind address |
--port | 8080 | Listen port |
Endpoints:
| Method | Path | Description |
|---|---|---|
| POST | /v1/audio/speech | Generate speech (OpenAI-compatible) |
| GET | /v1/models | List available models |
| GET | /health | Health check |
API Request: POST /v1/audio/speech
{
"input": "Text to synthesize",
"voice": "alloy",
"model": "qwen3-tts",
"response_format": "wav",
"speed": 1.0,
"stream": false,
"language": "english",
"instructions": "Speak urgently",
"audio_sample": "<base64-encoded WAV>",
"audio_sample_text": "Transcript of the reference audio"
}
| Field | Type | Default | Description |
|---|---|---|---|
input | string | (required) | Text to synthesize (max 4096 chars) |
voice | string | "alloy" | OpenAI name or Qwen3 speaker name (see mapping below) |
model | string | — | Accepted for compatibility, ignored |
response_format | string | "wav" | "wav", "pcm", "mp3", "flac", "ogg", or "opus" |
speed | float | 1.0 | Speed multiplier (0.25–4.0) |
stream | bool | false | Enable SSE streaming (requires "pcm") |
language | string | "english" | english, chinese, japanese, korean, auto |
instructions | string | — | Voice style instruction (1.7B models only) |
audio_sample | string | — | Base64-encoded reference WAV for voice cloning |
audio_sample_text | string | — | Transcript of reference audio (required with audio_sample) |
Voice name mapping (OpenAI → Qwen3):
| OpenAI | Qwen3 |
|---|---|
| alloy | serena |
| echo | ryan |
| fable | vivian |
| onyx | eric |
| nova | ono_anna |
| shimmer | sohee |
You can also pass Qwen3 speaker names directly (e.g., "voice": "vivian").
Streaming: When stream: true and response_format: "pcm", the server returns Server-Sent Events with base64-encoded PCM chunks:
data: {"type":"speech.audio.delta","delta":"<base64 PCM>"}
data: {"type":"speech.audio.done"}
Voice cloning via API:
# Encode reference audio as base64
REF_B64=$(base64 < reference.wav)
curl -X POST http://localhost:8080/v1/audio/speech \
-H "Content-Type: application/json" \
-d "{
\"input\": \"Hello from a cloned voice.\",
\"voice\": \"alloy\",
\"audio_sample\": \"$REF_B64\",
\"audio_sample_text\": \"Transcript of the reference audio\"
}" -o cloned.wav
Build from Source
macOS (MLX backend)
Requires Apple Silicon Mac, Xcode, and CMake.
brew install cmake
git clone https://github.com/second-state/qwen3_tts_rs.git
cd qwen3_tts_rs
git submodule update --init --recursive
cargo build --release --no-default-features --features mlx
Linux (libtorch backend)
1. Download libtorch from libtorch-releases:
# Linux x86_64 (CPU)
curl -LO https://github.com/second-state/libtorch-releases/releases/download/v2.7.1/libtorch-cxx11-abi-x86_64-2.7.1.tar.gz
tar xzf libtorch-cxx11-abi-x86_64-2.7.1.tar.gz
# Linux x86_64 (CUDA 12.6)
curl -LO https://github.com/second-state/libtorch-releases/releases/download/v2.7.1/libtorch-cxx11-abi-x86_64-cuda12.6-2.7.1.tar.gz
tar xzf libtorch-cxx11-abi-x86_64-cuda12.6-2.7.1.tar.gz
# Linux ARM64 (CPU)
curl -LO https://github.com/second-state/libtorch-releases/releases/download/v2.7.1/libtorch-cxx11-abi-aarch64-2.7.1.tar.gz
tar xzf libtorch-cxx11-abi-aarch64-2.7.1.tar.gz
# Linux ARM64 (CUDA 12.6 / Jetson)
curl -LO https://github.com/second-state/libtorch-releases/releases/download/v2.7.1/libtorch-cxx11-abi-aarch64-cuda12.6-2.7.1.tar.gz
tar xzf libtorch-cxx11-abi-aarch64-cuda12.6-2.7.1.tar.gz
2. Set environment and build:
export LIBTORCH=$(pwd)/libtorch
export LIBTORCH_BYPASS_VERSION_CHECK=1
git clone https://github.com/second-state/qwen3_tts_rs.git
cd qwen3_tts_rs
cargo build --release
Alternatively, use pip-installed PyTorch instead of downloading libtorch:
pip install torch==2.7.1
export LIBTORCH_USE_PYTORCH=1
export LD_LIBRARY_PATH=$(python3 -c "import torch; print(torch.__path__[0])")/lib:$LD_LIBRARY_PATH
Download models and generate tokenizer
After building, download models and generate tokenizer.json for each:
pip install huggingface_hub transformers
huggingface-cli download Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice --local-dir models/Qwen3-TTS-12Hz-0.6B-CustomVoice
python3 -c "
from transformers import AutoTokenizer
for model in ['Qwen3-TTS-12Hz-0.6B-CustomVoice', 'Qwen3-TTS-12Hz-0.6B-Base', 'Qwen3-TTS-12Hz-1.7B-CustomVoice']:
path = f'models/{model}'
try:
tok = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
tok.backend_tokenizer.save(f'{path}/tokenizer.json')
print(f'Saved {path}/tokenizer.json')
except Exception as e:
print(f'Skipped {model}: {e}')
"
Binaries are in target/release/: tts, voice_clone, api_server.
Rust library usage
Add to your Cargo.toml:
[dependencies]
qwen3-tts-rs = "0.2"
# Or for MLX backend:
# qwen3-tts-rs = { version = "0.2", default-features = false, features = ["mlx"] }
See the API documentation on docs.rs for library usage examples.
Performance (Apple M4 Mac, MLX backend)
Test sentences: ~15–20 words in English ("The quick brown fox..." / "Scientists have discovered...") and Chinese. RTF = Real-Time Factor (wall time / audio duration). Lower is better; < 1.0 means faster than real-time.
0.6B CustomVoice
CLI (tts / voice_clone)
| Test | Speaker | Language | Audio | Wall Time | RTF |
|---|---|---|---|---|---|
| Preset voice | Vivian | English | 5.92s | 10.93s | 1.85x |
| Preset voice | Ryan | English | 8.16s | 14.15s | 1.73x |
| Preset voice | Vivian | Chinese | 6.64s | 11.26s | 1.70x |
| Voice clone (ICL) | ref audio | English | 7.04s | 16.77s | 2.38x |
API server (after warmup)
| Test | Voice | Mode | Audio | Wall Time | RTF |
|---|---|---|---|---|---|
| Non-streaming WAV | alloy (serena) | full | 6.40s | 9.90s | 1.55x |
| Non-streaming WAV | echo (ryan) | full | 8.00s | 12.70s | 1.59x |
| Streaming PCM | alloy (serena) | stream | ~6.4s | 10.22s | ~1.60x |
| Voice clone WAV | alloy + ref | full | 9.04s | 20.11s | 2.22x |
1.7B CustomVoice
CLI (tts)
| Test | Speaker | Language | Audio | Wall Time | RTF |
|---|---|---|---|---|---|
| Preset voice | Vivian | English | 6.24s | 18.92s | 3.03x |
| Preset voice | Ryan | English | 8.64s | 27.50s | 3.18x |
| Preset voice | Vivian | Chinese | 6.24s | 18.31s | 2.93x |
| Preset + instruction | Vivian | English | 8.80s | 29.97s | 3.41x |
API server (after warmup)
| Test | Voice | Mode | Audio | Wall Time | RTF |
|---|---|---|---|---|---|
| Non-streaming WAV | alloy (serena) | full | 5.52s | 15.14s | 2.74x |
| Non-streaming WAV | echo (ryan) | full | 8.64s | 26.31s | 3.05x |
| Streaming PCM | alloy (serena) | stream | 8.16s | 19.79s | 2.43x |
0.6B vs 1.7B comparison
| Metric | 0.6B avg RTF | 1.7B avg RTF | Slowdown |
|---|---|---|---|
| CLI preset voice | 1.76x | 3.05x | ~1.7x |
| API non-streaming | 1.57x | 2.90x | ~1.8x |
Architecture
Text → Tokenizer → Dual-stream Embeddings → TalkerModel (28-layer Transformer)
↓
codec_head → Code 0
↓
CodePredictor (5-layer Transformer) → Codes 1-15
↓
Vocoder → 24kHz Waveform
License
Apache-2.0
Credits
Based on the original Python implementation by the Alibaba Qwen team.
Compatibility
- License
- None stated
- Crate facts
- Not measured
- Runs on, Native code and Python bindings read crates on crates.io. This entry lists no crate.
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
A Rust implementation of the Qwen3 Text-to-Speech (TTS) model inference. |
204 binary downloads per release | Not applicable | 237 | Not measured | Not measured | None stated | |
|
sherpa-onnx Featured
Safe Rust wrapper for sherpa-onnx speech recognition toolkit Also in Run and serve models. |
259,599 downloads over 30 days | 28 | 15,834 | 2.0.1 | GPU support unknown | Binds native code: sherpa-onnx, sherpa-onnx-sys | Apache-2.0 |
|
silero Listed
Production-oriented Rust wrapper for the Silero VAD ONNX model. Also in Run and serve models. |
1,888 downloads over 30 days | 3 | 6 | 0.7.0 | CUDA, ROCm | Binds native code: ort-sys (feature coreml) | Apache-2.0 OR MIT |
|
qwen3-asr-rs Listed
Pure Rust implementation of Qwen3 ASR (Automatic Speech Recognition) with libtorch and MLX backends Also in Speech and audio. |
21 downloads over 30 days | 0 | 254 | 0.2.0 | CUDA | Binds native code: torch-sys (feature tch-backend). Build uses a native toolchain: cmake | Apache-2.0 |
|
kitten-tts-rs Listed
Rust port of KittenTTS — ultra-lightweight ONNX-based text-to-speech Also in Run and serve models. |
3 downloads over 30 days | 0 | 314 | 0.2.2 | CUDA | Binds native code: audiopus_sys, mp3lame-sys, ort-sys | Apache-2.0 |
|
cohere-transcribe-rs Listed
Rust implementation for the CohereLabs/cohere-transcribe-03-2026 speech-to-text model. Includes a CLI and an OpenAI-compatible API server. Also in Speech and audio. |
0 downloads over 30 days | 0 | 101 | 0.1.1 | CUDA | Binds native code: torch-sys (feature tch-backend). Build uses a native toolchain: cmake | Apache-2.0 |
|
voxr New
Audio and speech on boostr: compressed-audio decode, resampling, DSP and grapheme to phoneme, with speech synthesis (Kokoro, VITS), voice cloning (VoxCPM2), transcription with word timings (Whisper), voice activity (Silero) and audio-text scoring (CLAP), on CPU or CUDA. Also in Speech and audio. |
642 downloads over 30 days | 2 | 2 | 0.9.1 | CUDA | No native code found | Apache-2.0 |
All projects in Run and serve modelsAll projects in Speech and audio
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- The check holds no value for Homebrew installs on request over 365 days, Repology repository families, Docker pull growth over 90 days. A gate that lacks its signal does not pass.
What else the check found
- The last activity is on 19 May 2026, 174 days ago. The rules expect an update within 365 days. Dormancy rule
Not measured: First release, Homebrew installs on request over 365 days, Repology repository families, Docker pull growth over 90 days.
Exact rules: Listed, Featured app. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: app: E = 365 daysdormancy: last activity 2026-05-19, 174 days ago, E = 365: activefeatured: not featured: unknown homebrew_on_request_365d, repology_families, docker_pull_growth_90dlisted: listed: no archive, new or featured rule applies
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources4 sources
- Description: the GitHub repository description
- GitHub releases, fetched
- GitHub repository, fetched
- GitHub contributors, fetched
Adoption204 binary downloads per release4 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | Not measured | Yes | ||
| New dependents (365 days) | Not measured | Yes | ||
| Peak active dependents | Not measured | Yes | ||
| Active dependents as a share of the peak | Not measured | Yes | ||
| Binary downloads per release | 204 | GitHub releases | Yes |
MaintenanceLatest human commit: 5 months ago7 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-05-19 | GitHub repository | Yes | |
| Latest release | 2026-03-29 | GitHub releases | Yes | |
| First release | Not measured | Yes | ||
| Latest version | Not measured | Yes | ||
| Days the oldest outside issue waits for a reply | 252 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 0 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | Not measured | Yes | ||
| Published docs | Not measured | Yes | ||
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityNot measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | Not measured | Yes | ||
| RustSec unmaintained advisory | Not measured | Yes | ||
| Deprecation notice | Not measured | Yes | ||
| Deprecated requirement | Not measured | Yes |
Distribution612 binary downloads over the last 3 releases10 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | Not measured | Yes | ||
| Downloads over 30 days | Not measured | Yes | ||
| Binary downloads over the last 3 releases | 612 | GitHub releases | Yes | |
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | Not measured | Yes | ||
| Every version 0.0.x | Not measured | Yes | ||
| Every version yanked | Not measured | Yes | ||
| Crate deleted from crates.io | Not measured | Yes |
Repository237 stars, 40 forks, 2 contributors, 115 commits. Stars alone never qualify a project.1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 237 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 40 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 2 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 115 | GitHub repository | No | |
| Repository's main crate left out of the entry | Not measured | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | None stated | GitHub repository | No | |
| Runs on, from listed crates and their direct dependencies | Not measured | No | ||
| What shows each backend | Not measured | No | ||
| Native code, from listed crates and their dependencies | Not measured | No | ||
| Python bindings, from direct dependencies of listed crates | Not measured | No | ||
| Crates that depend on a listed crate directly | Not measured | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.