Introduction
A Sound Designer II file needs both its forks. A file system without forks (a web server, a Windows disk, a zip file) stores one of them, so the file arrives as a data fork alone, or wrapped. The explorer accepts these shapes:
- Data fork alone (
.sd2): only the samples. The sample size, channels and rate are chosen in the options bar. - MacBinary II or III (
.bin): both forks in one file. - AppleSingle: both forks as entries of one file.
- AppleDouble (
._name): the resource fork alone, kept next to the data fork. macOS writes it when it copies a file with a resource fork to a volume without forks. - Resource fork alone (
.rsrc): shown with its parameters and records, without sound.
MacBinary
A 128-byte header, then the data fork padded with zeros to a multiple of 128 bytes, then the resource fork padded the same way. All numbers are big-endian.
| Offset | Size | Field |
|---|---|---|
| 0 | 1 | Zero |
| 1 | 1 + 63 | File name: a length byte (1 to 63; 1 to 31 in the Finder) and the characters |
| 65 | 4 | File type: Sd2f |
| 69 | 4 | Creator |
| 73 | 1 | Finder flags, high byte |
| 74 | 1 | Zero |
| 75 | 6 | Icon position and window or folder ID |
| 81 | 1 | Protected flag |
| 82 | 1 | Zero |
| 83 | 4 | Data fork length |
| 87 | 4 | Resource fork length |
| 91 | 4 + 4 | Creation and modification dates, seconds since 1 January 1904 |
| 99 | 2 | Length of the Get Info comment after the resource fork |
| 101 | 1 | Finder flags, low byte |
| 102 | 4 | MacBinary III: mBIN |
| 106 | 2 | MacBinary III: script of the name, extended Finder flags |
| 116 | 4 | Total length when unpacked (never used) |
| 120 | 2 | Secondary header length (to skip, rounded up to 128) |
| 122 | 1 | Version: 129 for II, 130 for III |
| 123 | 1 | Minimum version to read it |
| 124 | 2 | CRC-16 of bytes 0 to 123: polynomial 0x1021, starting at 0 |
| 126 | 2 | Zero |
The explorer takes a MacBinary file as Sound Designer II when the header’s CRC or mBIN signature checks out and the file type is Sd2f or the name ends .sd2.
AppleSingle and AppleDouble
A 26-byte header (magic 00 05 16 00 for AppleSingle or 00 05 16 07 for AppleDouble, a version, 16 bytes of filler and the number of entries), then a 12-byte descriptor for each entry (ID, offset, length), then the entries. Entry 1 is the data fork, entry 2 the resource fork and entry 3 the real file name. An AppleDouble file holds the resource fork and the Finder information; the data fork is the file it sits beside, so the explorer shows parameters and records but no sound for it alone.
The site’s AppleSingle and AppleDouble page describes the entries in full.
Sources
- Leonard Rosenthol, MacBinary III, in Info-ZIP’s
macbin3.h; the MacBinary II standard; the summary in the Maconv notes. - RFC 1740, MIME Encapsulation of Macintosh Files.
- Files made by
scripts/sd2f/make-samples.mjsfrom forks written by Core Audio, read back by the explorer’s tests.