tooling: read 0xFA sound format tags in AWC sound-effect banks #786

Manually merged
github merged 1 commit from gh-pr/786/head into gh-pr/786/base 2026-11-26 22:18:35 +00:00
Owner

@⁠legacy-code-archaeologist on GitHub · 2026-11-23 03:18 UTC · original
legacy-code-archaeologist:audio/awc-sfx-fa-header → main · +63 −10 · 3 files · 1 commits · merged 2026-11-23 03:47 UTC

Change

tools/awc_metadata.py now accepts either a 0x76 or a 0xFA sound format tag per sound in a sound-effect bank. Before, it rejected any bank that used 0xFA. Both tags are read as in the public reader's 0x76 and 0xFA cases (vgmstream awc.c @ 24ffd6ce, lines 488–527):

  • sample count at offset 0 and sample rate at offset 8;
  • codec ID at offset 28 (0x76) or 19 (0xFA);
  • 32 or 20 bytes read.

A sound must have exactly one format tag. A sound with 0x76 plus 0xFA, or with two 0xFA tags, is now rejected. Before this change, 0xFA was ignored, so a sound with 0x76 plus 0xFA was accepted. The public reader keeps the last format tag of a sound in that case. Music banks are unaffected.

Builds on #583 (same file). Opened after it landed.

Verification

At 7dd70a2 on Windows 11 (build 26100.9168), Python 3.12.10:

  • out\pe-env\Scripts\python.exe -B tests\awc_metadata_check.py -v: 12 tests OK.
    • The new test_fa_format_tags reads a two-sound bank with one 0xFA and one 0x76 tag through a metadata-only read guard.
    • It holds a decoy byte at the 0x76 codec offset of the 0xFA tag, so reading 0xFA like 0x76 is detected.
    • It has three negative controls: a truncated 0xFA tag, 0x76 plus 0xFA on one sound, and two 0xFA tags on one sound.
  • The new test fails against the previous version of the tool.
  • These mutations are each detected: the 0xFA codec offset, the 0xFA minimum length, and accepting more than one format tag.
  • tests/docs_links_check.py and tests/bidi_controls_check.py: passed.

Evidence and follow-up

The fixture is synthetic bytes built in the test (MIT, this repository). No local bank with 0xFA tags was inspected.

  • Updated: docs/experiments.md#awc-sound-effect-format-metadata
  • Reproduce: ctest --preset dev --no-tests=error -R '^audio_awc_metadata$' -V

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: written with Claude Code, precommit review by a fresh agent; checked and submitted by the account owner.

🤖 Generated with Claude Code

**@⁠legacy-code-archaeologist** on GitHub · 2026-11-23 03:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/786) `legacy-code-archaeologist:audio/awc-sfx-fa-header` → `main` · +63 −10 · 3 files · 1 commits · merged 2026-11-23 03:47 UTC ## Change `tools/awc_metadata.py` now accepts either a `0x76` or a `0xFA` sound format tag per sound in a sound-effect bank. Before, it rejected any bank that used `0xFA`. Both tags are read as in the public reader's `0x76` and `0xFA` cases (vgmstream `awc.c` @ `24ffd6ce`, lines 488–527): - sample count at offset 0 and sample rate at offset 8; - codec ID at offset 28 (`0x76`) or 19 (`0xFA`); - 32 or 20 bytes read. A sound must have exactly one format tag. A sound with `0x76` plus `0xFA`, or with two `0xFA` tags, is now rejected. Before this change, `0xFA` was ignored, so a sound with `0x76` plus `0xFA` was accepted. The public reader keeps the last format tag of a sound in that case. Music banks are unaffected. Builds on #583 (same file). Opened after it landed. ## Verification At `7dd70a2` on Windows 11 (build 26100.9168), Python 3.12.10: - `out\pe-env\Scripts\python.exe -B tests\awc_metadata_check.py -v`: 12 tests OK. - The new `test_fa_format_tags` reads a two-sound bank with one `0xFA` and one `0x76` tag through a metadata-only read guard. - It holds a decoy byte at the `0x76` codec offset of the `0xFA` tag, so reading `0xFA` like `0x76` is detected. - It has three negative controls: a truncated `0xFA` tag, `0x76` plus `0xFA` on one sound, and two `0xFA` tags on one sound. - The new test fails against the previous version of the tool. - These mutations are each detected: the `0xFA` codec offset, the `0xFA` minimum length, and accepting more than one format tag. - `tests/docs_links_check.py` and `tests/bidi_controls_check.py`: passed. ## Evidence and follow-up The fixture is synthetic bytes built in the test (MIT, this repository). No local bank with `0xFA` tags was inspected. - Updated: `docs/experiments.md#awc-sound-effect-format-metadata` - Reproduce: `ctest --preset dev --no-tests=error -R '^audio_awc_metadata$' -V` ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted: written with Claude Code, precommit review by a fresh agent; checked and submitted by the account owner. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Accept either a 0x76 or a 0xFA format tag per sound in
tools/awc_metadata.py, read as in the public reader: sample count at
+0, sample rate at +8, codec ID at +0x1c (0x76) or +0x13 (0xFA), with
32 and 20 bytes read. A sound with more than one format tag is
rejected; the public reader keeps the last one.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:18:34 +00:00
github manually merged commit 7dd70a2cab into gh-pr/786/base 2026-11-26 22:18:35 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.