Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,37 +78,40 @@ Compressed `.mdx` is the piece no other open-source tool reads today. The format

## Tested against

104 disc images from six sources — five archive.org collections and one direct index. From archive.org: [retro-sample-cds](https://archive.org/details/retro-sample-cds) (27), [Best Service ProSamples](https://archive.org/details/best-service-pro-samples-vol.-12-dance-vocals-akai-1-cd) (29), the [E-MU EIIIX Sound Library](https://archive.org/details/vol.-3-orchestral) (15), [archive-oldschoolscds](https://archive.org/details/archive-oldschoolscds) (15) and the [E-mu E-IV Series Factory Library](https://archive.org/download/e-mu-eiv-series-factory-library) (9); plus [nnty.fun's 90s sample CDs](https://nnty.fun/downloads/other/90ssamplecds/) (9). Seventy-seven flat `.iso`/`.bin`, seventeen compressed `.mdx`, five raw CD images, two `.nrg`, one `.mds`/`.mdf` pair, two audio CDs. The figures below are regenerated by `scripts/benchmark.py` against the current shelf, and re-anchor as discs are added.
106 disc images from six sources — five archive.org collections and one direct index. From archive.org: [retro-sample-cds](https://archive.org/details/retro-sample-cds) (27), [Best Service ProSamples](https://archive.org/details/best-service-pro-samples-vol.-12-dance-vocals-akai-1-cd) (29), the [E-MU EIIIX Sound Library](https://archive.org/details/vol.-3-orchestral) (15), [archive-oldschoolscds](https://archive.org/details/archive-oldschoolscds) (15) and the [E-mu E-IV Series Factory Library](https://archive.org/download/e-mu-eiv-series-factory-library) (9); plus [nnty.fun's 90s sample CDs](https://nnty.fun/downloads/other/90ssamplecds/) (11). Seventy-seven flat `.iso`/`.bin`, seventeen compressed `.mdx`, seven raw CD images, two `.nrg`, one `.mds`/`.mdf` pair, two audio CDs. The figures below are regenerated by `scripts/benchmark.py` over the disc collection — the loose E-mu `.ebl` bank trees the tool also converts are staged apart and covered in *The E-mu EBL banks* below — and re-anchor as discs are added.

| | |
|---|---|
| Discs converted | 97 of 104 |
| Samples | 137 854 |
| Stereo pairs rejoined | 17 369 |
| Discs converted | 102 of 106 |
| Samples | 150 640 |
| Stereo pairs rejoined | 19 504 |
| Audio CD tracks | 161 |
| Duplicate audio suppressed | 5 719 |
| Entries not the file their entry placed | 104 |
| Entries skipped (damage) | 23 |
| Time | 83 s |
| Entries not the file their entry placed | 2 |
| Entries skipped (damage) | 30 |
| Time | 79 s |

By filesystem:

| | Discs | Samples | Stereo pairs | Skipped |
|---|---:|---:|---:|---:|
| AKAI | 45 | 72 389 | 16 021 | 127 |
| E-mu `EMU3` | 31 | 47 472 | 7 | 0 |
| ISO 9660 | 16 | 12 662 | — | 0 |
| AKAI | 45 | 72 491 | 16 071 | 25 |
| E-mu `EMU3` | 31 | 47 468 | 7 | 0 |
| ISO 9660 | 15 | 12 662 | — | 0 |
| HFS (SampleCell) | 2 | 1 144 | — | 0 |
| Kurzweil `KMSI` | 2 | 10 483 | 2 085 | 7 |
| Roland `S770 MR25A` | 5 | 6 392 | 1 341 | 0 |
| Audio CD | 2 | 0 | — | 0 |

"Stereo pairs" counts files joined from an `-L`/`-R` pair by name. E-mu's seven are the only ones across those discs, and they are a different and much rarer thing than the 13 238 samples whose record declares two channels.
"Stereo pairs" counts files joined from an `-L`/`-R` pair by name. E-mu's seven are the only ones across those discs, and they are a different and much rarer thing than the 17 929 samples whose record declares two channels.

Every sampler-filesystem WAV was checked against the disc it came from — **81 of 81 discs match exactly**, comparing the decoded audio against the disc's own bytes: a mono record's PCM is a run of the payload, and a stereo record's two channel blocks are the payload with its written interleave undone. 126 253 payloads, zero mismatches. The ISO 9660 discs are not in that count; where one ships a sound as both AIFF and WAV — the thirteen ProSamples discs — the publisher's own WAV is the oracle for what the conversion should produce, a stronger check still (below). The two audio CDs are in neither count: their tracks are cut from a stream by a cue, so there is no run of bytes on the disc to compare a track against.
Every sampler-filesystem WAV was checked against the disc it came from — **81 of 81 discs match exactly**, comparing the decoded audio against the disc's own bytes: a mono record's PCM is a run of the payload, and a stereo record's two channel blocks are the payload with its written interleave undone. 126 351 payloads, zero mismatches. The ISO 9660 discs are not in that count; where one ships a sound as both AIFF and WAV — the thirteen ProSamples discs — the publisher's own WAV is the oracle for what the conversion should produce, a stronger check still (below). The two SampleCell discs are not either — their audio is byte-swapped on the way to WAV like any AIFF, so instead both forks are checked against `machfs`, an independent HFS reader, byte for byte (D32/D33). The two audio CDs are in neither count: their tracks are cut from a stream by a cue, so there is no run of bytes on the disc to compare a track against.

156 445 WAV files were written in all — the samples, the stereo joins and the audio CD tracks. None is unreadable and none is zero-length. **301 are silent for their whole length, and every one of them matches the disc exactly**: 267 are the blank `15G-KIT…Z` slots on `ProSamples vol.15`, 24 are unused slots on the `Ditto Drums` ESI-32 disc, six are on a Proteus library that ships `Dead Air` as a sample, two are on a Roland disc, and one each on `E-mu Classics` and `Vintage`. That is what the discs hold, not something the decoder did.
170 305 WAV files were written in all — the samples, the stereo joins and the audio CD tracks. None is unreadable and none is zero-length. **301 are silent for their whole length, and every one of them matches the disc exactly**: 267 are the blank `15G-KIT…Z` slots on `ProSamples vol.15`, 24 are unused slots on the `Ditto Drums` ESI-32 disc, six are on a Proteus library that ships `Dead Air` as a sample, two are on a Roland disc, and one each on `E-mu Classics` and `Vintage`. That is what the discs hold, not something the decoder did.

Sample rates run from 6 000 to 50 000 Hz across 1 566 distinct values. The odd ones are real — E-mu writes rates like 24 444 and 27 778, and AKAI uses 33 075 (¾ of 44 100) and 29 400 (⅔) to trade bandwidth for memory. They are carried through exactly as the disc states them and never rounded.
Sample rates run from 6 000 to 50 000 Hz across 1 761 distinct values. The odd ones are real — E-mu writes rates like 24 444 and 27 778, and AKAI uses 33 075 (¾ of 44 100) and 29 400 (⅔) to trade bandwidth for memory. They are carried through exactly as the disc states them and never rounded.

The 127 AKAI entries not written are two different faults. **104 are payloads that are not the file the directory placed there** — their header carries another file's id, valid flag or name — and 103 of those 104 are a run to the end of one volume, on nine discs; the other 36 AKAI discs have none. That is what a rip losing a run of blocks looks like from inside a directory, and it does not need a partition to go missing: `Best Service - Alpha Dance II` declares six partitions and holds all six, and still loses 21 of `AC.DRUMLOOPS`'s 22 samples. Each is refused with a line naming every field that disagrees and the entry that placed it, rather than being written out under a name that is not its own ([ADR-0027](docs/adr/0027-a-payload-must-be-the-file-its-entry-placed.md)). Every one of those 103 is sitting intact, under its own name, a whole number of container blocks earlier in the image — the same fault as the displaced partitions below, one level down, and not yet recovered ([#35](https://github.com/bmxcode/samplerdisc/issues/35)).
The 25 AKAI entries not written are two different faults. **Two are payloads that are not the file the directory placed there** — their header carries another file's id, valid flag or name. There were 104: a rip that loses a run of blocks *inside* a partition slides a tail of one volume's samples forward, so each entry ends up pointing at the audio that took its place, and it does not need a partition to go missing (`Best Service - Alpha Dance II` declares six partitions and holds all six, and still displaced 21 of `AC.DRUMLOOPS`'s 22 samples). D38 recovers 102 of the 104 by searching backward, in the container's own block size, for a header that restates the entry's own name and word count, floored at the partition ([ADR-0045](docs/adr/0045-a-displaced-sample-is-recovered-by-its-own-name-and-word-count.md), [#35](https://github.com/bmxcode/samplerdisc/issues/35)). The two that remain are named, not written: `AMG - Loop Soup`'s one record whose start block lands mid-sample, so no header exists earlier to find, and `AKAI.S3000.Sound.Library.3`'s `20 CHINA2-R`, whose only backward match is a same-named, same-sized file in the previous partition — its bytes, not this one's. Each is refused with a line naming every field that disagrees and the entry that placed it, rather than being written out under a name that is not its own ([ADR-0027](docs/adr/0027-a-payload-must-be-the-file-its-entry-placed.md)).

The other 23 are damage of a different kind, and 19 of them are not damage at all: four samples whose header is otherwise perfect and whose rate field reads 0, 519, 519 or 1280, and **19 `-L`/`-R` pairs whose two halves declare different sample rates** — 18 of them synth FX on `AKAI.S3000.Sound.Library.6`, at 44 597 against 44 100 and the like. The joiner refuses to fuse a pair the disc disagrees with itself about, and writes both mono halves instead, so no audio is lost.

Expand Down
23 changes: 20 additions & 3 deletions scripts/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
``<state>/<source-slug>/``, the source breakdown and container counts follow
without editing the script. Source names and URLs are read from each
``incoming/<source-slug>/_details.md`` when present, so a new source documents
itself.
itself. Only the curated disc states (``active``/``archive``/``blocked``) are
walked; ``incoming/`` staging and ``oracles/`` are skipped, so the loose E-mu
bank trees staged there for the EBL oracle do not count as disc images.

Run it from a release branch when cutting a version, the way 0.3.0 did.
"""
Expand All @@ -40,10 +42,12 @@
"akai": "AKAI",
"emu3": "E-mu `EMU3`",
"iso9660": "ISO 9660",
"hfs": "HFS (SampleCell)",
"kurzweil": "Kurzweil `KMSI`",
"roland_s7xx": "Roland `S770 MR25A`",
"none (Red Book audio)": "Audio CD",
}
FS_ORDER = ["akai", "emu3", "iso9660", "roland_s7xx", "none (Red Book audio)"]
FS_ORDER = ["akai", "emu3", "iso9660", "hfs", "kurzweil", "roland_s7xx", "none (Red Book audio)"]

#: A readable label per container kind reported by the manifest.
CONTAINER_LABEL = {
Expand Down Expand Up @@ -157,10 +161,23 @@ def main() -> int:
print("set SAMPLERDISC_TEST_DISCS or pass a collection root", file=sys.stderr)
return 2

# The "Tested against" benchmark is the curated *disc* collection, which the
# shelf keeps under active/archive/blocked. ``incoming/`` is staging and the
# E-mu ``.exb`` oracle corpus (mattetti's rendered banks, D34's stereo
# oracle), and ``oracles/`` is reference material -- neither is a disc image
# from the six sources the section counts, and the loose E-mu banks D35
# converts are documented in their own "E-mu EBL banks" prose. So walk the
# curated states where they exist, and fall back to the whole root for a
# flat collection that has none of them.
curated = [
root / state for state in ("active", "archive", "blocked") if (root / state).is_dir()
]
walk_roots = curated or [root]

out = Path(tempfile.mkdtemp(prefix="samplerdisc-bench-"))
try:
started = time.monotonic()
reports = list(convert_tree(str(root), str(out)))
reports = [r for wr in walk_roots for r in convert_tree(str(wr), str(out))]
elapsed = time.monotonic() - started
files, silent, silent_by_dir, rates = _wav_stats(out)
finally:
Expand Down
Loading