Article History
 
 
 
Discussion
 
5985 views
 
50% kleeder
MDX (MXDRV MML for Sharp X68000)
 

::|CONTENTS

  1. Features
  2. Setting it up
  3. MDX Players
  4. MXDRV Specific Syntax
  5. Compiling a Tune
  6. Making PDX files
  7. Special Thanks
  8. See also
MXDRV is a music driver which uses MML (Music Macro Language) to create music for the Sharp X68000 Japanese computer. The compiler exports MDX files which you can play in a MDX player or in Foobar2000 with the MDX Decoder plugin. A notable example of it's use is from the 1996 arcade game, Battle Garegga by Raizing.

Features




MXDRV has full FM support from the YM2151 and full ADPCM support from the X68k's sampling chip, the OKIM6258 using PDX files. The tool has the ability to change the frequence of samples, define your own FM instruments, Set amplitude LFO, set hard stereo panning, and more. In order to use the ADPCM channels though, you'll need to either rip samples from existing games which make use of ADPCM, or make your own which will be explained later in this article.

Setting it up



You will need:
Run68K
: A Sharp 68K command line emulator which is necessary to run 68K programs from the command line/cmd.
MDX_TOOL
: The MXDRV tools needed to make MDX files.
MKPDX
: Get the Win32 executable. Required tool to make PDX files if you want ADPCM. It's not a X68K executable so you wont need Run68k. See the section on creating PDX files for more information on creating a PDX file.
WAV2ADP
: A program used to convert .wav files to ADPCM for making PDX files.
OPM2MML
: A program coded in java used to convert OPM files to MXDRV mml if you don't feel like programming your own patches. To use it type this into the command line:

opm2mml [filename.opm]

MDX Players



MXV
: A standalone player for MDX files.
X68Sound.dll
: YM2151 and OKIM6258 emulation library needed for mxv. Just put it in the same directory mxv is.
mxdrv.dll
: MDX driver for windows, once again needed for mxv. Just put it in the same directory mxv is.
MDX Decoder
: A .dll component for Foobar2000 that makes it so Foobar can play MDX files.

MXDRV Specific Syntax



#PCMFILE "filename.pdx"
Specify a PDX file for ADPCM use. See the "Making PDX files" section for more info on how to create a PDX file and use it.

------------------------------------------

@#={
AR, DR, SR, RR, SL, OL, KS, ML, DT1, DT2, AME,
AR, DR, SR, RR, SL, OL, KS, ML, DT1, DT2, AME,
AR, DR, SR, RR, SL, OL, KS, ML, DT1, DT2, AME,
AR, DR, SR, RR, SL, OL, KS, ML, DT1, DT2, AME,
CON, FL, OP
}

FM Instrument Definition.
NOTE: I'm not an FM wizard, so what I think these mean may not be true, so it's better to use opm2mml for this part.

AR = Attack Rate
DR = Decay Rate
SR = Sustain Rate
RR = Release Rate
SL = Sustain Level
OL = Operator Level. Same as TL in other dialects.
KS = Key Scaling
ML = Multiplyer
DT1 = Detune 1
DT2 = Detune 2
AME = Amplitude Modulation Enable
CON = Connection. FM synthesis algorithm. Determines how the operators are connected. Play with VOPM to figure this one out.
FL = Feedback Level
OP = Operator Mask. 15 (binary %1111) turns on all 4 operators.

Example:
@1={
/* AR DR SR RR SL OL KS ML DT1 DT2 AME */
24, 3, 0, 15, 3, 22, 0, 1, 3, 0, 0,
24, 0, 0, 15, 0, 0, 0, 5, 3, 0, 0,
24, 3, 0, 15, 3, 22, 0, 2, 7, 0, 0,
24, 0, 0, 15, 0, 0, 0, 2, 7, 0, 0,
/* CON FL OP */
4, 5, 15
}

Again, it's probably easier for you to rip voices from existing games or use opm2mml to do this part.
------------------------------------------
L
Set loop start
Use this in a channel if you want to loop everything after this.
------------------------------------------
A-H, P-W
Set channel.
You MUST set one of these letters at the beginning on a new line if you intend to sequnce notes and macros on this line. A-H is for FM, P-W is for ADPCM.
------------------------------------------
F#
Change PCM frequency (pitch).
Range is 0-4. Default is 4.
0 = 3.9kHz
1 = 5.2kHz
2 = 7.8kHz
3 = 10.4kHz
4 = 15.6kHz
------------------------------------------
MAwaveform,speed,amplitude
Set amplitude LFO.
Waveform is the LFO waveform (0 = sawtooth, 1 = square, 2 = triangle).
Speed is 1/4th of the LFO cycle in ticks, and amplitude is the MAX amplitude of the LFO.

MAON
Turn on amplitude LFO for the current channel. Only needed if you have it turned off for a channel. (Setting LFO automatically turns it on.)

MAOF
Turn on amplitude LFO for the current channel. Only needed if it's already on.

MD#
Set the delay from note on to LFO start (not including OPM LFO.)
# is the delay in ticks.

MH#1,#2,#3,#4,#5,#6,#7
Set OPM LFO values
#1 = LFO Waveform (0 = sawtooth, 1 = square, 2 = triangle)
#2 = LFRQ
#3 = PMD
#4 = AMD
#5 = PMS
#6 = AMS
#7 = Key sync (0 = no sync, 1 = sync)

MHON
Turn OPM LFO on for current channel (setting OPM LFO automatically turns it on)

MHOF
Turn OPM LFO off for current channel.

------------------------------------------
p#
Set hard panning position.
0 = no output, 1 = left, 2 = right, 3 = center.
------------------------------------------
@q#
Note cutoff (stacatto) in ticks.
Set the cutoff of a note, with duration in ticks.
------------------------------------------
S#

Sync send macro
Continue playback on channel if it is in sync wait mode
------------------------------------------
y[reg],[val]

Write OPM register reg with value val
------------------------------------------
w#

Set OPM Noise frequency
------------------------------------------
W

Sync wait macro
Set current channel in sync wait mode, pausing playback of the channel
------------------------------------------

Compiling a Tune



So now that you now everything, Let's make a super basic song!

#title "Cool Song"
#pcmfile "coolpcm.pdx"

;instrument definition
@1={
/* AR DR SR RR SL OL KS ML DT1 DT2 AME */
24, 3, 0, 15, 3, 22, 0, 1, 3, 0, 0,
24, 0, 0, 15, 0, 0, 0, 5, 3, 0, 0,
24, 3, 0, 15, 3, 22, 0, 2, 7, 0, 0,
24, 0, 0, 15, 0, 0, 0, 2, 7, 0, 0,
/* CON FL OP */
4, 5, 15
}

A t150
A v10 o4 l8 @1 L cdefgab>c4

After you've done that, save your .mml file or .txt file, And go into your command line.
In order to compile your song, type this into the command line:

run68 mxc [filename.txt] (the file extension can be .mml as well.)

If you did everything right, you should have your first song!

Making PDX files



PDX files are necessary for using ADPCM in your MXDRV tracks. Here's how to make one from scratch.

Use WAV2ADP to convert .wav files into raw ADPCM (.pcm) files.
To use it, type this into the command line:

run68 wav2adp [filename.wav]

If you did it right, it should spit out a. PCM file. After you've got all of your samples, you'll need to put it into one PDX file. But before we do that, we'll need a .PDL file to specify all of the samples and which note you want to give to a sample.
A PDL file is just a renamed text file.
Make your file like this:

#ex-pdx 1

@0
1=filename1.pcm
2=filename2.pcm
3=filename3.pcm

I'll explain what's happening here.
We're using ex-pdx. After the PDX format was created, it was improved to switch banks for tons of samples in one PDX. A single bank can have around 90 files.
Then, we defined which bank we wanted with the "@0" the 0 can be whatever number you want. Then, we set notes 1, 2 and 3 to filename1.pcm, filename2.pcm and filename3.pcm respectively.
After all that's finished, you're ready to make your PDX. You can type the following into the command line, or drag your .PDL onto MKPDX:

mkpdx filename.pdl

If you typed it right, it should make a .PDX file. Congrats! Now you can use ADPCM in your songs. In order to use it, define this at the top of your mml file:

#pcmfile "filename.pdx"

Then, use channels P-W to actually use the samples like this:

P l8 n1 n3 n2,16 ;plays pcm notes 1, 3 and 2. 1 and 3 play as eighth notes while note 2 plays as a sixteenth note.

Special Thanks



Thanks to this article on MXDRV.
It was super helpful. Without this article, This page would not exist.

Enjoy making X68K music!

See also



x68k (format)

 
C A T E G O R I E S
 
 
Effects Commands
 
 
File Formats
 
 
Sound Chips