MIDI devices can be integrated into the soundcard or be a separate device. External MIDI interfaces may be attached to either the serial or USB port.
The first *and most important* thing you should do is check if your card is supported!
http://www.alsa-project.org/src/soundcards.html
http://www.4front-tech.com/osshw.html
Configuring MIDI devices varies with Linux distributions. At it's most simplest a well supported card may be configured when you install the OS.
The Linux Kernel includes the OSS drivers, although some distributions use Alsa, and most distributions provide a configuration tool (mostly for soundcards, but if you are using the MIDI port of a sound card it should be configured). Under RedHat you would use sndconfig, under SuSE yast, and Mandrake, DrakConf.
If none of the above tools will configure your MIDI interface, or you are experiencing problems, the following steps should be taken:
Does lsmod show any MIDI related modules? Here's a typical output.
[root@mega /root]# lsmod
Module Size Used by
lockd 32208 1 (autoclean)
sunrpc 54640 1 (autoclean) [lockd]
autofs 9456 2 (autoclean)
usb-ohci 12624 0 (unused)
usbcore 43632 1 [usb-ohci]
hisax 470096 0 (autoclean) (unused)
isdn 104208 0 (autoclean) [hisax]
slhc 4544 0 (autoclean) [isdn]
eepro100 16144 1 (autoclean)
#---- Soundcard modules
opl3 11376 2
mad16 7968 1
ad1848 16848 1 [mad16]
sb 34752 1 [mad16]
uart401 6384 1 [mad16 sb]
sound 58368 0 [opl3 mad16 ad1848 sb uart401]
soundlow 464 0 [sound]
soundcore 2800 6 [sb sound]
nls_cp437 3952 2 (autoclean)
vfat 9408 1 (autoclean)
fat 30432 1 (autoclean) [vfat]
ide-scsi 7664 0
Look for mpu401, olp3, uart401 and oss.
If you are using USB devices don't forget to check if the USB modules are there.
To check the config cat the sndstat file:
[root@mega /root]# cat /dev/sndstat OSS/Free:3.8s2++-971130 Load type: Driver loaded as a module Kernel: Linux mega 2.2.17-21mdk #1 Thu Oct 5 13:16:08 CEST 2000 i686 Config options: 0 Installed drivers: Card config: Audio devices: 0: MAD16 WSS (82C930) (DUPLEX) Synth devices: 0: Yamaha OPL3 Midi devices: 0: Mad16/Mozart Timers: 0: System clock Mixers: 0: MAD16 WSS (82C930)
We see here that the MIDI device is a mad16 and this is listed in the lsmod output above.
If you see nothing related to MIDI check the contents of your /etc/modules.conf file.
[root@mega /root]# cat /etc/modules.conf
alias net-pf-4 ipx
pre-install pcmcia_core /etc/rc.d/init.d/pcmcia start
alias usb-interface usb-ohci
alias parport_lowlevel parport_pc
alias block-major-11 scsi_hostadapter
pre-install plip modprobe parport_pc ; echo 7 > /proc/parport/0/irq
alias scsi_hostadapter ide-scsi
alias eth0 eepro100
alias eth1 hisax
#---- Soundcard
alias sound-slot-0 mad16
options sound dmabuf=1
alias midi opl3
options opl3 io=0x388
options sb support=1
options mad16 io=0x530 irq=5 dma=0 dma16=1 mpu_io=0x300 mpu_irq=7 joystick=1
Here's the output of /proc/modules to check to see if the MIDI modules are loaded into the Kernel.
[root@mega /proc]# cat modules
0000-001f : dma1
0020-003f : pic1
0040-005f : timer
0060-006f : keyboard
0070-007f : rtc
0080-008f : dma page reg
00a0-00bf : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : ide1
01f0-01f7 : ide0
02f8-02ff : serial(auto)
#---- MIDI device
0300-0303 : MPU-401 UART
0376-0376 : ide1
0388-038b : Yamaha OPL3
03c0-03df : vga+
03f6-03f6 : ide0
03f8-03ff : serial(auto)
0530-0533 : MAD16 WSS config
0534-0537 : MAD16 WSS
de00-de1f : Intel Speedo3 Ethernet
f000-f007 : ide0
f008-f00f : ide1
You should see something similar to the above. If not you'll need to install MIDI drivers.
If you are going to be using ALSA divers, I suggest a good read of Valentijn Sessink's Alsa-sound-mini-HOWTO which can be found at the link below:
http://www.linuxdoc.org/HOWTO/mini/Alsa-sound.html
MIDI is a real-time protocol and latency issues are a serious problem.
There are now several developers working on improving the latency times and improvements in the Kernel are making Linux a fine platform for MIDI.
Although stock Linux distributions may run fine, pro set-ups should apply low-latency patches. More information can be found here:
http://www.gardena.net/benno/linux/audio/