The MHDR chunk describes the sound: how many frames, how many bits a sample takes, the
sampling rate, the channels and the compression. It is always 32 bytes, all numbers are
big-endian, and it is required: maud.datatype refuses a header of any other size. The
layout is the structure MaudHeader of MacroSystem’s own documentation, maud.doc (marked “preliminary”), and its include files maud.i and maud.h, from MacroSystem’s Toccata developer kit; Richard Koerber’s 1997 description of the format says the same.
The MHDR chunk
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | u32 | Samples | the number of frames in MDAT (a frame is one sample of every channel). It should be right when saving, but Samplitude stores bad values here, so a reader counts from the length of MDAT instead. In the one stereo file by Samplitude among 100 real MAUD files, the field is 10,360 for 5,180 frames: it counts the samples of all channels |
| 4 | 2 | u16 | SampleSizeC | bits a sample and channel takes in MDAT, from 1 to 32. The bits are really packed, not filled up to a byte or a word. maud.doc says the value “may be 0 in the future for special, currently undefined compression types” |
| 6 | 2 | u16 | SampleSizeU | bits a sample has after decompression. The compression code says as much, so a reader may ignore it |
| 8 | 4 | u32 | RateSource | the clock source frequency; divide it by RateDevide to get the rate in Hz |
| 12 | 2 | u16 | RateDevide | the clock divider (MacroSystem spells it “devide”) |
| 14 | 2 | u16 | ChannelInfo | how the channels are arranged: see below. Usually only mono or stereo is used |
| 16 | 2 | u16 | Channels | the number of channels: it must be 1 for MCI_MONO and 2 for MCI_STEREO; more with the multichannel arrangements |
| 18 | 2 | u16 | Compression | how the samples are coded: the compression codes |
| 20 | 4 | u32 | Reserved1 | must be 0 when saving |
| 24 | 4 | u32 | Reserved2 | must be 0 when saving |
| 28 | 4 | u32 | Reserved3 | must be 0 when saving |
The sizes add up: 4 + 2 + 2 + 4 + 2 + 2 + 2 + 2 + 3 × 4 = 32.
The sampling rate
The rate is not stored directly. maud.doc: “To figure out the sample frequency you MUST devide
mhdr_RateSource by mhdr_RateDevide! Hardware devices often calculate their sample frequency by deviding a clock source (crystal oscillator) by a special value.”
Its examples: RateSource 48,000 with RateDevide 1 is 48,000 Hz, and RateSource 24,576,000 with RateDevide 768 is 32,000 Hz.
A divider of 0 gives no rate; the viewer
flags it and has nothing to play at. The viewer limits the playback rate to 3,000 to 768,000 Hz.
Channel arrangement
ChannelInfo | Name in maud.i | Meaning |
|---|---|---|
| 0 | MCI_MONO | mono |
| 1 | MCI_STEREO | stereo |
| 2 | MCI_MULTIMONO | mono multichannel: Channels can be 2, 3, 4, … |
| 3 | MCI_MULTISTEREO | stereo multichannel: Channels must be 4, 6, 8, … |
| 4 | MCI_MULTICHANNEL | multichannel, which needs extra MINF chunks: marked “future” in the include file (Other chunks) |
The viewer reports a header whose Channels does not fit its ChannelInfo (mono with 2
channels, an odd number for multi-stereo). It plays Channels channels, in the order the frames store them.
An example header
A mono sound of eight 8-bit samples at 8,000 Hz, uncompressed:
| Offset | Bytes | Meaning |
|---|---|---|
| 0 | 00 00 00 08 | Samples 8 |
| 4 | 00 08 | SampleSizeC 8 |
| 6 | 00 08 | SampleSizeU 8 |
| 8 | 00 00 1F 40 | RateSource 8,000 |
| 12 | 00 01 | RateDevide 1, so 8,000 Hz |
| 14 | 00 00 | ChannelInfo 0, mono |
| 16 | 00 01 | Channels 1 |
| 18 | 00 00 | Compression 0, none |
| 20 | 12 zero bytes | Reserved1 to Reserved3 |
Source: maud.doc, maud.i and maud.h (MS MacroSystem Computer GmbH, Toccata developer kit; copy on the Creative Computers CD-ROM, commercial/noahji's/toccata/developer): the structure, the MCI_ values, the rate examples and the notes on each field;
Richard Koerber, message to Laurent Clevy of 8 August 1997 with the same maud.i (MAUDINFO.TXT).
The offsets of SampleSizeU, ChannelInfo, Channels and Compression (6, 14, 16, 18)
agree with the code of MacroSystem’s toccata.library 12.0, which reads them at those offsets.