## MMPM/2 Device Driver Reference

[prev][next][parent][TOC]

### Device Driver Control Messages

The following are types of device driver control messages:

Balance
Generic sound selection
Master volume
Tempo
Timing generation
Volume

Balance Control

This message sets the balance level for the audio device driver:

      F0  00 00 3A  03  08  bl  dl  dm  F7

      bb = Balance level (0 = full left, 40 = middle, 7F = full right)

      dl = Duration LSB

      dm = Duration MSB

Balance is specified as a relative value from 0 - 7F, where 0 is full left, 40 is middle, 7F is full right. The duration specifies the length of time (in tenths of a second) necessary to gradually go from the current level to the target level. For example, to set the balance to full right (7F) with duration set to 10 to gradually move the new balance to the right over a one-second period, the balance control message would be:

      F0  00 00 3A  03 08 7F 0A 00 F7

Generic Sound Selection

This message selects the generic sound for an instrument:

      F0  00 00 3A  03  03  ii  tt  ss  F7

      ii = Instrument number

      tt = Sound type (0 = Musical instrument, 1 = sound effects)

      ss = Sound ID

There are 128 generic musical instrument sounds and 128 sound effects types . When a requested sound is not available on a device, the nearest available sound is used. It is recommended that general MIDI mode be used instead of this message.

Master Volume Control

This message sets the master volume level for the audio device driver:

      F0  00 00 3A  03  09  vl  vm  00  F7

      vl = Master Volume LSB

      vm = Master Volume MSB

Master volume is intended to permit immediate control of overall volume without interfering with the current volume setting as set by the volume control message, described in Volume Control below. Volume is specified as a relative value from 0 - 3FFF. For example, to set the volume to maximum ( 3FFF) the master volume control message would be:

      F0  00 00 03 03 09 7F 7F 00 F7

This message causes a MIDI volume control change message to be generated. Any subsequent volume control change messages encountered are scaled proportionately. Actual volume is the product of volume and master volume.

Tempo Control

This message sets the tempo for system real-time timing clock generation:

      F0  00 00 3A 03  02  tl  tm  dd  F7

      tl = Tempo LSB

      tm = Tempo MSB

      dd = Duration

Notice that tempo is expressed as 1/10 beats per minute. The duration specifies the length of time (in tenths of a second) necessary to go gradually from the current tempo to the specified tempo. For example, to set the tempo to 120 beats per minute, with duration set to 0 to make the new tempo effective immediately, the tempo control message would be:

      120 bpm = 1200 1/10 increments

                1200 decimal = 00000100 10110000 binary

                7 bit MSB (tm) = 000100 1        = hex 9

                7 bit LSB (tl) =         0110000 = hex 30

       F0 00 00 3A 03 02 30 09 00 F7

Timing Generation Control

This message tells the device driver what timing information to generate:

      F0  00 00 3A  03  01  tt  pp  00  F7

      tt = System real-time control flags (default 08H)

           0x1x xxxx  Output timing clocks to MIDI-Out

           0x0x xxxx  Do not output timing clocks to MIDI-Out (default)

           0xx1 xxxx  Merge timing clocks with MIDI-In

           0xx0 xxxx  Do not pass timing clocks to MIDI-In (default)

           0xxx 1xxx  Synchronize output to timing clocks (default)

           0xxx 0xxx  Disable output synchronization

           0xxx x1xx  Perform timing data compression

           0xxx x0xx  Disable timing data compression (default)

           0xxx xxRR  Reserved bits - always 0

      pp = System real-time 24 CPQN rate prescaler

           00dd dddd  Multiply by dddddd+1 (1-64) for 24 to 1536 ppq

           01dd dddd  Divide by dddddd+1*3   ( 3 - 192 )   for   8   to   1 / 8   ppq

By default, device drivers utilize real-time messages at a rate of 24 per quarter note (beat) and 120 beats per minute internally for performing output synchronization. However, they do not queue timing clocks to either MIDI-Out or MIDI-In (Read data).

Volume Control

This message sets the volume level for the audio device driver. Volume is specified as a relative value from 0-7F.

      F0  00 00 3A  03  07  vv  dl  dm  F7

      vv = Volume (0-7F)

      dl = Duration LSB

      dm = Duration MSB

The duration specifies the length of time (in tenths of a second) necessary to gradually go from the current level to the target level. For example, to set the volume to maximum (7F) with duration set to 0 to make the new volume effective immediately, the volume control message would be:

      F0  00 00 3A 03 07 7F 00 00 F7

This message causes subsequent MIDI volume control change messages to be generated. Any subsequent volume control change message encountered will be scaled proportionately. Notice that the actual volume is the product of volume and master volume.