infofiles

Midi

This is an information page about playing midi files. For assistance in interpreting the info on this page visit #alsa at freenode.net http://www.freenode.net - Alsa's unoffical IRC channel!

Suggestions, additions or comments are always welcome about any file or info page here, so please contact me on IRC at #alsa channel.


TOP
Section links on this page.
Quick Start
Detailed Info
references

Info about playing midi files:
Special thanks to thingol79 for providing this info.
use the quick start or Detailed info as needed.
********** Quick Start **********
as sudo or root run: modprobe snd_virmidi
if no errors from the modprobe command then
as user run this command: aplaymidi -l
choose 1 input and 1 output port for use then
as user run this command:
aconnect "chosen-input-port-number":0 "chosen-output-port-number":0
if no errors then
as user run: fluidsnyth FluidR3GM.SF2
if no errors then
run this command: aconnect -o
then look for the port that fluidsynth is using
if aconnect -o lists fluidsynth's port then
in another terminal in the directory where you have your .mid files
as user run this command: aplaymidi -p 128:0 "some .mid file"
if no errors then enjoy the sounds.
if there are errors or no sound read the Detailed info section
********** Detailed Info **********
First step: test to see if you have a midi capable soundcard.
To see if seq modules are already loaded
Run: lsmod |grep seq
if no output from the previous command then
Run: modprobe snd-seq
if snd-seq module loads ok; then
Run: modprobe snd_virmidi
if no errors from the previous command then
Run: cat /proc/asound/oss/sndstat
example output:
Synth devices: NOT ENABLED IN CONFIG Midi devices:1: Virtual Raw MIDI
next: run this command: amidi -l
example amidi -l output:
Dir Device Name IO hw:1,0 Virtual Raw MIDI (16 subdevices) IO hw:1,1
Virtual Raw MIDI (16 subdevices) IO hw:1,2
Virtual Raw MIDI (16 subdevices) IO hw:1,3 Virtual Raw MIDI (16 subdevices)
If the above commands showed promising results
run this command:
aplaymidi -l
example output:
Port Client name Port name
20:0 Virtual Raw MIDI 1-0 VirMIDI 1-0
21:0 Virtual Raw MIDI 1-1 VirMIDI 1-1
22:0 Virtual Raw MIDI 1-2 VirMIDI 1-2
23:0 Virtual Raw MIDI 1-3 VirMIDI 1-3
Next choose the input and output ports you want aconnect to use;
from the above example outputs i choose input port 22 and
output port 23 and used this command: aconnect 22:0 23:0
run: aconnect input-port-number:number output-port-number:number
if no errors from that aconnect command then
Next you can connect some software synth (eg fluidsynth)
to one of those virutal ports.
Your soundcard may need to load soundfonts for midi to work:
emu10k1 can read soundfont samples from
the main memory on-the-fly using bus master DMA
emu10k1 loads soundfonts using asfxload from
the awesfx package: see references
X-Fi has some onboard RAM, but I'm not sure how
exactly it is used: currently just fyi
you can download some soundfonts here:
hammersound.net
click "Collections" and download some GM compatible one
like Fluid - Release 3 [68.5MB] or whatever.
Soundfonts from the above site are compressed
so you need to uncompress them.
melodymachine.com
has some info on uncompressing the soundfonts.
Decompressor for soundfonts
You can download the uncompressed soundfonts:
melodymachine.com
You can use timidity/fluidsynth to both
load the soundfonts and play midi files.
Run fluidsynth and type "load FluidR3 GM.SF2"
at fluidsynth's command line.
If you get an error run this command: mv "FluidR3 GM.SF2" FluidR3GM.SF2
Then run: "aconnect -o" the output will be
something like client 128: 'FLUID Synth (20766)'
[type=user] 0 'Synth input port (20766:0)'
Then try aplaymidi -p 128:0 some .mid file
free .mid file download site: http://www.mididb.com/
Tip: if you run fluidsynth without using aconnect to input and output ports
then fluidsynth will use alot more cpu % than with the aconnect command

TOP
references
alsa.opensrc.org/MIDI
PlayingMIDIFiles
USBMidiDevices
midi howto
linuxSoundAlsa
awe driver for emu10k1 cards
LA soundfonts
soundfont handling
SFX load
Asfx load
iwai alsa page
pmidi player
midi keyboards
SB Live Midi info
SB Live soundfonts
midi overview
gentoo midi doc
timidity howto arch linux wiki