Page 1 of 2

Trying to get midi working

Posted: Fri Apr 18, 2008 8:20 am
by Jean
I already spent lots of hours searching and trying out things. I'm on ubuntu 7.10. I used cubase on windows and I would like to do something like that on linux too. I have mp3 and sound in movies working but for instance rosegarden has yet to produce any noise here. First things first, midi:

my card (lspci):
Multimedia audio controller: Creative Labs SB Audigy LS

In /etc/modprobe.d/alsa-base I have, among others, these:

install snd-seq /sbin/modprobe --ignore-install snd-seq && { /sbin/modprobe --quiet snd-seq-midi ; /sbin/modprobe --quiet snd-seq-oss ; : ; }
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
# Cause optional modules to be loaded above sound card driver modules
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 $CMDLINE_OPTS && { /sbin/modprobe -Qb snd-emu10k1-synth ; }
options snd-emu10k1 mpu_port=0x330

But the snd-emu101k1 does not get loaded, it does not show in the output from lsmod | grep snd

When I try to load it by hand I get:

jean@main:~$ sudo modprobe snd-emu10k1
[sudo] password for jean:
FATAL: Error inserting snd_emu10k1 (/lib/modules/2.6.22-14-server/kernel/sound/pci/emu10k1/snd-emu10k1.ko): Unknown symbol in module, or unknown parameter (see dmesg)
FATAL: Error running install command for snd_emu10k1

looking at dmesg gives:
snd_emu10k1: Unknown parameter `mpu_port'

Trying to load a soundfont obviously will not work without these modules:
jean@main:~$ sfxload
No AWE synth device is found

(it also needs snd_emu10k1_synth, doesn't it?)

I wonder if simply spending twenty bucks on another soundcard would save me lots of trouble.

Thanks for any help.

Posted: Fri Apr 18, 2008 8:38 am
by thorgal
I never worked with one of those but I would start checking a few things first :

in a terminal, type

Code: Select all

sudo modinfo snd-emu10k1
In my system, it spits out the following :

Code: Select all

parm:           index:Index value for the EMU10K1 soundcard. (array of int)
parm:           id:ID string for the EMU10K1 soundcard. (array of charp)
parm:           enable:Enable the EMU10K1 soundcard. (array of bool)
parm:           extin:Available external inputs for FX8010. Zero=default. (array of int)
parm:           extout:Available external outputs for FX8010. Zero=default. (array of int)
parm:           seq_ports:Allocated sequencer ports for internal synthesizer. (array of int)
parm:           max_synth_voices:Maximum number of voices for WaveTable. (array of int)
parm:           max_buffer_size:Maximum sample buffer size in MB. (array of int)
parm:           enable_ir:Enable IR. (array of bool)
parm:           subsystem:Force card subsystem model. (array of uint)
It looks like the parameter screwing up things does not show up in the this list, therefore the problem in the 1st place.

Then, check what parameters are passed on by default. Depending on your distro, it will be located in various locations. On debianized systems, something like /etc/modprobe.d/alsa* (I put a * because there are a few).
If you find it (just 'grep' it and see if it shows up in one of those files), replace it by the relevant parameter name or remove it from the options. Then try to load it again.

Posted: Fri Apr 18, 2008 9:28 am
by Jean
Thanks for helping.

Doing a 'sudo modinfo snd-emu10k1' shows no parm 'mpu_port' so I removed that options line completely from /etc/modprobe.d/alsa-base. Btw, this is the only file in etc/modprobe.d about alsa.

After a reboot sudo modprobe snd-emu10k1 succeeds and I get these from lsmod grep snd:
snd_emu10k1_synth 8192 0
snd_emux_synth 35456 1 snd_emu10k1_synth
snd_seq_virmidi 8064 1 snd_emux_synth
snd_seq_midi_emul 7680 1 snd_emux_synth
snd_emu10k1 137120 1 snd_emu10k1_synth

But still no midi in kmid. And now rosegarden even refuses to start.
Edit: after a reboot rosegarden starts again, with or without 'modprobe snd-emu10k1'.
Sigh, sound in linux must be the biggest jungle on earth.

Posted: Fri Apr 18, 2008 3:37 pm
by raboof
Jean wrote:Sigh, sound in linux must be the biggest jungle on earth.
We should make a nice big flowchart of what kinds of things you can do to verify which pieces of the puzzle are already working, and how to make them work when they don't.

It'll still be a jungle, but at least we'd have a map :).

Posted: Fri Apr 18, 2008 3:43 pm
by Pablo
Hi Jean!

I hope you have solved your module issues!
I suggest you read the Free Companion by Michael McIntyre. An excellent tutorial for Rosegarden. It can help that the audio card used for the tutorial is similar to yours. Rosegarden is an audio and MIDI sequencer and score editor but it needs something more to make sounds.
I spent some hard days trying to get any sound out of it! I haven't worked with cubase earlier But for you it's got to be much easier! Once you have your sound modules OK and Jack sees your audio card, the simplest way I know is loading a soundfont (*.sf2) in qsynth (a software synthetiser). Then, first start jack, then qsynth then Rosegarden. Then you have to "manage MIDI devices...

I hope this helps

Posted: Fri Apr 18, 2008 4:48 pm
by thorgal
or you can start amsynth, set it to be your MIDI out device in rosegarden (in the manage Device section), redirect a rosegarden MIDI track to amsynth. But rosegarden can also start soft synths as plugins (not as an external app). amsynth is one of them IIRC.

What I don't really understand in rosegarden is why it starts by default with tons of tracks, isn't it a bit funny ?

Posted: Sat Apr 19, 2008 6:19 am
by Jean
Yes such a chart would be an idea. There are howto's which try to cover things like but it's nowhere near complete.
The amount of work for such a chart seems overwhelming.

Hi pablo. I have been on the rosegarden mailing list for a short while so I 'know' Micheal from there, nice guy.
As to your suggestions, I can't load a soundfont, sfxload complains 'can't find AWE device' and rosegarden needs sfxload to work, probable that's a reason or one of the reasons it refuses to open it's mouth and make sound.
Qsynth crashes on startup so that's no help.

As a sidenote, I don't have a real time kernel yet. When I start jackd from command line 'jackd -d alsa -dhw:0 -r48000 -p256 -n2' it starts to produce xruns continuesly though rosegarden says 'audio ok, midi ok' and says it's connected to jack.
In windows I can play recordings with up to 10 audio tracks together with 5 midi tracks with various effects etc without any problem. And I'm not jumping into a realtime or low latency kernel before I have at least a bit more working.

Posted: Sat Apr 19, 2008 11:17 am
by Pablo
Don't you use qjackctl? It's the GUI for jackd.
Are you positive that your SB card is always hw:0? (See output of "cat /proc/asound/cards" and check User FAQ number 12 of If you have an onboard audio card and don't use it at all, you'd better disable it in the BIOS so that your SB is the only card and number hw:0)
Have you checked that your audio card is given a unique IRQ number? (output of cat /proc/interrupts)


Posted: Sat Apr 19, 2008 4:37 pm
by Jean
Hi there Pablo, thanks.

The onboard soundcard is disabled in the bios yes. This soundblaster is indeed hw:0.

Your other suggestion is remarkable though, cat /proc/interrupts gives, among others:

19: 5417373 IO-APIC-fasteoi snd_ca0106, nvidia

So I wonder what that nvidia is doing there! It might be you are on to something.
But I wouldn't know where to go from here.

Posted: Sat Apr 19, 2008 4:48 pm
by thorgal
change the PCI slot for your soundscard until you hit one that does not share IRQ with the nvidia. If your BIOS allows it, you could also reassign IRQs.

Posted: Sat Apr 19, 2008 4:51 pm
by thorgal
Jean wrote: 'jackd -d alsa -dhw:0 -r48000 -p256 -n2'
without a realtime kernel and no rt priviledges to the user you usually log in with, this command will not be xrun-proof.

If you install an rt kernel and set your /etc/security/limits.conf appropriately (PAM security thing), tweak the IRQ thread priority (fetch a script or package called rtirq), then you should transform the command line like this :

jackd -R -P 70 -d alsa -dhw:0 -r48000 -p256 -n2

256 is a little ambitious maybe. Try 1024 first then decrease it if things go well.

Posted: Sat Apr 19, 2008 6:13 pm
by Jean
thorgal wrote:256 is a little ambitious maybe. Try 1024 first then decrease it if things go well.
Well, I thought the lesser the number, the lesser the load, but as you suggest it's the other way round. Duh. Indeed I get no xruns anymore with a higher value. Thanks.

As to a real time kernel I'm still a bit anxious about installing one. And I really would like to solve the other things first, like having midi in the first place, and having output from rosegarden. Then after that, if xtruns are troubling me too much, I can always take the jump and install rt.

thorgal do you know if that line from /etc/interrupts indeed suggests conflicting interrupts and if so, what can I do about it. Me thinks shuffling priorities would not be enough to remedy that.

Posted: Sat Apr 19, 2008 8:35 pm
by thorgal
there's nothing wrong in general about shared interrupts. That's actually neat because there aren't an infinite number of them (there used to be 15 of them, and most of the extra PCI devices ended up sharing IRQ 11 but the APIC system changed this by extending the number of IRQs). No, where there could be a small issue is that if your nvidia card suddenly "interrupts" your audio card because it wants to get the CPU for itself. So if you set a high priority on your audio card's IRQ, the nvidia card will also benefit from it, which will parasite the exclusive processing of your audio in critical times, not good when you want to record stuff flawlessly ...

apart from this strict audio requirements (DAW requirements in fact), there's nothing wrong with IRQ sharing.

Posted: Sun Apr 20, 2008 2:46 am
by briwood
raboof wrote: We should make a nice big flowchart of what kinds of things you can do to verify which pieces of the puzzle are already working, and how to make them work when they don't.
One flowchart is available here: ... 2.html#2_1

The troubleshooting that raboof imagines is not part of that.

Also that document is probably old (since it was written for Rosegarden 4). I don't know how things have changed since then.

Posted: Sun Apr 20, 2008 9:24 am
by Jean
thorgal wrote:there's nothing wrong in general about shared interrupts.
Thanks, I didn't know. Gonna try other slots for the card though.