NAME
dmid – MIDI to OPL3 converter using GENMIDI–type instrument banks

SYNOPSIS
dmid [ –2s ] [ –i bank ] [ file ]

DESCRIPTION
Dmid decodes MIDI instructions either from file or from standard input, and produces OPL3 instructions suitable for playback by opl3(1). To program instruments, an OPL2 instrument bank in the same format as GENMIDI lumps from doom must be provided. Since it is assumed that the bank is contained in a doom WAD file, its default location is /mnt/wad/genmidi. This may be overridden with the –i command line option.

The –s flag enables streaming mode, in which the input is a pipe(3) streaming MIDI events. It needn't provide any timing information such as MIDI timing clocks. This is suitable for MIDI devices transmitting in real time.

In GENMIDI lumps, two voices are defined per instrument. For compatibility, the –2 flag disables the second voice, reducing the number of OPL channels needed. It also disables OPL3 specific features and produces an IMF–format stream, which can be used in other game engines.

EXAMPLES
Play a MUS file from a doom WAD file:
% games/wadfs /sys/games/lib/doom/doom1.wad >[2]/dev/null
% games/mus /mnt/wad/d_e1m8 | games/dmid | games/opl3 >/dev/audio

Play a MIDI stream from a USB device (see usb(3)):
% games/wadfs /sys/games/lib/doom/doom1.wad >[2]/dev/null
% games/dmid –s /dev/usb/ep10.1/data | games/opl3 –s >/dev/audio

SOURCE
/sys/src/games/midi/dmid.c

SEE ALSO
games(1), mus(1), opl3(1), audio(3), pipe(3), usb(3), wadfs(4)

HISTORY
Dmid first appeared in 9front (July, 2018).