Native C++ runtime for VieNeu-TTS, focused on local Vietnamese text-to-speech inference, voice presets, and zero-shot voice cloning.
llama.cpp for the backbone and native acoustic weights.voices_v3_turbo.json.Download the model assets from Hugging Face:
The convenience script scripts/run-v3-tts-test.ps1 downloads the required v3 ONNX assets into .models/vieneu-v3-turbo automatically. Native v3 assets such as backbone.gguf, vieneu_v3_heads.npz, and acoustic/vieneu_acoustic_weights.npz can be exported with the scripts in scripts/.
Requirements:
llama.cpp submodule at third_party/llama.cppOn Windows, the easiest path is:
scripts\build-local.ps1
Useful options:
scripts\build-local.ps1 -Clean
scripts\build-local.ps1 -NoPackage
scripts\build-local.ps1 -OnnxRuntimeVersion 1.24.4
Manual CMake build:
cmake -S . -B build -DONNXRUNTIME_ROOT="C:/path/to/onnxruntime" -DVIENEU_LLAMA_DIR="third_party/llama.cpp"
cmake --build build --config Release
Build outputs include:
vieneu-tts-core: static runtime libraryvieneu-tts: shared library exposing the C ABIvieneu-tts-cli: command-line synthesizertest-abi-c: C ABI compile testRun a VieNeu v3 ONNX smoke test:
scripts\run-v3-tts-test.ps1 `
-Text "Xin chào, đây là bài kiểm tra VieNeu TTS v3 Turbo từ runtime C++." `
-Output outputs\vieneu-v3-test.wav
Run the CLI directly after building:
build\Release\vieneu-tts-cli.exe `
--profile vieneu-v3-onnx `
--model-dir .models\vieneu-v3-turbo `
--onnx-dir .models\vieneu-v3-turbo\onnx `
--codec-dir .models\vieneu-v3-turbo\codec `
--voices-json .models\vieneu-v3-turbo\voices_v3_turbo.json `
--text "Xin chào, tôi là giọng nói tiếng Việt được tổng hợp bằng C++." `
--output outputs\hello.wav
Run native v3 voice cloning benchmark with the included reference clips:
scripts\run-v3-native-voice-clone-benchmark.ps1 -NoBuild
Run one reference only:
scripts\run-v3-native-voice-clone-benchmark.ps1 -NoBuild -Ref example_3
Generated WAV files are written to outputs/ by default.
vieneu-tts-cli supports these profiles:
vieneu-v3-onnx: v3 model assets plus ONNX Runtime sessions.vieneu-v3-native: v3 model directory with native GGUF/backbone assets and MOSS codec.vieneu-v2-turbo: legacy GGUF speech LM path with ONNX encoder/decoder assets.Common options:
--profile NAME
--model-dir PATH
--onnx-dir PATH
--codec-dir PATH
--voices-json PATH
--ref-audio PATH
--text TEXT
--voice ID
--output PATH
--temperature VALUE
--top-k VALUE
--top-p VALUE
--max-new-frames N
--max-chars N
--threads N
src/
vieneu/ Stable C ABI and VieNeu v2/v3 runtime orchestration
codecs/ ONNX Runtime helpers for audio codec models
backends/ llama.cpp wrappers for GGUF/backbone inference
tools/
vieneu-tts-cli.cpp
scripts/
build-local.ps1
run-v3-tts-test.ps1
run-v3-native-preset-benchmark.ps1
run-v3-native-voice-clone-benchmark.ps1
export-v3-native-assets.py
export-v3-acoustic-weights.py
examples/
audio_ref/ Reference clips and transcript manifest for voice cloning
docs/
v3-native-cpp-pipeline.md
The C API is defined in src/vieneu/vieneu_tts.h. It is intended for wrappers and host applications that want to embed VieNeu-TTS.cpp without depending on C++ symbols.
Minimal shape:
#include "vieneu/vieneu_tts.h"
#include <stdio.h>
int main(void) {
struct vieneu_init_params_v2 init;
vieneu_init_v2_default_params(&init);
init.profile = "vieneu-v3-onnx";
init.model_dir = ".models/vieneu-v3-turbo";
init.onnx_dir = ".models/vieneu-v3-turbo/onnx";
init.codec_dir = ".models/vieneu-v3-turbo/codec";
init.voices_json_path = ".models/vieneu-v3-turbo/voices_v3_turbo.json";
struct vieneu_context *ctx = vieneu_init_v2(&init);
if (!ctx) {
fprintf(stderr, "init failed: %s\n", vieneu_last_error());
return 1;
}
struct vieneu_tts_params_v2 tts;
vieneu_tts_v2_default_params(&tts);
tts.text = "Xin chào các bạn.";
tts.temperature = 0.8f;
tts.top_k = 25;
struct vieneu_audio audio;
if (vieneu_synthesize_v2(ctx, &tts, &audio) != 0) {
fprintf(stderr, "synthesis failed: %s\n", vieneu_last_error());
vieneu_free(ctx);
return 1;
}
printf("Generated %d samples at %d Hz\n", audio.n_samples, audio.sample_rate);
vieneu_audio_free(&audio);
vieneu_free(ctx);
return 0;
}
.models/ or download them from Hugging Face..models/, build/, dist/, and outputs/ directories are local working directories.docs/v3-native-cpp-pipeline.md.Special thanks to pnnbao97 and the original pnnbao97/VieNeu-TTS project for the Vietnamese TTS model and reference implementation that this C++ runtime is based on.
Thanks also to the authors and maintainers of llama.cpp, ONNX Runtime, and MOSS Audio Tokenizer.
This project is licensed under the MIT License. See LICENSE for details.
36 commits
C++
76.7%
PowerShell
17.7%
CMake
2.5%
Python
2.0%
C
1.0%
Native C++ runtime for VieNeu-TTS, focused on local Vietnamese text-to-speech inference, voice presets, and zero-shot voice cloning.
llama.cpp for the backbone and native acoustic weights.voices_v3_turbo.json.Download the model assets from Hugging Face:
The convenience script scripts/run-v3-tts-test.ps1 downloads the required v3 ONNX assets into .models/vieneu-v3-turbo automatically. Native v3 assets such as backbone.gguf, vieneu_v3_heads.npz, and acoustic/vieneu_acoustic_weights.npz can be exported with the scripts in scripts/.
Requirements:
llama.cpp submodule at third_party/llama.cppOn Windows, the easiest path is:
scripts\build-local.ps1
Useful options:
scripts\build-local.ps1 -Clean
scripts\build-local.ps1 -NoPackage
scripts\build-local.ps1 -OnnxRuntimeVersion 1.24.4
Manual CMake build:
cmake -S . -B build -DONNXRUNTIME_ROOT="C:/path/to/onnxruntime" -DVIENEU_LLAMA_DIR="third_party/llama.cpp"
cmake --build build --config Release
Build outputs include:
vieneu-tts-core: static runtime libraryvieneu-tts: shared library exposing the C ABIvieneu-tts-cli: command-line synthesizertest-abi-c: C ABI compile testRun a VieNeu v3 ONNX smoke test:
scripts\run-v3-tts-test.ps1 `
-Text "Xin chào, đây là bài kiểm tra VieNeu TTS v3 Turbo từ runtime C++." `
-Output outputs\vieneu-v3-test.wav
Run the CLI directly after building:
build\Release\vieneu-tts-cli.exe `
--profile vieneu-v3-onnx `
--model-dir .models\vieneu-v3-turbo `
--onnx-dir .models\vieneu-v3-turbo\onnx `
--codec-dir .models\vieneu-v3-turbo\codec `
--voices-json .models\vieneu-v3-turbo\voices_v3_turbo.json `
--text "Xin chào, tôi là giọng nói tiếng Việt được tổng hợp bằng C++." `
--output outputs\hello.wav
Run native v3 voice cloning benchmark with the included reference clips:
scripts\run-v3-native-voice-clone-benchmark.ps1 -NoBuild
Run one reference only:
scripts\run-v3-native-voice-clone-benchmark.ps1 -NoBuild -Ref example_3
Generated WAV files are written to outputs/ by default.
vieneu-tts-cli supports these profiles:
vieneu-v3-onnx: v3 model assets plus ONNX Runtime sessions.vieneu-v3-native: v3 model directory with native GGUF/backbone assets and MOSS codec.vieneu-v2-turbo: legacy GGUF speech LM path with ONNX encoder/decoder assets.Common options:
--profile NAME
--model-dir PATH
--onnx-dir PATH
--codec-dir PATH
--voices-json PATH
--ref-audio PATH
--text TEXT
--voice ID
--output PATH
--temperature VALUE
--top-k VALUE
--top-p VALUE
--max-new-frames N
--max-chars N
--threads N
src/
vieneu/ Stable C ABI and VieNeu v2/v3 runtime orchestration
codecs/ ONNX Runtime helpers for audio codec models
backends/ llama.cpp wrappers for GGUF/backbone inference
tools/
vieneu-tts-cli.cpp
scripts/
build-local.ps1
run-v3-tts-test.ps1
run-v3-native-preset-benchmark.ps1
run-v3-native-voice-clone-benchmark.ps1
export-v3-native-assets.py
export-v3-acoustic-weights.py
examples/
audio_ref/ Reference clips and transcript manifest for voice cloning
docs/
v3-native-cpp-pipeline.md
The C API is defined in src/vieneu/vieneu_tts.h. It is intended for wrappers and host applications that want to embed VieNeu-TTS.cpp without depending on C++ symbols.
Minimal shape:
#include "vieneu/vieneu_tts.h"
#include <stdio.h>
int main(void) {
struct vieneu_init_params_v2 init;
vieneu_init_v2_default_params(&init);
init.profile = "vieneu-v3-onnx";
init.model_dir = ".models/vieneu-v3-turbo";
init.onnx_dir = ".models/vieneu-v3-turbo/onnx";
init.codec_dir = ".models/vieneu-v3-turbo/codec";
init.voices_json_path = ".models/vieneu-v3-turbo/voices_v3_turbo.json";
struct vieneu_context *ctx = vieneu_init_v2(&init);
if (!ctx) {
fprintf(stderr, "init failed: %s\n", vieneu_last_error());
return 1;
}
struct vieneu_tts_params_v2 tts;
vieneu_tts_v2_default_params(&tts);
tts.text = "Xin chào các bạn.";
tts.temperature = 0.8f;
tts.top_k = 25;
struct vieneu_audio audio;
if (vieneu_synthesize_v2(ctx, &tts, &audio) != 0) {
fprintf(stderr, "synthesis failed: %s\n", vieneu_last_error());
vieneu_free(ctx);
return 1;
}
printf("Generated %d samples at %d Hz\n", audio.n_samples, audio.sample_rate);
vieneu_audio_free(&audio);
vieneu_free(ctx);
return 0;
}
.models/ or download them from Hugging Face..models/, build/, dist/, and outputs/ directories are local working directories.docs/v3-native-cpp-pipeline.md.Special thanks to pnnbao97 and the original pnnbao97/VieNeu-TTS project for the Vietnamese TTS model and reference implementation that this C++ runtime is based on.
Thanks also to the authors and maintainers of llama.cpp, ONNX Runtime, and MOSS Audio Tokenizer.
This project is licensed under the MIT License. See LICENSE for details.
36 commits
C++
76.7%
PowerShell
17.7%
CMake
2.5%
Python
2.0%
C
1.0%