From the ALSA wiki
- 1 Using MIDI keyboards connected to your PC
- 2 Using a wavetable synth on your soundcard
- 3 Using an FM synth on your soundcard
- 4 Using a software synthesizer and a PCM device on your soundcard
Using MIDI keyboards connected to your PC
If you have a musical instrument like one of the MIDI keyboards (a.k.a. '"synthesizer"), you can connect it to your soundcard's MIDI interface and play a MIDI file directly on the MIDI port where the MIDI keyboard is attached. The MIDI keyboard should make the sound.
For example, run
pmidi -l to get a list of available ports, remember
the external port code, and play the MIDI file on the external port
pmidi -p 65:0 music.mid (for an external port of
pmidi is quite limited compared to Takeshi Iwai's
drvmidi, which can
move forwards and backwards in a MIDI file while it is being played as
well as dynamically load soundfonts, and also
playmidi/xplaymidi, which can adjust the playback speed of
a MIDI file while it is playing. Both of these programs are for OSS
which means they require ALSA's
snd-mixer-oss to be loaded.
Using a wavetable synth on your soundcard
Some soundcards have a wavetable synth which can store a soundfont which is a set of pre-recorded sound samples of various musical instruments. When a MIDI file is played using a wavetable synth, the sounds you hear are the sound samples. The sound quality can be excellent if you choose a well-made soundfont. Firstly, you need to load a soundfont using asfxload or sfxload. Secondly, you should play the MIDI file using a MIDI player program like pmidi, drvmidi, etc. The main advantage of a wavetable synth is that it is implemented in hardware and therefore has very low latency - typically below 150usecs - which is much less than that of any software synth.
Currently, the only supported soundcards with wavetable synths are Creative Technology's emu10k1-based soundcards e.g. Audigy and Audigy2.
Using an FM synth on your soundcard
Some soundcards (notably Creative Technology's emu10k1-based soundcards) have an FM synth. You can use the FM synth to play MIDI files although the sound quality is not high. Look at the output of the command
aconnect -i -o</tt>
to see which MIDI ports you have available. Then try sending a MIDI file
to each of them using a MIDI player program like pmidi
Make sure the "Synth" volume control in your mixer such as
is neither muted nor set to a very quiet volume level.
pmidi -l reported an OPL3 FM synth on my machine. In order to use it I had to
sbiload -p 65:0 --opl3 std.o3 drums.o3
I found this on http://www.parabola.demon.co.uk/alsa/pmidi.html search for OPL3 FM synthesizer
Using a software synthesizer and a PCM device on your soundcard
If you do not have any MIDI
keyboards or instruments available,
you can still use a software synthesizer ("softsynth") like
FluidSynth. A softsynth plays a MIDI file by
converting it (by software) into digital audio samples which are played
on a PCM device of your soundcard. You can
also run both of these programs as virtual synths which will then appear
in the output of "
aconnect -i -o" and can be used later by MIDI
sequencer software. Make sure the "Synth" volume control in your mixer
alsamixer is neither muted nor set to a very quiet volume
Retrieved from "http://alsa.opensrc.org/PlayingMIDIFiles"