Introduction
The pmidi program is a straightforward command line program to play midi files through the ALSA sequencer.
As you can specify the client and port to connect to on the command line it is also useful for testing ALSA or clients that need to receive sequencer events.
This program does not have a graphical display, if you require one then you can use pmidi in conjunction with Takashi Iwai's aseqview program to display the song being played.
Download
There is no major difference in functionality between the versions of pmidi below. Which version you require simply depends on which version of ALSA you are using. You can always get the latest and previous versions from the sourceforge download page. You can also find pre-built RPM's there.
- For latest ALSA-1.0 and later 0.9 versions
-
pmidi-1.6.0.tar.gz
(20 Dec 2003) - For latest ALSA-0.9-rc6
-
pmidi-1.5.5.tar.gz
(1 Dec 2002) - For earlier ALSA-0.9 CVS versions
-
pmidi-1.5.4.tar.gz
(15 Aug 2001) - Version for ALSA-0.5.x
-
pmidi-1.4.2.tar.gz
(15 Aug 2001)
Usage
Before use
-
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-midiand for the AWE32/64 internal synthesizer you need to loadsnd-synth-emu8000. - If you have an AWE32/64 you will need to load the sounds with sfxload as with the standard kernel drivers.
- Make sure that the synth in the mixer is turned up and unmuted if appropriate.
Find out the correct port number
If you run:
pmidi -l
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.
The first one is the external Midi port, and the other four
are the internal wavetable synthesizer.
Running pmidi
You can specify the port or ports to use with the
-p
option, or by setting the environment variable
ALSA_OUT_PORT.
For example to use port 0 on client 65:
pmidi -p 65:0 song.mid
or
export ALSA_OUT_PORT=65:0 pmidi 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 is what has to be done to use the OPL3 FM synthesizer with pmidi (provided that the ALSA module snd-card-opl3sa2 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
The sbiload program is now included in alsa-tools, or you can also download it from the sbiload author's web site. The sbiload program is written by Uros Bizjak <uros@kss-loka.si> Web: http://www.kss-loka.si/~uros/sbiload.html
For laptops the sound card (or the driver?) does not keep the instruments patch 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.
Acknowledgements
Thanks to Frank van de Pol, Takashi Iwai, Paul Leonard, Clemens Ladisch, R. L. Horn for reporting problems and patches. The OPL3 FM synth note was provided by Dmitrii Sadovskii.
Hosted at Sourceforge.