OpenMOSS's MOSS-TTS-Realtime: Chinese and English TTS.
Two files make one model, as with llama.cpp's multimodal projectors: the model file is the text-to-speech LM backbone, run by llama.cpp; the codec file holds the audio side (decoder / vocoder, speaker encoders and the adaptor between the two), run by codec.cpp. The runtimes below wire the two graphs together, on CPU or GPU (CUDA, Vulkan, Metal), fully offline.
Every run needs one model file + one codec file from this repo.
--backbone |
--model (codec) |
Total | |
|---|---|---|---|
| Recommended | moss-tts-realtime-bf16.gguf |
codec-q8_0.gguf |
5.9 GB |
| Smaller | moss-tts-realtime-q8_0.gguf |
codec-q4_k_m.gguf |
3.4 GB |
| Best quality | moss-tts-realtime-bf16.gguf |
codec-f16.gguf |
7.6 GB |
Use the bf16 model file where you can; lower-precision model files lose intelligibility first.
| File | Size |
|---|---|
codec-f32.gguf |
7.7 GB |
codec-q5_k_m.gguf |
1.8 GB |
moss-tts-realtime-f16.gguf |
3.4 GB |
moss-tts-realtime-f32.gguf |
6.9 GB |
moss-tts-realtime-q2_k.gguf |
778 MB |
moss-tts-realtime-q3_k_l.gguf |
1.0 GB |
moss-tts-realtime-q3_k_m.gguf |
940 MB |
moss-tts-realtime-q3_k_s.gguf |
867 MB |
moss-tts-realtime-q4_0.gguf |
1.1 GB |
moss-tts-realtime-q4_1.gguf |
1.1 GB |
moss-tts-realtime-q4_k_m.gguf |
1.1 GB |
moss-tts-realtime-q4_k_s.gguf |
1.1 GB |
moss-tts-realtime-q5_0.gguf |
1.2 GB |
moss-tts-realtime-q5_1.gguf |
1.3 GB |
moss-tts-realtime-q5_k_m.gguf |
1.3 GB |
moss-tts-realtime-q5_k_s.gguf |
1.2 GB |
moss-tts-realtime-q6_k.gguf |
1.4 GB |
With codec.cpp's tts-cli (build it; it bundles llama.cpp), then:
hf download BricksDisplay/MOSS-TTS-Realtime-GGUF moss-tts-realtime-bf16.gguf codec-q8_0.gguf --local-dir MOSS-TTS-Realtime
./build/tts-cli synthesize --backbone MOSS-TTS-Realtime/moss-tts-realtime-bf16.gguf --model MOSS-TTS-Realtime/codec-q8_0.gguf \
--temp 0.8 --top-p 0.6 --top-k 30 --rep-penalty 1.1 \
--text "你好,欢迎使用语音合成。" --output out.wav
All tts-cli options (voices, voice cloning, sampling, GPU) are described in the codec.cpp README.
The codec_cpp package runs the same pipeline (it builds codec.cpp with its
bundled llama.cpp, so it needs CMake and a C++ compiler):
pip install "codec-cpp @ git+https://github.com/mybigday/codec.cpp" huggingface_hub soundfile
import codec_cpp, soundfile
from huggingface_hub import hf_hub_download
tts = codec_cpp.TTS(hf_hub_download("BricksDisplay/MOSS-TTS-Realtime-GGUF", "moss-tts-realtime-bf16.gguf"),
hf_hub_download("BricksDisplay/MOSS-TTS-Realtime-GGUF", "codec-q8_0.gguf"))
audio, sr = tts.synthesize("你好,欢迎使用语音合成。",
temperature=0.8, top_p=0.6, top_k=30, repetition_penalty=1.1)
soundfile.write("out.wav", audio, sr)
tts.voices() lists the builtin voices; ref_audio= clones a voice where the
model supports it; tts.stream(text) yields audio as it is generated. More in
the Python docs.
llama.rn loads the same two files on iOS and Android:
const ctx = await initLlama({ model: 'moss-tts-realtime-bf16.gguf', embedding: true })
await ctx.initVocoder({ path: 'codec-q8_0.gguf' })
const { prompt, grammar, embedding, flow } = await ctx.getFormattedAudioCompletion({
prompt: 'Hello world',
})
const result = await ctx.completion({ prompt, grammar, embedding })
const pcm = flow === 'continuous_embd'
? await ctx.decodeAudioEmbeddings(result.embeddings, result.embedding_dim)
: await ctx.decodeAudioTokens(result.audio_tokens)
Voice cloning, saved voices and per-model notes: llama.rn TTS docs.
The sampling flags in the example are the upstream settings; keep them.
The model files carry the recommended sampling as llama.cpp's
general.sampling.* metadata, the settings of the original streaming inference code;
tts-cli, tts-server, llama.rn and any llama.cpp host apply them unless
you set your own.
| Setting | Value | tts-cli flag |
|---|---|---|
| temperature | 0.8 | --temp 0.8 |
| top-k | 30 | --top-k 30 |
| top-p | 0.6 | --top-p 0.6 |
| min-p | 0 (off) | --min-p 0.0 |
| repetition penalty | 1.1 | --repeat-penalty 1.1 |
| repetition window | 50 | --repeat-last-n 50 |
| sampler order | penalties → temperature → top-k → top-p | --samplers "penalties;temperature;top_k;top_p" |
Each of the 16 codebooks keeps its own repetition window.
apache-2.0, the same as the original model.
OpenMOSS-Team/MOSS-TTS-Realtime