Skip to content

feat(long): opt-in --polish seam smoothing for long-form#1

Open
sb1992 wants to merge 3 commits into
mainfrom
longform-seam-polish
Open

feat(long): opt-in --polish seam smoothing for long-form#1
sb1992 wants to merge 3 commits into
mainfrom
longform-seam-polish

Conversation

@sb1992

@sb1992 sb1992 commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Opt-in seam polishing for long-form (--polish)

Independently-generated long-form chunks join with a small audible discontinuity:
the model drifts slightly over a long generation so chunk endings can sound a touch
abrupt, and loudness can step at the join. This adds an opt-in seam recipe that
smooths both — --polish is off by default, so existing synthesize_long /
--long behaviour is byte-identical.

What it does (when polish=True)

  • Drift-safe chunks — defaults max_seconds to 25s (under the model's ~30s
    prosody-drift knee) when unset.
  • trim_silence — drops per-chunk leading/trailing silence (also kills the
    dead air a no-EOS chunk would otherwise leave).
  • release_fade — a longer per-chunk end taper so the last word settles
    instead of stopping at full energy.
  • boundary_loudness_match — global RMS match plus a local onset ramp that
    matches each chunk's start to the previous chunk's tail (not just a global
    average), removing the "next word louder" step.
  • assemble_polished — release fade → boundary match → gap → peak-normalize.

Surface

  • New pure-numpy module src/zonos2_mlx/seam_polish.py (no mlx / torch).
  • synthesize_long(..., polish=False, release_ms=200) — opt-in; polish=False
    resolves to the prior 40s / 80ms defaults + plain assemble_chunks.
  • CLI: --polish, --release-ms; --max-seconds / --gap-ms now default to
    None and resolve per-mode (40/80 normally, 25/250 with --polish).
  • README note.

Tests / validation

  • 7 new CPU unit tests (tests/test_seam_polish.py); full CPU suite green
    (45 passed), ruff clean.
  • GPU integration smoke of the real --polish path: 2 chunks → finite, normalized.

Context

This is the validated DSP ceiling for ZONOS2 long-form. An isolated experiment
showed the model rejects audio-prefix continuation (it rambles — it was never
trained to continue from prior audio, unlike Zonos v0.1), so cross-chunk prosody
continuity isn't available without a different model or fine-tuning. This PR makes
the independent-chunk seams as clean as DSP allows.

Shraey added 3 commits June 14, 2026 22:47
trim_silence (kill dead air) + release_fade (let the last word taper) +
boundary_loudness_match (onset matched to prev chunk's tail, not just a global
average) + assemble_polished (full recipe). 7 CPU tests.
synthesize_long(polish=True) picks drift-safe defaults (max_seconds 25, gap 250
when unset), trims each chunk, and assembles via assemble_polished (release fade
+ boundary loudness match + normalize). polish=False resolves to 40/80 + plain
assemble_chunks — existing behaviour is byte-identical. CLI: --polish/--release-ms.
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.

1 participant