Audio music: drop the pre-roll packets that repeat the previous block #238

Manually merged
github merged 2 commits from gh-pr/238/head into gh-pr/238/base 2026-11-26 20:20:35 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 03:08 UTC · original
holdmysocks:claude/audio-music-skip → master · +58 −4 · 2 files · 2 commits · merged 2026-11-25 03:59 UTC

In music banks, the third u32 of each channel's 24-byte block header was documented as always 0. It is a sample count. In blocks after the first, the channel's leading packets worth that many samples are a pre-roll: byte-for-byte copies of the previous block's last packets. We decoded them a second time.

Measured on 150 music banks of audio.rpf:

  • the field is nonzero in about 5 % of channel blocks, never in block 0, and always a multiple of 960;
  • 84 of 84 such runs are exact repeats of the previous block's tail;
  • once they are subtracted, a bank's channels all have the same length.

Effect on exports: an affected stem repeats that audio, falls behind the other stems (bank 52c0000: stems 1, 3 and 4 lag by 7,680, 13,440 and 7,680 samples after the first block, while stem 2 has none), and loses as much at the end, because exports are trimmed to the stored sample count.

  • music_channels drops those leading packets in each block. That covers music export and stem windows.
  • With the fix, all four stems of that bank line up after the first block. Their opening samples are unchanged.
  • Module doc and README updated. The README says earlier music exports should be re-exported.
  • New test music_pre_roll.

Tests: cargo test --release --locked passes, and so does cargo check --release --locked --no-default-features -p sixng-cli -p sixng-gui.

**@⁠holdmysocks** on GitHub · 2026-11-25 03:08 UTC · [original](https://github.com/holdmysocks/SixNG/pull/238) `holdmysocks:claude/audio-music-skip` → `master` · +58 −4 · 2 files · 2 commits · merged 2026-11-25 03:59 UTC In music banks, the third u32 of each channel's 24-byte block header was documented as always 0. It is a sample count. In blocks after the first, the channel's leading packets worth that many samples are a pre-roll: byte-for-byte copies of the previous block's last packets. We decoded them a second time. Measured on 150 music banks of audio.rpf: - the field is nonzero in about 5 % of channel blocks, never in block 0, and always a multiple of 960; - 84 of 84 such runs are exact repeats of the previous block's tail; - once they are subtracted, a bank's channels all have the same length. Effect on exports: an affected stem repeats that audio, falls behind the other stems (bank `52c0000`: stems 1, 3 and 4 lag by 7,680, 13,440 and 7,680 samples after the first block, while stem 2 has none), and loses as much at the end, because exports are trimmed to the stored sample count. - `music_channels` drops those leading packets in each block. That covers music export and stem windows. - With the fix, all four stems of that bank line up after the first block. Their opening samples are unchanged. - Module doc and README updated. The README says earlier music exports should be re-exported. - New test `music_pre_roll`. Tests: `cargo test --release --locked` passes, and so does `cargo check --release --locked --no-default-features -p sixng-cli -p sixng-gui`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:20:33 +00:00
github manually merged commit c83ed6749a into gh-pr/238/base 2026-11-26 20:20:35 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.