-   Slackware (
-   -   Adventures With Playing MIDI Files (

Woodsman 09-02-2008 03:45 PM

Adventures With Playing MIDI Files
I cannot play MIDI files on my Slackware 12.1 box.

I do not pretend to know anything about MIDI files. I am aware that amarok is a front-end to other engines. I am using xine as the engine, which does not support MIDI. Not a big deal. I'm not interested in sequencing --- I only want aplaymidi and KMid to produce sound from midi files. I just want to click and play.

1. ALSA is configured and all other sound files play fine.

2. KMid seems to be playing the file, but there is no sound. Running KMid from the command line shows no error messages.

3. The command line aplaymidi provides not output or error messages and there is no sound.

4. aplaymidi -l provides the following report:


Port    Client name                      Port name
14:0    Midi Through                    Midi Through Port-0
20:0    MPU-401 UART                    MPU-401 UART MIDI

5. aconnect -o provides the following report:


client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'MPU-401 UART' [type=kernel]
    0 'MPU-401 UART MIDI'

6. alsamixer shows all outputs are okay.

7. There are several midi kernel modules available.

8. The midi files play fine with Windows Media Player 6.4 in NT4.

9. lsmod | grep midi shows the following midi related kernel modules loaded: snd_rawmidi, snd_seq, snd_seq_device, snd_seq_midi, snd_seq_midi_event

10. cat /proc/asound/cards provides the following report:


0 [NVidia        ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xfe024000 irq 17
 1 [UART          ]: MPU-401 UART - MPU-401 UART
                      MPU-401 UART at 0x330, irq 10

11. cat /proc/asound/oss/sndstat provides the following report:

Sound Driver:3.8.1a-980706 (ALSA v1.0.15 emulation code)
Kernel: Linux ovenbird #2 SMP Sun Aug 24 16:45:54 CDT 2008 i686
Config options: 0

Installed drivers:
Type 10: ALSA emulation

Card config:
HDA NVidia at 0xfe024000 irq 17
MPU-401 UART at 0x330, irq 10

Audio devices:
0: AD198x Analog (DUPLEX)


Midi devices:

7: system timer

0: Analog Devices AD1986A
1: mixer10

12. I have a /dev/midi1 device. Ownership is root:audio with 660 permissions.

13. My normal user account is a member of the audio group.

14. aplaymidi fails to produce sound for root.

I have not tried compiling timidity and won't as long as the command line aplaymidi fails to produce sound from midi files. I suspect with the lack of error messages that aplaymidi and KMid are sending the output okay but because of configuration issues the output is the equivalent of /dev/null.

Any thoughts?


keefaz 09-02-2008 04:07 PM

There is no sound in midi files, just notes, beat tempo, measure timing, program change etc..
MIDI was designed to communicate between sequencer and sound generator, that means you need a MIDI sound generator
Some software like TiMidity has built in syntetizer generator (not with electronic, but with software)

Woodsman 09-03-2008 01:43 PM

Thank you.

With further reading I now have an improved understanding about MIDI. MIDI files basically are wrappers containing data how to play a sound file. Another mystery unveiled is that playing MIDI files requires a synthesizer for output. The synthesizer interprets the wrapper data to provide audio output.

Based upon this additional research, I asked the mods to move this thread to the Slackware forum because now I think the problems I am experiencing are Slackware related. This thread seems to have provide similar information (my apologies for not finding the thread when I posted :().

Additional information:

I can play MIDI files in my old NT4 box with Windows Media Player (WMP) 6.4. I have no problems playing MIDI files in NT4 with Winamp 2.95. Because both are universal Windows players, I suspect the software tools are using a software synthesizer.

That NT4 box is dual boot with Slackware 12.1. The box contains a Creative Soundblaster AWE64 sound card. My understanding is the AWE64 contains a hardware synthesizer.

Therefore, when I boot into Slackware 12.1 on that dual boot box, I should be able to play MIDI files but I am not.

Running aplaymidi -l on that dual boot box reveals many ports not available on my new box. In the dual boot box alsamixer shows a Synth volume option set to 90%. That leads me to believe I likely have ALSA configured correctly on that box. Therefore something else is not configured correctly.

My new box uses an on-board sound chip. The command line reports show a MPU-401 UART installed. Yet a UART is not a built-in synthesizer, just an interface. Additionally, based upon the command line outputs as shown in my original post, and my alsamixer output not showing a Synth volume setting, I have neither a hardware nor software synthesizer installed in the new box.

I prefer a global installation approach despite my dual boot box containing the AWE64 card. That is, any solution should support any of my computers regardless of the sound card (I have two more old boxes).

Although I prefer a global solution, I suspect in the dual boot box minimally I need only install and configure soundfonts. In my new box I need to install soundfonts and a software synthesizer. Please correct me if I am wrong.

I appreciate any help. Thanks.

Erik_FL 09-03-2008 09:53 PM

There is an ASLA driver package called "awesfx" that contains a program to load the sound font files into a Creative Labs AWE synthesizer. If you want to use the hardware synthesizer then you need that.

You will also need to copy the sound font files to the Linux system. You can copy the ones from the Windows driver package for the sound card.

At the end of my "rc.modules" file I added these.


# Required for Audigy 2 MIDI support
/sbin/modprobe snd-seq-midi
/sbin/modprobe snd-emux-synth
/sbin/modprobe snd-emu10k1-synth

In "rc.local" I put this to load the sound fonts.


# Load Sound Fonts for Audigy 2
/usr/local/bin/asfxload CT2MGM

I copied the sound font files to this directory.


Here are the files that I found with my card's Windows driver software.


As you can see I load the "CT2MGM" sound fonts on my system.

I had to build the "asfxload" program from the "awesfx" package in order to use the hardware synthesizer.

I also had to build the following driver modules.


When you play MIDI files make sure that you select the wave table synthesizer and not the MPU UART MIDI port. Don't get frustrated if it takes a few tries to get hardware MIDI working.

I haven't tried using a software synthesizer, but in theory you should be able to install and use one.

You can think of MIDI as recording the sheet music for something, as "written" by the performance that someone produced when they played the music. It identifies the different instruments and assigns them to MIDI "channels" and then each channel has the note, duration, plus other information such as volume, attack and aftertouch. It is sort of like a much more sophisticated player piano roll. How MIDI sounds depends on the synthesizer used to produce the voices assigned to the MIDI channels.

Woodsman 09-04-2008 01:32 PM

Thanks for the reply!

Although I have an AWE64 installed on my old box, I wanted a global solution that succeeds with any of my boxes, most importantly my new box, which does not have a Soundblaster card installed. I suspect because the AWE64 has a built-in hardware synthesizer the playback would be smooth, but that would not help me on my new box or any other box. :(

After much reading and head scratching, eventually I decided all I needed was to install timidity and freepats. Yet after compiling from the scripts, I still had no sound using aplaymidi. :scratch:

Next I discovered that I should source the /etc/timidity/freepats.cfg and /etc/timidity/crude.cfg files in /etc/timidity/timidity.cfg:

# This is the default configuration file for TiMidity++.
# See timidity.cfg(5) for details.

source /etc/timidity/freepats.cfg
source /etc/timidity/crude.cfg

Still no sound using aplaymidi. :scratch:

Next I discovered some discussion about running timidity in daemon mode:

timidity -iA

Then I tried aplaymidi -p 128:0 soundfile.mid. Finally I had sound.

My new box plays all midi files smoothly and without issues.

On my new box I configured KMid to use one of the timidity ports and KMid is fine now.

To my dismay, both of my old boxes could not play all midi songs smoothly. :( My NT4/Slackware dual boot with the AWE64 stuttered horribly (400 MHz K6-III+, 256 MB RAM, Sound Blaster AWE64 ISA sound card, 100 Mbit NIC). My old PII played some files okay and stuttered with others (350 MHz Deschutes, 448 MB RAM, C-Media 8738 PCI sound card, 100 Mbit NIC). I played the songs over the network from a shared directory. I did not try copying the files locally because I don't think the network could cause that much delay. As I previously mentioned, WMP 6.4 and Winamp 2.95 have no problems playing MIDI files in my old NT4 box. Something remains configured incorrectly in my Slackware system on my old boxes. :scratch:

Playing MIDI files on my old boxes would be nice but not critical. I likely could learn to install the AWE64 support packages, but that would help me only with the AWE64 and not on my PII.

If I wanted to play MIDI files regularly then do I need to always run timidity as a daemon? If yes then I suppose I could run timidity -iA & in rc.local.

Hmm. Most people just want to point-and-click to play music files. I am no different in that respect. I am not an audiophile and I struggled through several forum threads and web pages with this MIDI issue. But broken MIDI support does not seem isolated to the stock Slackware. Lots of forums threads from many people. Although I was successful, this was a lot of work and mentally exhausting. Oh well, enough venting --- immediate problem solved!

brianL 09-04-2008 04:39 PM

I never bothered with MIDI, but I did a lot of messing about (can't call it music) with VST software synths and effects when I had XP on my desktop.

randomsel 09-04-2008 06:56 PM

If you don't mind software midi, I'd go with

I haven't used the package for timidity before, didn't know there was one. The above one works for me (no fiddling).

All times are GMT -5. The time now is 08:58 PM.