scarletbook
scarletbook reads Super Audio CD (Scarletbook) disc images, from Rust or from C: the TOC and its text, the audio areas and tracks, DST decoding, and DSF or DSDIFF files laid out from them. It is for players, rippers, filesystems and taggers that need a clean-room, permissively licensed reader, written only from the specifications and conformance corpus of aclater/sacd-spec.
Platforms
| System | How | Guide |
|---|---|---|
| Linux x86_64, glibc 2.17 or later | Rust: the crates. C: the x86_64-unknown-linux-gnu archive, and -v3 for x86-64-v3 CPUs. Rust tests and the archive's tests run in CI. |
Rust, C, assets |
| Linux x86_64, musl 1.2 or later | Rust: the crates. C: the x86_64-unknown-linux-musl archive, and -v3. The archive's tests run in CI. |
Rust, C, assets |
| Linux aarch64, glibc 2.17 or musl 1.2 or later | Rust: the crates. C: the aarch64-unknown-linux-gnu and -musl archives, built and tested on Arm runners in CI. |
Rust, C, assets |
| macOS 11.0 or later (Apple silicon), 10.12 or later (Intel) | Rust: the crates, tested in CI on Apple silicon. C: the aarch64-apple-darwin and x86_64-apple-darwin archives, each tested on its CPU in CI. |
Rust, C, assets |
| Windows 10 or later, x86_64 | Rust: the crates, tested in CI. C: the x86_64-pc-windows-gnu archive, for a UCRT MinGW-w64 GCC; tested in CI. |
Rust, C, assets |
| 32-bit x86 (i686) | Rust only: the crates, built from source; no C archive. CI runs the core, PCM and corpus tests on i686-unknown-linux-musl (Pentium 4 and Atom baselines). |
Rust |
Performance figures are measured on an AMD Ryzen 9 3950X (Zen 2); see Performance and benchmarks.
Quick start
Both examples read a small synthetic image from this repository's conformance corpus,
full-text.iso
(1.1 MB, CC0-1.0, corpus/LICENSE): a stereo area with three tracks of one or two
frames each, and every text field filled in. It holds generated test signals, no real audio.
Every command below was run against v1.1.1 on 2026-11-25.
Rust
&&
album: "Album title"
TwoChannel area: 2 channels, 3 tracks
track 1: 1 frames, "Title 1"
track 2: 1 frames, "Title 2"
track 3: 2 frames, "Track 3 title, second item"
The =1.1.1 pin keeps the example on the release whose output is shown. For a project of your
own, Installing gives a plain cargo add scarletbook, and pins only
scarletbook-pcm exactly. A frame is 1/75 s.
{:?} quotes a string and escapes control characters, including U+007F and U+0080 to U+009F,
while keeping other text (Japanese, say) readable, which escape_default() would turn into
\u{..} escapes. For audio, see Using the library.
C
On x86_64 Linux with glibc 2.17 or later and a C compiler. The archive's name and the checks are those of Release assets and Verifying a download.
&&
P=scarletbook-ffi-1.1.1-x86_64-unknown-linux-gnu
scarletbook-ffi-1.1.1-x86_64-unknown-linux-gnu.tar.gz: OK
ABI 2, album: Album title
area slot 0: 2 channels, 3 tracks
track 1: 1 frames, Title 1
track 2: 1 frames, Title 2
track 3: 2 frames, Track 3 title, second item
Titles and other text come from the disc and can hold control characters (U+007F, U+0080 to U+009F,
and U+009B starts a control sequence on some terminals), so both examples escape what they print;
code of yours should do the same, as the docs of
DiscText and of
sb_disc_string say.
gh attestation verify exits with status 0 when it succeeds, and non-zero on a failure. In a
terminal it also prints the policy it checked and "Verification succeeded!"; when its output is
not a terminal, as in a script, it prints nothing on success.
The program records libscarletbook_ffi.so.2, the library's name for C ABI 2, and finds it through
the rpath, so it runs from this directory without the link. To ship it, copy
lib/libscarletbook_ffi.so.2 next to the program, as Linking says. See the C ABI guide
for the rest of the API, and Migrating to 0.7.0 and
Migrating to 0.6.0 from an earlier release.
Documentation
The documentation index groups every guide by task.
- Rust guide: installing, reading audio, stored frames, DSF and DSDIFF files, seek indexes and provisional reading, features
- C ABI guide: the C library, Linking and
ABI compatibility, the rules for
SB_ABI_VERSION - Using from Python (ctypes): bindings for every struct, and the whole TOC in one call
- Releases and verification: the release assets, checksums, attestations and crates.io publishing
- Stability and versions: the 1.0 promise, versions, the minimum
supported Rust version, and
scarletbook-pcm(decommissioned (#398): frozen at 0.7.0 on crates.io, no further releases; consumers convert DSD to PCM in their own crate instead) - Performance and benchmarks: the benchmark program, the benchmark kit, and measuring performance
- Contributing and the clean room: the repository layout, the clean-room rule (CONTRIBUTING.md, CLEANROOM.md), and changing the C ABI
- Migrating to 0.7.0 and Migrating to 0.6.0
- CHANGELOG.md, RELEASING.md and SECURITY.md (reporting vulnerabilities)
Licence and credits
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Written only from the specifications and conformance corpus of
aclater/sacd-spec; the corpus in corpus/ is copied
from it unchanged (CC0-1.0, corpus/LICENSE).