Skip to content

D23: refuse the E-mu whole-extent "no loop" at both ends, not only at frame 0 - #46

Merged
bmxcode merged 1 commit into
mainfrom
d23-emu3-inset-no-loop
Aug 24, 2026
Merged

D23: refuse the E-mu whole-extent "no loop" at both ends, not only at frame 0#46
bmxcode merged 1 commit into
mainfrom
d23-emu3-inset-no-loop

Conversation

@bmxcode

@bmxcode bmxcode commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Closes #41.

What this does

sample/emu3.py refuses a loop spanning a sample's whole declared extent, because that span is the E-mu format's "no loop": the sampler fills the four loop pointers with the sample's own bounds when nothing set them, and emitting it writes a smpl chunk telling a DAW to loop the entire file. The guard was a == 0 and b >= extent − FULL_EXTENT_SLACK — slack at the end, an exact zero required at the start.

The discs do not write those bounds at frame 0. They write them inset by a small fixed amount at both endsloop_start = start + C1, loop_end = end − C2 for a per-disc constant of a handful of bytes: ditto-drums (12, 12), the EIIIX discs (4, 4), esi32-gm/protozoa/eiv-vitous/eiv-analogia (12, 10). So the frame-0 guard never fired, and ten discs shipped a loop over the whole file — 934 of ditto-drums's 948 records most visibly.

This widens the guard to refuse a loop within FULL_EXTENT_SLACK frames of both ends:

if a <= FULL_EXTENT_SLACK and b >= extent - FULL_EXTENT_SLACK:
    continue

What the discs showed

Widening was not obviously right — a sustained organ or string can legitimately loop over nearly its whole length, and a rule that deletes those to catch drum hits would destroy real loop points. It was measured against all ten reference discs before the guard was written.

The shape/join correlation is the wrong instrument here, exactly as the issue warned: a whole-extent loop starts within a few frames of 0 and ends within a few of the last, so there is almost no audio before its start for the windowed correlation to score. Two measurements that do apply separate the populations on every disc:

  • End energy — the loop end sits below 15 % of the sample's peak (ends in silence) on 70–100 % of the inset population, where a real loop does so on only 13–33 %.
  • Uniqueness — where a record is loud enough at both ends to score, the join splices where a random start against the same end does not (a chosen loop point) on 0–11 % of the inset population, against 33–56 % of the loops this project already ships.
Disc refused inset ends quiet inset uniquely-splices real-loop control
esi32-gm 428 70 % 11 % 37 %
protozoa 1 762 72 % 10 % 37 %
eiiix-1 472 98 % 1 % 49 %
eiiix-2 372 97 % 2 % 41 %
emu-classics 302 88 % 3 % 36 %
vintage 107 82 % 5 % 46 %
ditto-drums 934 100 % 0 % 43 %
eiv-analogia 443 97 % 1 % 33 %
eiv-studio 337 87 % 4 % 41 %
eiv-vitous 628 100 % 56 %

The right-hand column is that same uniqueness measured on the disc's real loops — the calibration — and the inset population sits far below it every time. Structure agrees with content: the inset bounds are the record's own extent inset by a fixed constant (an auto-filled field), where a hand-set loop start is at an arbitrary musical position (44, 136, 11 204, 52 536, never a fixed few).

eiv-vitous and eiv-studio are the check that matters most: ADR-0025 validated their loops by the shape test at +0.68 and +0.86, and those validated loops are the real-loop column — they are kept. What is refused there is a separate whole-extent population that ends in silence. eiv-analogia's loops never had independent evidence (ADR-0025: 34 scored, showed nothing), so refusing 443 of its 449 takes nothing that was ever established.

Effect

Loop counts move on every disc; no audio moves. read_file and the offset arithmetic are untouched, so every per-disc payload digest, and the sample and stereo counts, are unchanged — only the loop-count column moved, and the disc-backed suite pins the new numbers.

disc loops before → after disc loops before → after
esi32-gm 1 778 → 1 350 ditto-drums 948 → 14
protozoa 5 244 → 3 482 eiv-analogia 449 → 6
eiiix-1 1 215 → 743 eiv-studio 2 551 → 2 214
eiiix-2 1 264 → 892 eiv-vitous 826 → 198
emu-classics 1 435 → 1 133 vintage 953 → 846

End-to-end: ditto-drums now writes 948 WAVs of which 14 carry a loop, down from 948.

Anyone who extracted an E-mu disc before this got a smpl chunk looping the whole file on a large fraction of its samples — harmless where a DAW ignores smpl, wrong where it does not. The audio was always right.

Alternatives rejected

  • Leave the guard at a == 0 — ships the bug on ten discs.
  • A content guard on end-silence — keeps the loud-ended inset loops, but puts an RMS measurement of the audio into the parser, the coupling ADR-0025's "watch for" warns against; and the loud-ended remainder is not clearly real (it splices at random starts nearly as often as at the bound — a sustained tone, not a chosen loop).
  • Match each disc's fixed (C1, C2) inset — needs a per-disc constant in the parser and buys nothing the simple both-ends slack does not.
  • Widen the end slack instead — misreads the bug; it was the start that was pinned to 0.

What it deliberately does not claim

It catches the whole-extent-with-inset form the ten discs write, not every "no loop" a future generation might encode. And on esi32-gm and protozoa about 10 % of the refused records splice uniquely and could conceivably be a near-whole-extent loop the disc intended; they are refused with the rest because they are structurally the record's own bounds inset by the same fixed constant, and separating them would need the content test this project keeps out of the parser. That cost is recorded rather than hidden (ADR-0030).

🤖 Generated with Claude Code

… frame 0

The E-mu format's "no loop" is the sample's own bounds written into the loop
pointers, inset by a small fixed amount at *both* ends (ditto-drums (12,12),
EIIIX (4,4), esi32-gm/protozoa (12,10)). The guard refused it only where the
start was exactly 0, so ten discs shipped a smpl chunk looping the whole file
-- 934 of ditto-drums's 948 records.

Measured across all ten reference discs, the inset whole-extent population is a
filled-in no-loop: 70-100% ends in silence (real loops 13-33%), the bounds are
the record's own extent inset by a fixed constant (real loops sit at arbitrary
positions), and it carries a uniquely-splicing loop point on 0-11% of records
(real loops 33-56%). The eiv-studio/eiv-vitous loops ADR-0025 validated are the
kept population; only the whole-extent no-loops are refused.

Widen the guard to a <= FULL_EXTENT_SLACK. No audio moves -- read_file and the
offset arithmetic are untouched, every payload digest is unchanged; only loop
emission moves, on every disc. See ADR-0030 and docs/formats/emu3.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bmxcode
bmxcode merged commit 3e3f7bd into main Aug 24, 2026
1 check passed
@bmxcode
bmxcode deleted the d23-emu3-inset-no-loop branch August 24, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

emu3: a whole-extent loop is only refused where it starts at frame 0

1 participant