Midi player for ALSA - pmidi
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.
You can always get the latest and previous versions from the sourceforge download page. You can also find pre-built RPM's there.
- Version 1.7.1
- pmidi-1.7.1.tar.gz (9 Aug 2016)
- First check that the correct sequencer modules are loaded
for your sound card.
For a card with an external Midi connection, you need to
snd-seq-midiand for the AWE32/64 internal synthesizer you need to load
- 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:
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
The first one is the external Midi port, and the other four
are the internal wavetable synthesizer.
You can specify the port or ports to use with the
-p option, or by setting the environment variable
For example to use port 0 on client 65:
pmidi -p 65:0 song.mid
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 firstname.lastname@example.org 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.
Thanks to Frank van de Pol, Takashi Iwai, Paul Leonard, Clemens Ladisch, R. L. Horn for reporting problems and fixes. The OPL3 FM synth note was provided by Dmitrii Sadovskii.
Hosted at Sourceforge.