The Sample Dump Standard (SDS) adopted by the MIDI "powers that be" (the MIDI Manufacturers Association and the Japanese MIDI Standards Committee) defines the standard method for transferring sound-sample data between MIDI-equipped devices (IMA 1988). Although it is primarily an interchange format, it can also be used as a sound file format of sorts, and supports high-resolution samples, so it warrants our attention here. Moredetailed descriptions are available in several MIDIrelated references, and in the Internet file ftp.cs.ruu.nl:/pub/MIDI/DOC/mididump, from which the discussion below is derived.
The MIDI SDS defines a simple packet-oriented sample interchange protocol with which two devices can reliably share sample data. This protocol is described in terms of the command packets that one device (the "master") sends to another (the "slave') to initiate a transfer, how the slave device responds, and how the two devices manage the interaction.
Size | Field |
1 | Sysex header = f0 |
1 | System type ID: universal non-real time = 7e |
1 | Channel number |
1 | Sub-ID: header = 01 |
2 | Sample number |
1 | Sample resolution |
3 | Sample period |
3 | Sample length |
3 | Sustain loop start point |
3 | Sustain loop end point |
1 | Loop type |
1 | End-of-sysex (Eox) = f7 |
The structure of the header that describes a MIDI sample dump is shown in Table 7. This structure is enclosed in a MIDI system exclusive (sysex) message by the first and last bytes, with the special values of hexadecimal f0 and f7. The rest of the data in the header gives the sample rate (actually its reciprocal, the sample period, in nsec), the sample format (resolution in bits of the linear integer samples), and the starting and ending samples of the one-loop region. As this format is mainly concerned with samples, each sound also has a MIDI channel number and a sample number; there may be several samples per channel.
The linear format of this packet resembles the following (whereby all multibyte data are sent with the least-significant byte [LSB] first)
F0 7E cc 01 ss ss ee ff ff ff gg gg gg
hh hh hh ii ii ii j j F7
where
cc
= MIDI channel number of the sample
ss ss
= sample number (LSB first)
ee
= sample resolution (number of significant bits; 8-28)
ff ff
= sample period (l/sample rate) in nsec
gg gg gg
= sample length, in bytes
hh hh hh
= sustain loop start point (bYte number)
ii ii ii
= sustain loop end point (byte number)
j j
= loop type (00 = forward only; 01 = alternating)
The structure of a MIDI SDS data packet is given in Table 8, where one sees the same MIDI sysex format, and 120 bytes of sample data.
Size | Field |
1 | Sysex header |
1 | ID: universal non-real time |
1 | Channel number |
1 | Sub ID: data packet |
1 | Packet number |
120 | Sample data (120) bytes |
1 | Checksum |
1 | End-of-sysex (Eox) |
An example of the linear form of this packet is
F0 7E cc 02 kk <120 bytes> mm F7
where
cc
= channel number
kk
= running packet count (O-127)
mm
= checksum (exclusive-or of 7E, cc, 02, kk, and the sample data)
The total size of a data packet is 127 bytes. This is to avoid overflow of the MIDI input buffer of a device that may want to receive an entire packet before processing it. The packet number begins at 00 and incrementally increases with each new packet. It resets to 00 after it reaches 7F, and continues counting. The packet number is used by the receiver to distinguish between a new data packet, or resending of a previous packet. The packet number is followed by 120 bytes of data, which from 60, 40, or 30 data samples (most-significant byte first for multibyte samples), depending on the length of a single data sample. Each data byte holds 7 bits, with the most-significant bit in each byte set to 0 to conform to the requirements of MIDI data transmission. Information is left justified within the 7-bit bytes, and unused bits are filled with 0. As an example, assume a 16-bit sample with the value 87E5 hexadecimal. In binary representation, that would be:
1000 0111 1110 0101
and it would be encoded as the following MIDI data stream:
01000011 01111001 00100000
The checksum of the packet is the running exclusive-or (XOR) of all the data after the sysex byte, up to, but not including, the checksum itself.
For a file-based version of the MIDI SDS, an application may simply store the uninterpreted packets, or may "unpack" them, compacting the sample data and discarding the packet "wrappers" to store the data in some other format. The sample dump standard does not address file storage of sound, and the MIDI file format does not address sample dumps.
[ Index | Main Paragraph | Previous Paragraph | Next Paragraph ]