I just solved a really annoying Linux problem yesterday. I'm posting here in hopes that this will save someone else from having to go through the same amount of trouble...
It all started when I downloaded a MIDI file and wanted to play it. :) I installed a small "MIDI player" called "playmidi". However, when run, playmidi consistently failed, returning the error "/dev/sequencer: no such device". I checked my device files and kernel config and confirmed that OSS emulation was properly set up and that MIDI drivers *were* loaded into my kernel. I knew that my SB sound card (with an ES1371 chipset) had "MIDI" support, but hypothesized that the ES1371 driver might not be presenting the MIDI device. So I loaded the OPL3 driver just in case. Even with the OPL3 driver loaded, cat'ting /proc/asound/oss/sndstat contained the following: Synth devices: NOT ENABLED IN CONFIG Midi devices: 0: ES1371 I saw that my ES1371 was showing up as a MIDI device, but the "NOT ENABLED IN CONFIG" seemed a bit suspicious, and playmidi was still returning the same error: no such device. After spending WAY too much time slogging through ALSA documentation, I found a command which can be used to load patches (variously called soundfonts, sapmles, etc.) to the synth. It's called sbiload. # strace sbiload -p64:0 --opl3 std.o3 drums.o3 sbiload successfully opened and performed ioctls on /dev/snd/seq. It found and read /usr/share/sounds/opl3/std.o3. It wrote to /dev/snd/seq, but a subsequent read on /dev/snd/seq blocked, causing sbiload to hang... Could the MIDI on my sound card have simply be disabled? I took a look in /usr/src/linux/sound/pci/ens1370.c... it contained code dealing with MIDI, but none of the MODULE_PARMs concerned MIDI. So it wasn't a simple matter of passing the module a parameter like "enable_midi=1". Eventually, I stumbled across /usr/src/linux/sound/oss/es1371.c, which contained the following comment: * /dev/midi simple MIDI UART interface, no ioctl * * NOTE: the card does not have any FM/Wavetable synthesizer, it is supposed * to be done in software. That is what /dev/dac is for. By now (Q2 1998) * there are several MIDI to PCM (WAV) packages, one of them is timidity. Well, that would explain it! The "MIDI" device on the sound card was simply a MIDI port, and NOT a MIDI synthesizer. That explains why, when sbiload tried to read from the port, it just hung... because there was nothing attached. Resigning myself to the fact that the sound card I thought had a MIDI synthesizer, after all, DIDN'T have one, I looked into timidity++. For those of you who might be afraid of timidity (no pun intended), fear not: timidity is small and can be used both from the command line and as an X application. The source tarball approixmately 1.5MB. By comparison, the patches run 10-30MB. After installing timidity++ and a patchset, my MIDI file could be played with a simple: $ timidity file.mid I tried configuring timidity as an ALSA sequencer (proving the -iA switch to timidity and using aconnect on a pair of ALSA ports), but playmidi kept returning "/dev/sequencer: no such device". So, I declared "playmidi" officially broken and uninstalled it. :) It was really quite frustrating. I spent several hours trying to figure this out, only to find out "it's not possible". It would have helped alot if the ALSA utilities made a clearer distinction between MIDI ports and MIDI synthesizers, if ALSA used a word other than "port" to describe ALSA ports, if the card's manufacturer didn't claim to support MIDI synth, if the external MIDI port didn't look so much like a game port. (And, yes, ens1370.c contained MODULE_PARMs for joystick support.) So, I'm hoping that some poor soul googling for help with his/her cheapo "MIDI" sound card will come across my story, and discover (more quickly than I did) the truth which nearly drove me mad: that a MIDI "port" on a sound card isn't always a MIDI synth. It could be just that: a MIDI "port"! _______________________________________________ gnhlug-discuss mailing list [email protected] http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
