tooling: inventory bounded AWC music bank metadata #577

Merged
legacy-code-archaeologist merged 2 commits from upstream-pr/583 into main 2026-11-23 02:48:34 +00:00
legacy-code-archaeologist commented 2026-11-22 14:07:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-22T14:07:41Z.


Change

tools/awc_metadata.py now also reads streamed (music) AWC banks, which it rejected before with "Streamed AWC banks are unsupported". It follows the music header layout in the public reader already cited for #305 (vgmstream awc.c @ 24ffd6ce). For a bank whose first stream ID is 0, the command reports these fields from the ID-0 stream's music header tag (0x48):

  • the number of stream-table entries,
  • the channel count, block count and block_chunk,
  • format groups by sample rate and codec ID, with each group's channel count and its largest channel sample count.

It reads only the bank header, the stream table, the ID-0 stream's tag descriptors and the music header. It never reads data tags or the other streams' tags.

Sound-effect banks keep the same JSON, results and error precedence: read_formats is unchanged apart from moving the header checks into a shared helper.

Some rules are stricter than the public reader:

  • Only the flag words 0xff000001 and 0xff020001 are accepted, the same two as for sound-effect banks.
  • A repeated ID 0 is rejected.
  • The ID-0 stream must have exactly one nonempty data tag, and its tags must not overlap.
  • The music header must declare at least one channel, and all channels must share one codec ID, including ID 0.

These rules are documented, and each has a negative control. Should any of them be relaxed once someone measures a real music bank? The public reader also accepts flag bits 0x00010000, 0x00040000 and 0x00080000.

No overlapping open issue or PR was found (searched "awc").

Verification

At 2b8bdc6 (rebased on bbebcad) on Windows 11 (build 26100.9168), Python 3.12.10, MSVC 19.52.37029:

  • out\pe-env\Scripts\python.exe -B tests\awc_metadata_check.py -v: 11 tests OK. The 4 existing tests are unchanged. The 7 new tests cover:
    • the music CLI, including a range cut before the data tag ends;
    • a metadata-only read guard with 3-byte short reads;
    • read_formats still rejecting music banks;
    • read_bank on the sound-effect fixture;
    • 3 ignored-tag variants on other streams;
    • 7 accepted variants at the limits: 32 streams, 32 channels, a tag starting at the header size and touching the music header, a tag ending at the range end, a repeated nonzero ID, the flag word 0xff000001, and codec ID 0 on every channel;
    • 22 negative controls.
  • 24 mutations of the music checks were each detected by at least one test, with none surviving. They removed each check, moved each limit by one, skipped empty tags, used the public reader's codec-0 rule and summed the samples.
  • ctest --preset dev --no-tests=error -R '^audio_awc_metadata$' -V: passed.
  • tests/docs_links_check.py and tests/bidi_controls_check.py: passed.
  • Full ctest --preset dev -j 4 on the same change before the rebase (base d896867): 272 tests. Everything passed except capability skips (exit 77) and the two timeouts below.
    • Timeouts: pixel_aot_hardware and pixel_aot_predicate_rounding_hardware, both at the 60 s limit.
    • Both also timed out on d896867 before this change, together with pixel_aot_blend_scalar_hardware.

Evidence and follow-up

The fixtures are synthetic bytes built in the test from the documented layout (MIT, this repository). No game files are involved. No local music bank was inspected, so how the rules fit real banks is still unverified. The meaning of block_chunk beyond the reader's full_block_size is unverified too.

  • Updated: README "Audio metadata" row and 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 (design reviewed by independent read-only agents, precommit review by a fresh agent); checked and submitted by the account owner.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6543333613 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/583). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-22T14:07:41Z. --- ## Change `tools/awc_metadata.py` now also reads streamed (music) AWC banks, which it rejected before with "Streamed AWC banks are unsupported". It follows the music header layout in the public reader already cited for #305 (vgmstream `awc.c` @ `24ffd6ce`). For a bank whose first stream ID is 0, the command reports these fields from the ID-0 stream's music header tag (`0x48`): - the number of stream-table entries, - the channel count, block count and `block_chunk`, - format groups by sample rate and codec ID, with each group's channel count and its largest channel sample count. It reads only the bank header, the stream table, the ID-0 stream's tag descriptors and the music header. It never reads data tags or the other streams' tags. Sound-effect banks keep the same JSON, results and error precedence: `read_formats` is unchanged apart from moving the header checks into a shared helper. Some rules are stricter than the public reader: - Only the flag words `0xff000001` and `0xff020001` are accepted, the same two as for sound-effect banks. - A repeated ID 0 is rejected. - The ID-0 stream must have exactly one nonempty data tag, and its tags must not overlap. - The music header must declare at least one channel, and all channels must share one codec ID, including ID 0. These rules are documented, and each has a negative control. Should any of them be relaxed once someone measures a real music bank? The public reader also accepts flag bits `0x00010000`, `0x00040000` and `0x00080000`. No overlapping open issue or PR was found (searched "awc"). ## Verification At `2b8bdc6` (rebased on `bbebcad`) on Windows 11 (build 26100.9168), Python 3.12.10, MSVC 19.52.37029: - `out\pe-env\Scripts\python.exe -B tests\awc_metadata_check.py -v`: 11 tests OK. The 4 existing tests are unchanged. The 7 new tests cover: - the music CLI, including a range cut before the data tag ends; - a metadata-only read guard with 3-byte short reads; - `read_formats` still rejecting music banks; - `read_bank` on the sound-effect fixture; - 3 ignored-tag variants on other streams; - 7 accepted variants at the limits: 32 streams, 32 channels, a tag starting at the header size and touching the music header, a tag ending at the range end, a repeated nonzero ID, the flag word `0xff000001`, and codec ID 0 on every channel; - 22 negative controls. - 24 mutations of the music checks were each detected by at least one test, with none surviving. They removed each check, moved each limit by one, skipped empty tags, used the public reader's codec-0 rule and summed the samples. - `ctest --preset dev --no-tests=error -R '^audio_awc_metadata$' -V`: passed. - `tests/docs_links_check.py` and `tests/bidi_controls_check.py`: passed. - Full `ctest --preset dev -j 4` on the same change before the rebase (base `d896867`): 272 tests. Everything passed except capability skips (exit 77) and the two timeouts below. - Timeouts: `pixel_aot_hardware` and `pixel_aot_predicate_rounding_hardware`, both at the 60 s limit. - Both also timed out on `d896867` before this change, together with `pixel_aot_blend_scalar_hardware`. ## Evidence and follow-up The fixtures are synthetic bytes built in the test from the documented layout (MIT, this repository). No game files are involved. No local music bank was inspected, so how the rules fit real banks is still unverified. The meaning of `block_chunk` beyond the reader's `full_block_size` is unverified too. - Updated: README "Audio metadata" row and `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 (design reviewed by independent read-only agents, precommit review by a fresh agent); checked and submitted by the account owner. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 06:43:48 +00:00
romn4rch commented 2026-11-24 06:43:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by romn4rch on 2026-11-22T16:05:44Z.

Review: COMMENTED


Independent check of 2b8bdc6, pure-Python part only.

Environment: Linux x64, Python 3.12.16. tools/awc_metadata.py and tests/awc_metadata_check.py at 2b8bdc6, tools/paged_resource.py from main (3ffc193). No Windows, CMake or CTest run.

Command: python -B tests/awc_metadata_check.py -v

Tool Tests Result
2b8bdc6 from this PR (11) 11 passed
2b8bdc6 from main (4) 4 passed, so sound-effect JSON and errors are unchanged
main from this PR (11) 5 passed; test_music_command failed and 5 music/read_bank tests errored

The new tests fail without the change and pass with it, so they detect the new behavior rather than passing vacuously.

Reference lines: I checked every vgmstream range cited in docs/experiments.md at 24ffd6ce: awc.c 92, 195, 328–346, 349–377, 379, 384–387, 414–422, 434–486, 475, 480–481, 508–534, 564–595 and 597–600, plus AWC_MAX_MUSIC_CHANNELS 32 at awc_streamfile.h line 6. Each one says what the text attributes to it, including the stricter and more lenient rules listed.

Code read: _music bounds each ID-0 tag against header_size..size and rejects overlaps before it reads the 0x48 header. It reads only 12 + 16 * channels bytes and never reads 0x55 data. read_formats differs from main only by the shared _header helper. A minor non-blocking point: for a sound-effect bank, read_bank parses the header twice (_header, then read_formats). That is harmless.

Not verified here: the Windows CTest registration of audio_awc_metadata, real music banks (none available, as the PR also states) and the meaning of block_chunk.

Verdict: no blocking findings for the Python behavior at 2b8bdc6.

AI-assisted (Microsoft Copilot); posted with the account owner's approval.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6013180673 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/583#pullrequestreview-6013180673). Originally posted by [romn4rch](https://github.com/romn4rch) on 2026-11-22T16:05:44Z. **Review:** COMMENTED --- Independent check of `2b8bdc6`, pure-Python part only. **Environment:** Linux x64, Python 3.12.16. `tools/awc_metadata.py` and `tests/awc_metadata_check.py` at `2b8bdc6`, `tools/paged_resource.py` from `main` (`3ffc193`). No Windows, CMake or CTest run. **Command:** `python -B tests/awc_metadata_check.py -v` | Tool | Tests | Result | |---|---|---| | `2b8bdc6` | from this PR (11) | 11 passed | | `2b8bdc6` | from `main` (4) | 4 passed, so sound-effect JSON and errors are unchanged | | `main` | from this PR (11) | 5 passed; `test_music_command` failed and 5 music/`read_bank` tests errored | The new tests fail without the change and pass with it, so they detect the new behavior rather than passing vacuously. **Reference lines:** I checked every vgmstream range cited in `docs/experiments.md` at `24ffd6ce`: `awc.c` 92, 195, 328–346, 349–377, 379, 384–387, 414–422, 434–486, 475, 480–481, 508–534, 564–595 and 597–600, plus `AWC_MAX_MUSIC_CHANNELS 32` at `awc_streamfile.h` line 6. Each one says what the text attributes to it, including the stricter and more lenient rules listed. **Code read:** `_music` bounds each ID-0 tag against `header_size..size` and rejects overlaps before it reads the `0x48` header. It reads only `12 + 16 * channels` bytes and never reads `0x55` data. `read_formats` differs from `main` only by the shared `_header` helper. A minor non-blocking point: for a sound-effect bank, `read_bank` parses the header twice (`_header`, then `read_formats`). That is harmless. **Not verified here:** the Windows CTest registration of `audio_awc_metadata`, real music banks (none available, as the PR also states) and the meaning of `block_chunk`. **Verdict:** no blocking findings for the Python behavior at `2b8bdc6`. _AI-assisted (Microsoft Copilot); posted with the account owner's approval._
legacy-code-archaeologist commented 2026-11-24 06:48:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-22T16:20:18Z.


Thanks for the independent check, @romanv9, and for running the new tests against main as a control.

On the double header parse: it is intentional. read_bank reads the 16-byte header and the stream table once to choose the layout. For a sound-effect bank it then calls read_formats unchanged, so that function keeps its exact error precedence and messages (the four existing tests are untouched). Both reads stay within the metadata range.

On the Windows side: audio_awc_metadata is the existing CTest registration and needs no CMake change. ctest --preset dev --no-tests=error -R '^audio_awc_metadata$' -V passed at 2b8bdc6 on Windows 11 26100.9168. The branch still merges cleanly with main at 2f1f832.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7081995939 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/583#issuecomment-7081995939). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-22T16:20:18Z. --- Thanks for the independent check, @romanv9, and for running the new tests against `main` as a control. On the double header parse: it is intentional. `read_bank` reads the 16-byte header and the stream table once to choose the layout. For a sound-effect bank it then calls `read_formats` unchanged, so that function keeps its exact error precedence and messages (the four existing tests are untouched). Both reads stay within the metadata range. On the Windows side: `audio_awc_metadata` is the existing CTest registration and needs no CMake change. `ctest --preset dev --no-tests=error -R '^audio_awc_metadata$' -V` passed at `2b8bdc6` on Windows 11 26100.9168. The branch still merges cleanly with `main` at `2f1f832`. AI-assisted (Claude Code).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!577
No description provided.