Introduction
The AU format was introduced by Sun Microsystems for its Unix workstations, and NeXT
used the same layout with the extension .snd. It is one of the simplest
audio files there is: a short header and then the samples. It was common on Unix
systems and on the early web, and many files hold 8-bit µ-law audio at 8000 Hz, the
encoding of telephone sound.
Structure
The file starts with the magic number .snd (2E 73 6E 64).
Five 32-bit big-endian fields follow: the offset of the audio data, the data size in
bytes (FFFFFFFF when unknown), the encoding, the sample rate and the
channel count. The bytes between the header and the data offset are a free-form
annotation, often text, which the format defines as at least 4 bytes long, though some
writers leave it out. The samples follow, big-endian and interleaved by channel. RFC 2046 defines the MIME type
audio/basic as single-channel 8-bit µ-law at 8000 Hz (raw samples, no header); a µ-law,
8000 Hz, mono AU file holds the same samples behind a header. See
Header.
Common encodings are 1 (8-bit µ-law), 2, 3, 4 and 5 (8-, 16-, 24- and 32-bit linear PCM), 6 and 7 (32- and 64-bit floating point) and 27 (8-bit A-law). Codes 0 to 29 come from NeXT’s header, 30 to 33 from MusicKit; all are on the Encodings page.
0Magic .snd4 bytes4Data offset where the samples start4 bytes8Data size in bytes, or FFFFFFFF4 bytes12Encoding µ-law, PCM, float, A-law4 bytes16Sample rate4 bytes20Channels4 bytes24Annotation up to the data offsetvaries…Samples big-endian, interleavedvaries
Not described
These pages follow Oracle’s au(4) manual page, the McGill AU notes, and the libsndfile and
FFmpeg readers. A .snd file is offered to the AU, 8SVX and raw PCM plugins in that order, and
the AU plugin takes it when it starts with the magic .snd, dns. or one of the two DEC spellings. The explorer
reads the header, shows the annotation (as text, or as key=value lines), and plays 8-, 16-, 24-
and 32-bit linear PCM, 32- and 64-bit float, µ-law, A-law, NeXT’s run-length coded µ-law (17), 16-bit emphasised linear (18),
the DSP data codes 12 to 14, NeXT’s compressed sounds (19 and 20: Audio Transform Compression and Parallel Packing, all three methods)
and the CCITT ADPCM encodings 23 to 26.
Known, not yet covered
- Viewer: the CCITT ADPCM encodings 23, 25 and 26 are decoded by a port of Sun’s reference
C code (
shared/audio/g72x-sun.js) and the output equals a build of that C code sample for sample, for 3, 4 and 5 bits (libsndfile’ssrc/G72xwith the original+ 0x30rounding that libsndfile removed, and SoX’s copy, both compiled and run underResearch/Specs/au). The codes are packed first code in the low bits, which is how those readers unpack them. Three real files in the MPlayer sample collection (an oboe note as G.721, G.723 24 and G.723 40, dated 1998, data size 0) settle the packing for the SoX family of that code: decoded as above, the 4-bit and 3-bit files agree with the 5-bit one to 36.3 and 30.0 dB, and with the codes read the other way round the same files give 4.4 and −17.9 dB (noise). The reference code itself is the only source for Sun’s own tools. FFmpeg’s ITU-T G.726 decoder differs from the Sun code in small steps and is used only for FFmpeg’s private 2-bit code 0x37323632; code 24 (G.722) uses the shared G.722 decoder, equal to FFmpeg. - Viewer: codes 17 (run-length coded µ-law) and 18 (16-bit linear, emphasised) are played, from NeXT’s own SoundKit source (see the Encodings page); for 18 and 20 the hardware low-pass filter that NeXT’s player switches on is not applied. Codes 12, 13 and 14 are played as 16-, 24- and 32-bit linear, as the SoundKit and MusicKit source read them. The compressed codes 19 and 20 are played for every method: Audio Transform Compression (method 2) and Parallel Packing (0, bits dropped, and 1, bit-faithful). The ATC decoder and the Parallel Packing decoder are ports of NeXT’s C code and equal a build of that code sample for sample. Codes 8, 9, 10, 11, 16, 21, 22, 28 and 30 to 33 are labelled “not yet decoded” (see Unknown); the header, annotation and a hex view are shown for all of them, with the subheader and the length of a DSP-commands sound (21 and 22).
- Viewer: checked on the 35 distinct real files on this Mac (all 8-bit µ-law, equal to FFmpeg); on 12 more real NeXT, Sun, libsndfile, SoX and AFsp files from MPlayer’s sample collection (8- to 32-bit linear, float and double, µ-law, an AFsp file with information records, a BICSF hybrid file), every one that Apple’s Core Audio can open equal to Core Audio’s own reading, sample for sample (28 files); on 16 files that Core Audio itself wrote (8-, 16-, 24- and 32-bit linear, 32- and 64-bit float, µ-law and A-law, mono and stereo: equal); and on built files: FFmpeg-written files of every PCM, float and companded encoding in mono and stereo, the little-endian “dns.” and DEC forms, unknown and zero data sizes, ATC files of 120,000 frames, cut and damaged files, a fuzz of 3,000 changes and a sweep of 2,627 headers with the offset, size, rate or channel count set to boundary values for every encoding. The compressed sounds were made by NeXT’s own coders built from the SoundKit source (14 small tone, sweep and noise sounds, mono and stereo, and 900 more random ones, 300 of each method, in a comparison run: all equal to NeXT’s decoder).
- Viewer: every encoding the explorer plays is read by ranges or by a run that can be resumed, so the waveform (at any zoom), Play (from any place, in chunks) and the peak and RMS levels cover the whole sound, of any length. The G.721, G.722 and G.723 ADPCM codes (23 to 26 and FFmpeg’s private 2-bit code) are decoded in order, with each channel’s decoder state saved every few million frames; tested on sounds of 8.7 to 9.2 million frames, compared with a plain decode of the whole stream, at places on both sides of 8,388,608 samples and at the end.
- Reference: which G.721 and G.723 decoder form a file was written for matters. The explorer implements Sun’s
(
+ 0x30rounding kept). libsndfile’s current decoder dropped the rounding, so the three libsndfile-written sample files decode here 34% to 55% (relative RMS) differently from libsndfile’s own decoder, whilesf-g721.au, written by another tool, agrees with the Sun form. The Encodings page explains this in full (“Two forms of the G.721 and G.723 decoder”). - Reference: short public meanings of codes 8 (sampled data fragmented by editing; never in files),
9 (multiple sound structures), 10 (a loadable DSP core program), 16 (display data of the Sound Kit’s
SoundViewclass, not playable) and 17 (8-bit µ-law with run-length encoding of silence) are in the Encodings table (the Kaitai AU specification gives the one-line meanings; the layout of 10, 17 and 18 comes from NeXT’s SoundKit source). NeXT’sconvertsound.hadds, for the compressed codes, that for method 0 the drop amount is a right shift of each sample, 4 to 8 bits (4 typical), that bit-faithful mode may use it to change the amount of compression but decoding is exact, that compressing takes 16-bit linear or emphasised input, and that the defaults are ATC and 0. - Reference: Sun’s
au.hmakes the information field optional (“4 bytes (min)”) and the IRIXnext(4)page says NeXT files need at least 4 bytes where a Sun file may have none; the Header page now says which writer family follows which rule, lists the annotation conventions (plain text,key=value, AFsp records, the BICSF hybrid with an IRCAM header) and compares how Core Audio, FFmpeg, libsndfile, libSoX, Java and Python treat odd sizes and offsets. The explorer lists AFsp records as rows and names a BICSF hybrid header (its sample rate, channels and packing mode) but does not decode IRCAM’s code blocks, which belong to a format of their own that this site does not have a page for yet.
Unknown
- Reference and Viewer: codes 9 (nested), 28 (AES) and 29 (delta µ-law) have no layout in any source. NeXT’s own documentation of the SNDSoundStruct (Doug Keislar’s text, kept in Guido van Rossum’s Audio File Formats FAQ) marks 9, 15 and 22 (and 17, whose layout came later with the SoundKit source) with a question mark, so NeXT’s documentation never described them. The SoundKit and MusicKit code defines the constants and either never uses them (9), uses 28 only as the encoding of a live sound stream (the AES/EBU digital port) and gives 29 a width of one byte with no decoder. The viewer names them and shows the bytes. Their layouts are unknown.
- Reference and Viewer: the MusicKit codes 30 to 33 (MP3, AAC, AC-3, Vorbis) are named in the MusicKit’s
SndFormats.h, and its SndKit uses 30 only for an in-memory MP3 object loaded from a plain MP3 file; it has no code that reads or writes a sound file with 30 to 33, so what an AU file with one of these codes holds is undefined. The viewer names them. - Reference and Viewer: code 22 (DSP commands with samples): the source gives only its sample count (the first integer) and that it is code 21 with samples streamed to the DSP; the rest of its layout is in no source. Code 21’s subheader is known and shown, but its messages are DSP driver messages for a DSP that no longer exists, so the viewer does not play it. Code 11 (8-bit DSP data) has a width of one byte and no routine that converts or plays it, so its scale is undefined.
- Viewer: the compressed sounds (19 and 20) are decoded as NeXT’s C code decodes them, which is the
path the SoundKit takes when no DSP is present. NeXT’s own player ran a DSP56001 program (
decompress.asm) with 24-bit arithmetic and band gains that default to 1, and no sound written by NeXT software was available, so whether the DSP output differs from the C output in its low bits is not known. A sound of method 0 or 1 made with the SoundKit’s default encode length of 256 is read from the subheader’sencodeLength, as the C decoder reads it.
Also used for
- IFF 8-bit sampled voice – Amiga sampled sound: signed 8-bit samples in an IFF form with a voice header.
Links
Software
- Audacity – free audio editor that opens and saves AU (Windows, macOS, Linux)
- SoX – command-line sound converter that reads and writes AU (Windows, macOS, Linux)
- VLC media player – free player for almost any audio or video file (Windows, macOS, Linux, mobile)
- FFmpeg – command-line tool that converts AU to and from other formats (Windows, macOS, Linux)
Developers
- libsndfile – library that reads and writes AU (C)
Reference
- AU file format notes – McGill University’s notes on the header and encodings
- au(4) – the Solaris manual page that defines the header and the encodings