PDX File Format
A .PDX file is a binary archive file containing OKI ADPCM encoded samples, primarily used by the Sharp X68000 drivers MXDRV and MXDRV2. The samples can be played through the OKI MSM6258 ADPCM soundchip, through (AD)PCM software mixing drivers (e.g. PCM8) or through external PCM boards (e.g. Mercury-Unit, Polyphon).
The file starts with a header with 96 8-byte pairs, with each pair containing offset and length of ADPCM data chunks for each note value, like so:
[byte pointer to sample in file -- 32-bit unsigned integer (4 bytes)]
[empty: $0000 -- 16-bit integer]
[length of sample, amount in bytes -- 16-bit unsigned integer]
The first sample (1) is mapped to
0x80 (= the lowest note within MXDRV) and the last sample (96) is mapped to
0xDF (= the highest note within MXDRV).
Samples are encoded in 4-bit OKI ADPCM encoded nibbles, where each byte contains 2 nibbles:
[nibble 2 << 4 || nibble 1]
Unfortunately, sample rates for each samples are not defined within the .PDX file and have to be set manually with the appropriate command for that at play-time:
n is the frequency playback setting of the OKI MSM6258 (or extended values present in drivers such as PCM8A, Rydeen, PCM8PP, etc.).
File format (EX-PDX)
If the .MDX file uses EX-PCM mode, there can (and thus are optional) be some changes to the format:
- Multiple PDX banks, where each bank has a header with 96 8-byte pairs. The header information of each bank is placed in the beginning of the file, one after each other. The sample data gets placed after all headers are defined. Switching between banks within a .MDX song is done through the
nis the number of the bank (first bank is
0x00). This command is only effective on the sample channels (P~W). This is because this command is normally used on the FM channels for switching between defined FM tones / patches.
- The length of a sample can also be expressed in 32-bit unsigned integer.
- Sample data in the .PDX file can be read as 8-bit signed linear PCM or as 16-bit signed linear PCM, besides the usual OKI ADPCM encoded sample data. Selecting how to read the sample data is usually done at play-time with the frequency playback setting command:
nsets the sample format mode (present in drivers such as PCM8, PCM8A, Rydeen, PCM8PP, etc.).
- @Wiki MDX description (Japanese)