Repository navigation
D39: read the Sound Designer II loop from sdLL, verified by the Digidesign spec - #82
Merged
Merged
Conversation
…esign spec The 24 Sd2f files on sonic-images-v2 (D33) converted without a loop, for want of an oracle to verify the sdLL region resource against (ADR-0025). The oracle is the Digidesign Sound Designer II specification itself (recovered from the Wayback Machine): sdLL is an 8-byte header plus one 14-byte LoopRecord per loop, positions in sample frames. sample/sd2.py now decodes sdLL into the WAV smpl chunk (one loop per record, per-channel frames; root key still None). Confirmed three ways: the spec; the layout decoding all 24 resources with zero leftover bytes and every field on a documented in-range value (LoopSense 117 on all 24); and emu3.md's forward shape/join oracle corroborating 21 of 24, the three inharmonic guitar/stack loops it has no power on emitted and named. Adds the verified sdLL layout to docs/formats/hfs.md, ADR-0046, a disc-gated test in tests/test_discs.py, and CHANGELOG/README/README-index entries. Closes #75. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #75. Deferred from D33/ADR-0040.
What this does
D33 converts the 24
Sd2ffiles onsonic-images-v2to WAV but writes no loop, because ADR-0025 forbids decoding a loop without an oracle — an off-by-units or off-by-a-field loop opens, plays, and reports nothing wrong. This reads the loop from the resource fork'ssdLLregion resource and carries it into the WAVsmplchunk, once an oracle exists to verify the interpretation.The oracle
The hunt succeeded on path #1 of the three #75 named: the primary-source Digidesign Sound Designer II specification (© Digidesign 1988–1990), recovered from the Wayback Machine copy of
lim.di.unimi.it/IEEE/DGDES/SDII.HTM(the live page is gone). It givessdLL's exact layout and, decisively, its units — sample frames:Version,HScale,VScale,NumLoops(Int each), thenNumLoops× a 14-byteLoopRecord:LoopStart,LoopEnd(LongInt, sample frames),LoopIndex(Int,1..NumLoops),LoopSense(Int,117forward /118alternating),Channel(Int,0..NumChannels-1), all big-endian.Confirmed three ways — a stronger basis than the E-mu loops shipped on, which had no spec at all:
sdLLis exactly 22 bytes =8 + 14×1with zero trailing bytes,Version1,NumLoops1,LoopSense117 on all 24,LoopIndex1,Channel0 or 1 (in range, and varying — a real field), everyLoopStart < LoopEnd ≤ frameCount. A wrong field layout cannot land all of these at once.eiv-analogialoops that needed the period window (ADR-0044).What it decodes, and what it deliberately does not
Channelrecords which channel it was authored on and does not change the index.F#2 Gtr Str,E1 Gtr Str,Obiestack C2— inharmonic guitar/stack loops — score below the confirm bar because a forward window has no power on that timbre, not because the loop is wrong (the spec confirms the interpretation identically for all 24). They are emitted and pinned by name in the suite, the same stance ADR-0044 takes foreiv-analogia's unscorable loops.sdLLcarries none, sopitchstaysNoneand thesmplchunk keeps the neutralMIDIUnityNote60, exactly as the E-mu path does.LoopEnd) is below audio resolution — the splice scores identically atLoopEnd-1/LoopEnd/LoopEnd+1— so it is documented, not guessed.Changes
src/samplerdisc/sample/sd2.py—_loops()decodessdLLinto a range-gated, degrade-safeSd2Looptuple;extract._convert_sd2was already passingloops=_wav_loops(sample), so the loop flows through unchanged.docs/formats/hfs.md— the verifiedsdLLlayout table, units, and the three-part oracle, with the recovered source.docs/adr/0046-the-sd2-loop-is-decoded-from-sdll.md— new ADR in the 0025 family; rejects emitting only the content-confirmed subset, and deferring for want of a per-file render.tests/test_discs.py—test_hfs_sd2_loops_decode_and_splice: decode + WAV-smplwrite-path (parsed back out of the file) + the forward-shape measurement, gated on the disc like the other oracles.docs/README.md,docs/adr/README.md,README.md,CHANGELOG.md— D39 recorded; the earlier "SDII loop is not read" caveats updated.Verify
uv run ruff check .·uv run ruff format --check .·uv run pytest -q·uv tool install --editable . && samplerdisc --version— all pass. WithSAMPLERDISC_TEST_DISCSset, the disc-gated sd2/hfs family passes and end-to-endextractwrites all 24 SDII WAVs carrying asmplloop. No audio or disc images in the tree; themachfsbyte oracle still pins every fork, so audio digests do not move.🤖 Generated with Claude Code