Repository navigation
Conversation
music_frames() read the channel table of block 0 only, so a streamed-music channel with no subblock in block 0 had no packet, counted as mono, and its interleaved sample count was used as the frame count: twice the real length for stereo packets. Each block has its own channel table (docs/audio.md), so walk the blocks, the descriptor's chunk size apart, until every channel's first packet is found, as awc_opus.music_channels does since ASSET-53 (ItsNotRexed#700). A bank whose packets all start in block 0 reads exactly what it read before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
At I used the existing
The second row would still miss a marker at frame 150,000. Deferring the dictionary entry until an actual packet is found, including checking later subblocks belonging to the same channel, would cover this case. I also compared the two marker readers on the complete Xbox 1.0.2.1 audio archive. All 3,116 returned channel entries across 3,008 music descriptors agreed. The discrepancy above is a synthetic control. CachyOS x86-64, CPU only, AI-assisted. |
…rst packet Kev-Ball's case on ItsNotRexed#6405: block 0 allocates a zero-filled subblock for the channel, so music_frames took its three bytes and never saw the stereo TOC in block 1. Walk the channel's subblocks and take the first one that holds a packet, as awc_opus.opus_packets stops at a zero size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @Kev-Ball — that case is real, and your table made it easy to reproduce. New test Thanks also for the full-archive comparison (3,116 channel entries in agreement) — that shows the change doesn't move any retail count. AI-assisted (Claude Code). |
|
Confirmed On the complete Xbox 1.0.2.1 audio archive, all 3,116 channel entries across 3,008 music descriptors still matched main. CachyOS x86-64, CPU only, AI-assisted. |
|
Tested 29115ba merged with main 5eb8f1d on Linux/Python 3.12.16: pass
Diff read: |
Claimed in #6214 (comment) (our own finding).
Cause.
tools/awc_markers.py:87-93(music_frames): the channel table and the packet offset come from block 0 of the0x55data only. A channel with 0 subblocks in block 0 gets no packet, so its stereo bit reads as 0 and the interleavedsamplesis used as its frame count: twice the real length when its packets are stereo, so markers past the real end are not counted inchunks_past_end.Doc. docs/audio.md:127-140: each block of the
0x55data starts with its own 24-byte record per channel (+4= that channel's subblock count), the chunk size is the distance between blocks, and the packets' TOC stereo bit decidessamples / 2. The module docstring already says the count is "read from the TOC stereo bit of the channel's first packet".awc_opus.music_channelswalks every block for this since #700 (ASSET-53).Fix. Walk the blocks,
chunkapart, and take each channel's first packet from the first block whose table gives it a subblock; stop as soon as every channel has one. Later blocks are read only whenchunk >= 2048(the boundawc_opus.music_channelsuses) and the block's table is inside the tag. A bank whose channels all have a packet in block 0 reads exactly what it read before (one table, one 3-byte read per channel).Test.
test_stereo_bit_of_a_first_packet_in_a_later_blockbuilds a synthetic two-block, one-channel bank whose only packet is in block 1, with a marker at frame 150,000 and 192,000 interleaved samples: stereo packets (TOC 0xFC) must givechunks_past_end1 (96,000 frames, whatawc_opus.music_channelsreports for the same bytes), mono (0xF8) 0. It fails onmain(0 for the stereo bank) and passes with the fix. Synthetic data only, no game files.Tested on Linux, Python 3.14.8 (CPU only, no GPU involved):
python -I tests/test_awc_markers.py(9 OK);test_awc_opus,test_rsc8_audio,test_ci_registration,test_tool_startup,test_text_write_line_endings,test_docs_cli_flagsOKpython -m compileall -q make_game.py tools tests,git diff --checkgit merge-treewith the open PRs on this file (awc_markers: an --out that names a scanned bank is refused before the scan #5723, docs, tools: the AWC 0xBD marker events of the music banks, awc_markers.py (ASSET-303) #3916): no conflictAI-assisted (Claude Code).
🤖 Generated with Claude Code