Skip to content

Integrate soundpack audit and master with manifest validation - #111

Merged
ctoth merged 13 commits into
masterfrom
fix/audit-invalid-mappings
Oct 20, 2026
Merged

ctoth merged 13 commits into
masterfrom
fix/audit-invalid-mappings

Conversation

@ctoth

@ctoth ctoth commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Integrates the audit/master commands from #98 with current master. A JSON pack with missing or unsafe audio references now fails the audit command instead of succeeding with an empty or partial report. The fix reuses JSONValidation.Err() and is isolated in commit b0efa05.

The new CLI regression failed before the fix and passes afterward for missing-only, mixed playable/missing, and unsafe mappings, both with and without --strict. Repository checks run through this draft's CI.

Replacement integration candidate for #98; the original PR is unchanged. Synth/search from #99 will be validated as a stacked draft against this branch. Keep this draft open for coordinated final review and merge.

ctoth added 9 commits October 4, 2026 18:46
- New internal/loudness: ITU-R BS.1770 K-weighted loudness with gating, an ungated fallback for sounds under one 400 ms block, 4x true peak, the audible span of a sound, clipped-run count, and the gain to a loudness target under a peak ceiling
- Tests check the EBU Tech 3341 reference tone (-23 dBFS 1 kHz stereo sine reads -23 LUFS) at 22.05, 44.1 and 48 kHz, the relative gate, and an inter-sample peak a sample-peak meter misses
- K-weighting coefficients are derived from the analog prototypes so they hold at any sample rate
- Tools that measure or rewrite sounds need the frames playback would feed the device
- The characterization tests now decode through it, so it is covered by every decoder test
- New internal/soundpack/audit: per-sound duration, loudness, true peak, silence at each end, clipping, and a numeric description (onsets, attack, dominant pitch, centroid, pitch trend, texture) for readers who cannot hear the pack
- Rules: too-long (per-category limits, strictest wins for a shared file), too-loud, too-quiet, peak-over-ceiling, clipping, leading-silence, trailing-silence; errors for undecodable and silent files; notes for peak-limited, duplicate, sample-rate and unreferenced
- JSON packs are audited over the files the manifest references plus unreferenced audio beside them, so raw material kept elsewhere in the repository is not counted
- Levels marshal as null for silence, since JSON has no negative infinity
- New internal/soundpack/master: trim silence, cut to the category limit with a fade, apply one gain to the loudness target under the true-peak ceiling, write 48 kHz 16-bit WAV (mono when channels match)
- Gain moves the silence boundary, so trim and gain repeat until neither changes
- A JSON pack is written as soundpack.json plus sounds/, each source file mastered once however many keys map to it
- Guard: TestMasteredSoundsPassTheAudit runs ten awkward inputs through mastering and fails if the audit finds anything to fix, so a new audit rule that mastering does not satisfy cannot land unnoticed
- audit prints a table and findings, or --json; --strict fails on warnings for CI
- master writes a mastered copy into --out and reports gain, trims and truncations per sound
- Both take the same --target-lufs, --tolerance, --peak-ceiling and --max-duration flags, so a pack is mastered to the standard it is audited against
- soundpacks.md: what audit measures and why each rule exists, how master fixes it, a source/ + built-pack repository layout with a CI workflow, and how to choose a cut from a spectrogram when you cannot listen
- cli-reference.md: soundpack audit and soundpack master
- CLAUDE.md: list the two subcommands
- v2.12.2 built with Go 1.26.6 reports six staticcheck SA5011 false positives in existing tests (a nil check followed by t.Fatal); v2.14.0 reports none
- Bumped in CI, pre-commit and the test that keeps the two in step
@ctoth
ctoth marked this pull request as ready for review October 20, 2026 05:07
@ctoth
ctoth merged commit 7883c8a into master Oct 20, 2026
9 checks passed
tahodev pushed a commit to tahodev/claudio that referenced this pull request Oct 20, 2026
RESEARCH_NOTES.md and AUDIO_CRACKLING_INVESTIGATION.md were checked into the
repo root but are both stale process artifacts:

- RESEARCH_NOTES.md documents flags that never shipped (--set-soundpack,
  --list-soundpacks, --clear-cache, --test) and a config path that never
  existed (~/.claudio/config.json). Move to notes/research-notes-early-design.md
  and add an 'early design exploration' disclaimer pointing future readers at
  CLAUDE.md and docs/.
- AUDIO_CRACKLING_INVESTIGATION.md is a failed investigation log ending at
  'Next Steps (TODO)'. Move to notes/audio-crackling-investigation.md and add
  a disclaimer pointing at reports/comprehensive-review.md finding ctoth#1 for the
  likely root cause.

(The previously untracked notes-soundpack-vision.md was also moved under
notes/ in the working tree but stays untracked — Q can add it explicitly if
desired. Root notes.md is an active scratchpad with cross-references and is
left in place per the brief.)

Findings ctoth#107, ctoth#111, table rows for RESEARCH_NOTES.md and
AUDIO_CRACKLING_INVESTIGATION.md.
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