The AU file format is a simple audio file format, being developed by Sun Microsystems. The format was common on on early Web pages.
Originally it was headerless, being simply 8-bit µ-law-encoded data at an 8000 Hz sample rate. Newer files have a header, an optional information chunk and then the data (in big endian format).
AU Audio files must have a signature (tag) .snd (hex: 2E 73 6E 64) at the beginning of the audio file.
AU file have a header that consists of six unsigned 32-bit words, which define: signature, data offset, data size, encoding, sample rate and number of channels.
Sum of data offset and data size gives audio file full length. All data values are stored in big-endian (most significant byte first) format.
Let's examine the sample
When inspecting sample.au file's text data using any Hex Viewer, like Active@ Disk Editor, which is included in Active@ File Recovery package, we can see it starts with a tag .snd (hex: 2E, 73, 6E, 64). Next to it, at offset 4, there is a data offset, which is 24 (hex: 00, 00, 00, 18), big-endian (highest byte first). Next 4 bytes at offset 8 define the size of the data in AU file: 1,652 (hex: 00 00 06 74). Total audio file size is 1,676 = 24 + 1,652 (sum of data offset and data size). Thus reading of all 1,652 consecutive bytes starting from the position of detected .snd header provide us with all AU file data.
offset | size | description |
---|---|---|
0 | 4 | signature, must be 2E 73 6E 64 (four ASCII characters ".snd") |
4 | 4 | data offset in bytes, big-endian |
8 | 4 | data size in bytes, big-endian |
12 | 4 | encoding: 1 = 8-bit G.711 µ-law; 2 = 8-bit linear PCM; 3 = 16-bit linear PCM, ... |
16 | 4 | sample rate, the number of samples/second, big-endian |
20 | 4 | channels, the number of interleaved channels, e.g., 1 for mono, 2 for stereo, ... |
This example just specifies AU start signature and calculates file size based on size of data chunk.
Syntax of the signature definition language you can read here.
[SND_HEADER] DESCRIPTION=AU Audio File EXTENSION=au BEGIN=SND_BEGIN SCRIPT=SND_SCRIPT [SND_BEGIN] .snd=0|0 [SND_SCRIPT] value = read(dword, 12) if (value == 0) goto exit value = read(dword, 16) if (value == 0) goto exit value = read(dword, 20) if (value == 0) goto exit offset = read(dword, 4) offset = endian(dword, offset) if (offset < 24) goto exit value = and(offset, 3) if (value != 0) goto exit size = read(dword, 8) size = endian(dword, size) if (size == 0) goto exit size = sum(size, offset)
This document is available in PDF format,
which requires Adobe® Acrobat® Reader
(Free download):