main gained the 0xbd cue-record decoder in rsc8_audio.py (4cf7e3e7). The
section in docs/audio_config.md now points at docs/rsc8_audio.md for the
record layout and keeps what is specific to the music banks; a test holds
awc_markers.events() to rsc8_audio.decode_marker_records().
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
docs/audio_config.md gains the measured 16-byte event layout of AWC tag 0xBD,
whole-corpus counts and the event-type table (hashes and counts only).
tools/awc_markers.py reports those counts from an archive, a bank or a folder
of banks; tests/test_awc_markers.py covers it with hand-built banks.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The mission-music section said the song audio is not in 1.0.2.1. @jefftern4
found it in the plain audio.rpf bank at 0x300695000: 73 stereo Opus streams,
47 of them 771,213 samples long, stems that play together, so no single
stream matches. Record the bank's shape (counts and lengths only), point the
all-banks coverage row at it, and replace the residual-uncertainty note with
what is still open: how the game sequences the stems.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/audio.md still listed a custom RSC8 audio resource as the only
mission-side container not decoded, and story.md and restofworld.md
still called the RSC8 bodies opaque. rsc8_audio.md (ASSET-56) decoded
them: all 641,428 raw RSC8 headers in the package are AWC tag 0x5c
facial/lip-sync clips beside their Opus dialogue line, none outside an
ADAT bank and none holding an audio container. Re-measured on a local
1.0.2.1 copy with tools/rsc8_audio.py over all 22 archives (counts only).
restofworld.md also said its archives hold no audio banks; story-rest
holds 15 ADAT banks, the other five none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kotorvr's finding in #3232: the entries start 4 bytes earlier than the
decoder read them. Each is {u32 sample position, f32 value, 6 x u16},
and the table ends in an f32 trailer (2/3 on 1,182 streams). Read 4
bytes later, every entry paired one entry's fields with the next one's
position, the first position looked like a header "unknown" and the
trailer looked like the last counter.
Recounted on my copy: positions ascend strictly and stay below the 0x76
sample count on all 1,185 streams; one entry lasts one period of its
value (within 1% on 365,803 of 386,048 pairs), so value reads as a
pitch in Hz; p is a multiple of 512 on every entry.
decode_grid20_table returns position_first/last/increasing and the
trailer as tail_f32; the tally key becomes grid20_position_past_samples.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tool read only the first word of a 0xbd tag and called it a magic
(0xE5C74063); docs/rsc8_audio.md described the tag as a 16-byte header.
Over all of audio.rpf the tag is a headerless list of 16-byte records
{name joaat, value, sample offset, extra}, sorted by offset, and that
value is the first word of only 88,082 of 420,168 tags.
decode_marker_records() decodes the list, every scan counts it in new
marker_* summary keys, and the doc carries the measured counts. The
record layout and the tag-id rule (low byte of the chunk name's joaat)
were read in TrinitronClient/GTA6-Asset-Info structure/03-audio-awc.md
(029e4c3) and re-measured here; no code was copied.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Keep the per-chunk checks and repeated Opus packet verification alongside the short-final-block fix already on main. Set accurate mono and stereo sample counts in the overlap fixture so it also exercises the current Ogg trimming behavior. AI-assisted.
Clamping only the last page's granule made it smaller than the previous
page's when the trim target fell before that page started: a 27-packet
real-libopus fixture declared 24,000 frames but decoded 24,960, and the
Ogg granule went 24,960 -> 24,000. Emit the EOS page at the first packet
that reaches pre_skip + length and drop the remaining padding packets.
Also require +0x0C to agree with the interleaved +0 count before using
it, and clamp an oversized pre-skip to the stream length so the final
granule never falls below it.
Measured on real streams: with pre-skip 0, the 5%/10% attack point is
312 samples (30 streams from four banks, median 312; the 10% point ranges
278..868, none near 1920), so the default is measured, not just assumed
from libopus. 20 real streams at 48 and 32 kHz now decode to exactly
their declared counts.
Confine music channel tables and payloads to their own chunks, accept short final chunks, and verify that a declared repeat matches whole packets from the same channel group. Metadata scans and exports now reject the same malformed descriptors while sibling streams still export.
Tested on Linux with synthetic banks. A three-chunk libopus example with repeated packets decoded to exactly the same 6,720 PCM samples as the reference. AI-assisted.
awc_opus.py exports streams with an empty OpusTags header, so players show
only the stream id. opus_tags.py fills that header in place from the
awc_names.py CSV (TITLE) and the text_tables.py dialogue CSV (LABEL,
SPEAKER, SUBTITLE and SUBTITLE_<LANG>). Only page 1 is rewritten; the audio
pages stay byte for byte. Synthetic tests only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its dialogue pairs give the 1,019 lines the measured run was missing;
with it the conversation path names 267,800 streams. Also state the
dictionary size and that it came from our own harvest, not hashdict.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- decode_grid20_table: 8-byte header (u32 12345678 marker + unknown) and N 20-byte
entries, with the invariants measured on all 1,185 audio.rpf streams that carry
the tag (counter strictly increasing, p a multiple of 32; 387,233 entries,
0 violations).
- decode_index_runs: K groups of {u32 2; u32 len; u32 hash; len ascending u32s}
whose values index the sibling 0x5a entries (804 streams, 4,853 groups,
0 violations, 0 overruns).
- Per-stream tallies in decode_awc_bank and the scan summaries (grid20_*/indexrun_*
keys), facts in _decode_companion_tags; other archives carry 0 of either tag.
- Five synthetic tests (hand-built bytes only); docs rows in rsc8_audio.md,
audio.md and the docs index, hypotheses labelled as such.
The format block carries the per-channel count at +0x0C: equal to +0 for mono
and half of it for stereo in 7,451 measured streams (0 mismatches), matching
rpf9-explorer's OpusFrameCountPerChannel. Use it (with +0/channels as fallback)
instead of inferring the division, and document the field.
OpusHead declared pre-skip 0, so every exported stream started with 312
samples of libopus priming and the end trim removed the same amount of real
audio. Write the lookahead (312 by default, --pre-skip overrides it) and make
the trimmed final granule pre_skip + length.
The plain-stream length also scaled the format tag's sample count by
48000/rate and ignored stereo interleaving. Measured over 1,598,151 plain
streams: packet samples - declared is 1920..2879 for every 48 kHz and 32 kHz
stream, which is only possible if the declared count is already 48 kHz frames;
after halving stereo counts the same 1920..2879 window holds for all 17,983
stereo streams. Scaling a 32 kHz stream by 1.5 left the padding untrimmed.
Tests cover the pre-skip, the 48 kHz frame count, stereo halving and the
--pre-skip bounds. libopus round-trip: the fixed output matches the reference
Ogg sample-for-sample (max |diff| 0); before the fix it was shifted 312
samples and differed by up to 12,188.
AWC stream tables keep only joaat(lowercase name) & 0x1FFFFFFF. With ~1.8M
distinct ids in a 2^29 space, ~0.3% of arbitrary words collide, so
awc_names.py accepts a hit only as an exact dialogue-wave word
(<root>au_<4 letters>_<NN>) or as a numbered family in one bank (3+
members or 2 adjacent, common-token base, one member a dictionary word).
A salted control run estimates the false names and sets each rule's
threshold per source.
The dictionary takes word lists or a hashdict.py JSON, and builds dialogue
wave names from conversation key/label pairs (<key>_01.._N per label).
Banks come from .awc files, directories or rpf9dump's audio_manifest.json.
On 1.0.2.1: 266,781 of 1.85M ids named (story000 73.7%, audio 5.7%),
with 417 control hits. Standard library only; tests are synthetic.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The credited song is the Home Sweet Home mission song, not a radio track. The mission and its localized objective/fail strings are in data.rpf; the song audio is absent from every searched container.
Records the measured coverage (story000 streamed/plain/Bink, movies.rpf Bink, audio.rpf short and all banks, loop banks, packs/data/script/common inflated, raw levels.rpf ADAT/KB2), the 19,807-file / 653-hour Chromaprint sweep with its tempo range, the positive controls, the 12 joaat(burn) data hashes that are not audio, and the remaining levels.rpf/RSC8 uncertainty. No game audio or localized strings are included.
README: audio row now says lossless Ogg Opus, PCM codec 0/2 as WAV, XMA2 via ffmpeg and 16-bit --wav; D3D12 row reflects the design doc and xmem/d3d12_xs shims with no device proxy; LLVM_MC is documented as a whole command; link the two new docs. docs/audio.md covers the ADAT layout, tags, codecs, exporters, song/station/venue distinctions and the no-sharing rule. docs/related_projects.md records the PercyStar and americas-recomp licence boundaries.