codec-re: add segment 1 block dumper for analysis
Investigated multi-segment Tran continuation but couldn't crack it. Each hypothesis tried (segment header consumes 0/1/2 T deltas, blocks continue Tran with various interpretations) breaks at sample ~512. Block budget for V70 segment 1: 264 nibbles + 244 RLE zeros = 508 deltas — exactly the segment size. So the block structure CAN encode 508 single-channel samples, but applying segment 1 blocks as Tran gives wrong values. Most likely the channel ordering changes in segment 1+ (e.g., segment 0 = Tran, segment 1 = Vert, segment 2 = Long, etc.) but I couldn't verify cleanly. Stopping here — segment-0 Tran decode is solid and multi-segment work needs more fresh thinking.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"""Dump all blocks in segment 1 of each event with their data."""
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
from minimateplus.waveform_codec import walk_body, find_data_start
|
||||
|
||||
|
||||
def main():
|
||||
for stem in ("M529LL1A.SP0", "M529LL1L.JQ0", "M529LL1L.V70"):
|
||||
path = f"decode-re/5-11-26/{stem}"
|
||||
with open(path, "rb") as f:
|
||||
body = f.read()[43:-26]
|
||||
blocks = walk_body(body, find_data_start(body))
|
||||
|
||||
# Find segment 1 (between first and second 40 02)
|
||||
seg40_indices = [i for i, b in enumerate(blocks) if b.tag_hi == 0x40]
|
||||
if len(seg40_indices) < 2:
|
||||
print(f"\n{stem}: only {len(seg40_indices)} segment headers found")
|
||||
seg1_blocks = blocks[seg40_indices[0]:] if seg40_indices else []
|
||||
else:
|
||||
seg1_blocks = blocks[seg40_indices[0]:seg40_indices[1]+1]
|
||||
print(f"\n=== {stem} segment 1 ({len(seg1_blocks)} blocks) ===")
|
||||
for b in seg1_blocks[:25]:
|
||||
tag = f"{b.tag_hi:02x}{b.tag_lo:02x}"
|
||||
print(f" off={b.offset:>5} {tag} NN=0x{b.tag_lo:02x}({b.tag_lo:>3}) len={b.length:>3} data={b.data[:16].hex(' ')}{'...' if len(b.data)>16 else ''}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user