Skip to content

Split long Ming 3.0 TTS voice design and freeform text like the official runtime - #1034

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
hiroki-abe-58:ming3-split-voice-design
Oct 21, 2026
Merged

0xShug0 merged 1 commit into
0xShug0:mainfrom
hiroki-abe-58:ming3-split-voice-design

Conversation

@hiroki-abe-58

Copy link
Copy Markdown
Contributor

Voice design and freeform requests are never chunked, so a long text runs past the 512-position context and most of it is dropped without an error. A 404-character Japanese text comes out as 6.4 s of audio.

Upstream fixed this in 028c1eac ("improve 0.5B long-text splitting and voice consistency"). Voice design and freeform requests are now split too, and every fragment after the first takes the first generated fragment as its reference (CAM++ speaker embedding, prompt latent and its text), so the designed voice doesn't change between fragments.

This PR ports that:

  • Voice design and freeform text is chunked like the other templates.
  • After the first chunk, its audio is encoded as the reference for the rest. prepare_reference is split into an uncached encode_reference, so the generated audio never replaces the user's cached reference.
  • The reference is cut where its speech ends. The trimmed chunk keeps a 300 ms silent tail, and the reference's last latent seeds the decode history. Starting from that silence made the later chunks of a freeform Chinese request stop at once on 2 of 12 seeds; with the cut, 0 of 12.
  • Voice design and freeform chunks default to at most 120 codepoints. Each later chunk also carries the first chunk in the context, and a 300-codepoint English first chunk filled 387–417 of the 512 positions, which cut the ends of the later chunks (CER 0.150). This is close to upstream's 24-unit fragments. CJK text keeps 50.
  • raw_text=true and an explicit text_chunk_size behave as before.

Measurements

RTX 5090, Windows 11, CUDA build (120a-real), ming-3.0-tts-0.5b-bf16.gguf, seeds 1–4. CER is from Whisper large-v3-turbo with sequential long-form decoding. "Voice" is the mean cosine similarity of SpeechBrain ECAPA embeddings of 4 s windows to the first window; one designed voice scores about 0.8.

Voice design (--task vdes, instruct=落ち着いた大人の女性。明るく聞き取りやすい声で、ゆっくり話している。):

text main main + text_chunk_size (no reference reuse) this PR
Japanese, 404 chars CER 0.913, 6.4 s 0.094, voice 0.28 0.043, voice 0.78, 61.7–63.7 s
Japanese, 141 chars 0.158, voice 0.80 0.113, voice 0.30 0.068, voice 0.79
Chinese, 219 chars 0.467, 17.7 s 0.055, voice 0.70 0.009, voice 0.79, 36.7–37.8 s
English, 782 chars 0.518, 16.5 s 0.026, voice 0.41 0.017, voice 0.76, 41.5–50.8 s

Freeform (template_name=freeform, instruct=Speak in a calm, warm adult female voice at a slow pace.):

text main main + text_chunk_size this PR
Japanese, 404 chars 0.807, 14.4 s 0.043, voice 0.47 0.024, voice 0.77
Chinese, 219 chars 0.197, 25.7 s 0.010, voice 0.73 0.019, voice 0.80

For comparison, the official runtime at 028c1eac (infer.py --task FREEFORM --no_text_normalization) produced 37.5–41.3 s on the Chinese text over seeds 1–6, and this PR produces 35.6–41.4 s over seeds 1–12.

Byte checks against main:

  • Single-chunk voice design and freeform text is unchanged (12 WAVs; Japanese, Chinese and English).
  • tts is unchanged (16 WAVs).
  • Voice clone is unchanged (4 WAVs).

The branch is rebased on 41bb3f0, after #1023. A rerun of the design, freeform, tts and clone checks on the rebased build is byte-identical to the runs above (22 WAVs).

🤖 Generated with Claude Code

…ial runtime

Voice design and freeform requests were never chunked, so long text ran past the 512-position context and most of it was dropped without an error. Chunk them like the other templates and, as the official runtime does since 028c1eac, give every chunk after the first the first generated chunk as its reference, so the designed voice stays the same. The reference ends where its speech ends, because a decode history that starts in the trailing silence made some chunks stop at once. Design chunks default to at most 120 codepoints so that the reference and the chunk both fit in the context.
@0xShug0

0xShug0 commented Oct 21, 2026

Copy link
Copy Markdown
Owner

@hiroki-abe-58 Thanks! PR merged.

@0xShug0
0xShug0 merged commit 357079e into 0xShug0:main Oct 21, 2026
7 checks passed
@hiroki-abe-58

Copy link
Copy Markdown
Contributor Author

Edge cases, voice design bf16, seeds 1-2, compared with main 41bb3f0: short Chinese, Chinese without final punctuation, a 134-character Chinese run without punctuation (still one chunk, as on main) and an 88-character Chinese+English text are byte-identical to main. A 271-character Chinese text with two English sentences goes from CER 0.538 / 0.265 (one 21 s chunk) to 0 / 0 in 3 chunks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants