NeXT/Sun soundfile format
OFFSET :
SIZE field name description
0 : 4 magic Identifies the file as a NeXT/Sun soundfile.
must be equal to SND_MAGIC (0x2e736e64)
which is equivalent to the ASCII characters ".snd".
It is used for type checking and byte ordering
information. Big endian files have a magic number
of ".snd", while little endian files would have "dns."
Probably not a good idea to create little endian
files.
4 : 4 dataLocation Offset from start of file to the raw sound data
Note that the offset is from 1 rather than 0, so that
the minimum dataLocation offset is 29, not 28.
8 : 4 dataSize Number of bytes of data in the raw sound data.
12 : 4 dataFormat NeXT data format codes. User-defined formats
should be greater than 255. Negative format numbers
are reserved. Defined codes are listed in
<sound/soundstruct.h> on NeXT computers. Common
formats include:
SND_FORMAT_MULAW_8 (1)
SND_FORMAT_LINEAR_16 (3)
SND_FORMAT_FLOAT (6)
SND_FORMAT_DOUBLE (7)
16 : 4 samplingRate The sampling rate. Hardware supported sampling rates
are (stored as integers in field):
SND_RATE_CODEC (8012.8210513)
SND_RATE_LOW (22050.0)
SND_RATE_HIGH (44100.0)
SND_RATE_LOW_PC (11025.0)
20 : 4 channelCount The number of channels in the soundfile. Each
channel's data is interlaced with data from other
channels. For example, a stereo file which has two
channels will store data as: sample1 left, sample1
right, sample2 left, sample2 right, etc.
24 : 4+X info[4] Comments relating to the sound, or user
defined data fields. Must be at least 4 bytes long,
but can be as long as desired, since the data starts
at the offset in bytes from the beginning of the
soundfile according to the number in the dataLocation
field. Warning: for some sound playing programs,
the info field must be even.
28+X: * data the actual sound data bytes. Size is specified
in the dataSize field.
Notes:
- All fields except info and data are interpreted as
unsigned long ints.
- NeXT soundfiles usually end in ".snd", while Sun soundfiles
are usually called audiofiles and end in ".au". The data formats of
each type of file are identical, and you can rename the files. Some NeXT
programs, for example, use the name of the file to check for the sound
format instead of the magic number (!) and don't recognize ".au"
files as legitimate soundfiles. You can fix this by problem by changing the
file extension from ".au" to ".snd".
NeXT Header files for sound
These files are found in the directory /usr/include/sound on NeXTStep
computers.