This is pmidi - a command line midi player for ALSA
Written by Steve Ratcliffe <firstname.lastname@example.org>
See the file COPYING for licence details.
Build and install
See the INSTALL file for full details. Normally you just need to use the
To compile from CVS use the following commands first to create the
1. First check that the correct sequencer modules are
loaded for your sound card:
- For a card with an external Midi connection,
you need to load snd-seq-midi.
- For the OPL2/3 internal synthesizer
you need to load snd-synth-opl3.
- For the AWE32/64 internal synthesizer
you need to load snd-synth-emu8000.
- For the SB Live! internal synthesizer
you need to load snd-synth-emu10k1.
- (Let me know of any more)
2.a If you have an AWE32/64 or SB Live! you will need to load the
sounds with sfxload in the same way as for the standard kernel
2.b If you have the OPL3 FM synthesizer you will have to load the
FM instruments with sbiload. See note below.
3. Make sure that the synth in the mixer is turned
up and unmuted if appropriate.
pmidi [-p client:port ...] [-l] [-d delay] file ...
-p client:port - A alsa client and port number to send midi to
-l - List possible output ports that could be used
-d delay - Delay after song ends (default 2 sec)
Because you may have more than one sound card and each sound
card may have several MIDI connections, you have to tell pmidi
which one to use.
First find out what the possibilities are for your system:
If you run:
it will give you a list of the possible devices that it
can play to. On my system I get:
Port Client name Port name
64:0 0: MIDI Synth MIDI 0-0
65:0 AWE Wave Table Synth : 0 Emu8000 port 0
65:1 AWE Wave Table Synth : 0 Emu8000 port 1
65:2 AWE Wave Table Synth : 0 Emu8000 port 2
65:3 AWE Wave Table Synth : 0 Emu8000 port 3
Any of the port numbers in the first column can be used with pmidi. In
the example above the first one is the external Midi port, and the other
four are the internal wavetable synthesizer.
If you don't see anything listed then check that the correct ALSA modules
are loaded as in the section "Before use".
You specify the port or ports to use with the -p option,
or by setting the environment variable ALSA_OUTPUT_PORTS.
For example to use port 0 on client 65:
pmidi -p 65:0 song.mid
A list of client ports can be supplied, which will be used
if the midi file contains port select sequences.
pmidi -p 65:0,65:1,65:2,65:3 song.mid
You can also use spaces to separate with suitable quoting
on the command line.
OPL3 FM synthesizer
(This note was provided by Dmitrii Sadovskii)
This is what has to be done to use the OPL3 FM synthesizer with pmidi
(provided that the ALSA's respective card module is already loaded)
# modprobe -k snd-synth-opl3
> sbiload -l (same as pmidi -l)
Port Client name Port name
64:0 External MIDI 0 MIDI 0-0
65:0 OPL3 FM synth OPL3 Port
> sbiload -p65:0 --opl3 std.o3 drums.o3
> pmidi -p65:0 sample.midi
Written by Uros Bizjak <email@example.com>
sbiload works with ALSA driver 0.9.0beta2 and later.
Use it with native ALSA sequencers, such as pmidi-1.5.1
the sound card (or the driver?) does not keep the instrument
patches after suspend so sbiload should be called at resume
(as well as alsactl restore)
It should be said that ALSA+pmidi plays with better quality than OSS/Free
but that in general FM synthesizers are not great for good midi.
Where to report bugs and feedback
Please report any problems to firstname.lastname@example.org