Repository navigation
Description
Environment
- Build:
audio-v0.7.1-bin-windows-x64-cuda13.3.zip(Windows 10 x64, CUDA 13.3 backend) - Model:
higgs_audio_tts_4b_q8_0 - Commit analyzed:
a088f90
Symptom
When generating longer audio with Higgs Audio TTS, the output has an audible click/glitch roughly every 5 seconds (at ~5 s, ~10 s, ~15 s, ~20 s, ...), as if the waveform breaks at a seam. Short generations (≈10 s or less) sound fine.
Root cause
The official Python implementation decodes the whole sequence in one shot (HiggsAudioTokenizer.decode() in boson_multimodal/audio_processing/higgs_audio_tokenizer.py). src/models/higgs_audio_tts/codec.cpp adds chunked decoding (not present upstream) to bound memory:
constexpr int64_t kCodecDecodeWindowFrames = 128; // 128 frames = 128 × 960 / 24000 = 5.12 s
constexpr int64_t kCodecDecodeOverlapFrames = 8; // only 8 frames of left context, hard-trimmed concat(codec.cpp:64-65; the chunk loop is around codec.cpp:1584. Frames ≤ 512 take the single-window path, which is why short audio is unaffected — and why the seams land at every 128 frames from sample 0, i.e. every 5.12 s.)
The problem: the overlap is far smaller than the decoder's receptive field. This DAC-style decoder is purely convolutional (5 × ConvTranspose blocks with residual units at dilations 1/3/9, all symmetric padding, i.e. non-causal). Walking the structure layer by layer:
| Item | Value |
|---|---|
| Decoder total receptive field | ≈ 53 frames (≈ 27 frames per side ≈ 1.1 s of audio) |
| Left context provided by chunking | 8 frames |
| Missing right context at each window tail | ≈ 27 frames |
Since the decoder is non-causal, samples up to ~1 s past each trim point deviate from the full-sequence decode, and each window tail also lacks right context. The hard concat at seams then produces a waveform discontinuity — the periodic click.
Proposed fixes
Option A: widen the context window (recommended, minimal change)
Borrow 32 frames on both sides and trim both after decoding:
constexpr int64_t kCodecDecodeContextFrames = 32; // ≥ 27, covers the RF; aligns with the 32-frame graph capacity bucket
// window: [emit_start - 32, emit_end + 32), emit region still 128 frames
// trim 32 × 960 samples from each side before concatenatingBecause the decoder is purely convolutional with no global ops (no attention/LSTM), once every emitted frame's full receptive field lies inside its window the chunked output is bit-identical to the full-sequence decode; the zero padding at the first window's left edge and the last window's right edge also matches the full decode exactly.
- Touches only the
decode_codes()chunk loop, and mirrors the pattern already used by qwen3_tts in this repo (kLeftContextCodes = 25+ drop intokenizer_speech_decoder.cpp). - Cost: ~1.4× per-window compute (192/136 frames). The codec decoder is a tiny fraction of the pipeline (AR generation dominates), so end-to-end impact is negligible.
Option B: stateful streaming chunks (more compute-efficient, much bigger change)
Carry the conv input history explicitly across chunks so each chunk computes only new frames:
-
The DAC decoder has 5 time scales (cumulative strides 3/6/24/120/960); each scale needs its own ring buffer of layer history, and the single
HiggsCodecDecodeGraphwould need to be split into a dozen-plus subgraphs with state passed between them. -
Benefit: removes the redundant re-decode and naturally supports decode-while-generating streaming.
-
Caveat: the decoder is non-causal, so even with full layer state, streaming the tail ≈1.1 s of audio still has to wait for future code frames — i.e. this does not remove streaming latency; it only saves the re-decode compute (<1% end-to-end).
Suggestion
Ship Option A first (bit-exact, small diff, imperceptible cost). If decode-while-generating streaming is wanted later, it can be driven at the generator/session level per chunk (state = the last 32 code frames) without touching the codec internals; Option B can remain a perf optimization.
Activity
0xShug0 commentedon Sep 3, 2026
@HaujetZhao Please provide the exact cmd, test input, and output. Please also check if the issue is consistent across different seeds. I can’t reproduce this issue, so I don’t want to chase the wrong target.
repro-voice-clone-tracked.wav
Also another random run
longform_test.wav
HaujetZhao commentedon Sep 4, 2026
Thanks for the reply. Here are the exact repro steps.
Input / Output files
Commands
English test:
Chinese test:
Environment:
audio-v0.7.1-bin-windows-x64-cuda13.3.zip, Windows 10 x64, CUDA backend, modelhiggs-audio-v3-tts-4b-q8_0.gguf.Why it is easy to miss in English
I only noticed this with Chinese input at first, and I think the masking is worth explaining. Every ~5.12 s the codec decode seam lands mid-utterance; whether you hear it depends on what the voice is doing at that instant:
In the English sample the click is audible at ~10 s right on "c̶r̶o̶s̶s̶" (a sustained /ɔ/), but inaudible at 15 s because the seam lands in a speech gap.
On seeds
I have only tested seed 429 so far. Note the decode path is deterministic given the generated codes — any seed whose output exceeds ~10 s crosses the >512-frame chunked path, so per the root-cause analysis in the issue body it should show seams at multiples of 128 frames (5.12 s) regardless of seed; the only variable is whether a seam lands somewhere masked or on a sustained vowel. If you test, I'd suggest the Chinese text above — it's the easiest to hear.
Suspected cause (same as in the issue body)
kCodecDecodeOverlapFrames = 8frames of left context vs a decoder receptive field of ≈27 frames per side (≈53 frames total), with hard-trim concat, indecode_codes()(src/models/higgs_audio_tts/codec.cpp). The official Python tokenizer decodes the full sequence in one shot. Proposed Option A: borrow 32 frames on both sides and trim both — bit-exact for this purely-convolutional decoder.Logs
English:
Chinese:
0xShug0 commentedon Sep 4, 2026
@HaujetZhao Could you check these wavs? Created based on your test cases. Maybe my speakers are bad, so I can’t really tell whether there’s noise...
repro-voice-clone-tracked-english.wav
repro-voice-clone-tracked-chinese.wav
HaujetZhao commentedon Sep 4, 2026
I checked your wavs — the clicks are definitely there. On my headphones they are clearly audible:
longform_test.wav very obvious at ~10s, right in the middle of the word "together", very obvious at ~25s, right in the middle of the word "cpp" , very obvious at ~36s, right in the middle of the word "convelutional"
repro-voice-clone-tracked.wav very obvious at ~15s, right in the middle of the sustained vowel in "ten"
repro-voice-clone-tracked-english.wav: most obvious at ~10s, right in the middle of the sustained vowel in "cross"
repro-voice-clone-tracked-chinese.wav: very obvious at ~5s and ~10s, landing mid-syllable
A suggestion for hearing it: Use headphones. The click is a short broadband discontinuity, and laptop may speakers mask it badly.
0xShug0 commentedon Sep 4, 2026
Okay. I opened a PR for you to test. Let me know if it works. Also could you share the before vs after PR RTF changes?
0xShug0 commentedon Sep 4, 2026
I'm too old to hear those noises☹️
HaujetZhao commentedon Sep 4, 2026
repro-voice-clone-tracked.wav very obvious at ~15s, right in the middle of the sustained vowel in "ten"
The noise in "ten" sound is so bad, can you try to listen to it again?
I can't test the pr today, maybe tomorrow would be ok.
0xShug0 commentedon Sep 4, 2026
I have to be honest, I can’t really hear it :( But I trust your judgment. I’ll merge the PR once you confirm it.
HaujetZhao commentedon Sep 4, 2026
Tested — the fix works. ✅
Setup: I rebuilt from
mainwith only the fix commit (038dac4) cherry-picked on top, so the A/B is clean (just the codec change, nothing else from the PR branch base). CUDA 13.3 backend, RTX 5050 Laptop, same seed (429), same voice-clone prompt.Listening check: generated both a Chinese and an English long-form sample (~21 s / ~25 s), which cross 3–4 decode seams (each at 5.12 s intervals). All the periodic clicks are gone. Comparing the waveforms old vs. new, the seam positions now join smoothly — no discontinuity visible or audible at 5.12 / 10.24 / 15.36 / 20.48 s.
Although you may not hear the difference, you can clearly see the difference at the seams on the waveform diagram.
repro-voice-clone-tracked-chinese.wav
repro-voice-clone-tracked-chinese-pr436.wav
RTF (before vs. after, 3 runs each):
Both deltas are within run-to-run noise, so there's no measurable end-to-end regression — as expected, since the codec decoder is <3% of total wall time and the wider window only costs ~1.4× on that small slice.
One takeaway for chunked conv audio decoders in general: if you split decoding into windows, the left/right context buffers must be at least the decoder's receptive field per side (here ≈27 frames, so 32 is a comfortable margin) — otherwise the hard concat at seams produces exactly this kind of periodic click. For Higgs this is cheap because the codec is a small fraction of the pipeline. But when the decoder is the expensive part (e.g. Qwen3-TTS's audio decoder), re-decoding ~1.4× of overlap every window adds up. In that case the overlap can be eliminated entirely by carrying conv state explicitly across chunks: keep the last RF-frames of conv input as a ring buffer, feed [history | new_frames] through the conv chain, trim only the left side of the output, and hold back a few lookahead frames until the next chunk (flush with an is_last flag). Each frame then gets decoded exactly once — true streaming, zero redundant compute.
I did exactly that for the Qwen3-TTS codec decoder in my Qwen3-TTS-GGUF project: the ONNX export wraps the decoder as a stateful step graph (inputs/outputs are the conv-history / latent-buffer / KV-cache states, see 13-Export-Decoder.py and DecoderPart3Upsample in qwen3_tts_gguf/export/codec_export.py). I'm only a Python guy so the wrapper itself probably isn't C++-ready as-is, but the state layout might be a useful reference if you ever want the stateful (Option B) route for Higgs.
Good to merge from my side. Thanks for the quick turnaround!
0xShug0 commentedon Sep 4, 2026
@HaujetZhao Thank you for the information!
higgs_audio_tts: give the codec decoder right-hand context at the end…
fix(voxcpm2): decode streaming patches with left context (#622)