Contents

MusE midisetup + internal settings

Use all this information at your own risk!

This is the first tutorial from a series of tutorials which should help you getting MusE running _smooth_. But before we start configuring MusE we have to speed up our system.

My current system
- 1.2 GHz
- ~300 MB Ram
- Kernel 2.6
- muse 0.6.3-1 Qt-based midi/audio sequencer (precompiled, deb)
- debian unstable
- Creative Labs SB Live! EMU10k1 (rev 04) CT4850
- joystik out midi connector cable
- Roland MC-307 GrooveBox (more on this in later tutorials)
- Waldorf Q               (more on this in later tutorials)

There are a few steps which you have to take:

Install your soundcard in a proper way

 On my debian installation i need the following modules 
 to get midi/wav working with the creative sblive card:

 root@debian:/home/joachim# cat /etc/modules | grep snd
 snd-emu10k1-synth
 snd-emu10k1
 snd-seq-midi         (you don't need this with MusE)
 snd-mixer-oss        (you don't need this with MusE)
 snd-pcm-oss          (you don't need this with MusE)
 Check with some audio application that audio is working. I use 
aplay foo.wav to do this. Don't forget to use alsamixer to
 get the right mixersettings.

Verify that all modules are up and running

Open a console, get root, and type lsmod

The output should look like this:
root@debian:/home/joachim# lsmod | grep snd
rtc                     9656  1 
soundcore               6528  2 snd
snd_pcm_oss            47844  1 
snd_seq_midi            6496  2 
snd_mixer_oss          16640  1 snd_pcm_oss
snd_emu10k1_synth       6656  0 
snd_emu10k1            62340  4 snd_emu10k1_synth
snd_pcm                83684  2 snd_pcm_oss,snd_emu10k1
snd_ac97_codec         51332  1 snd_emu10k1
snd_page_alloc          9028  2 snd_emu10k1,snd_pcm
snd_hwdep               7200  1 snd_emu10k1
snd_emux_synth         33600  1 snd_emu10k1_synth
snd_seq_virmidi         5504  1 snd_emux_synth
snd_rawmidi            19680  3 snd_seq_midi,snd_emu10k1,snd_seq_virmidi
snd_seq_midi_event      5952  3 snd_seq_oss,snd_seq_midi,snd_seq_virmidi
snd_seq_midi_emul       6848  1 snd_emux_synth
snd_seq                49168  13 snd_seq_oss,snd_seq_midi,  
     snd_emux_synth,snd_seq_virmidi,snd_seq_midi_event,snd_seq_midi_emul
snd_timer              20292  2 snd_pcm,snd_seq
snd_seq_device          6536  7  snd_seq_oss,snd_seq_midi,   
     snd_emu10k1_synth,snd_emu10k1,snd_emux_synth,snd_rawmidi,snd_seq
snd_util_mem            3264  2 snd_emu10k1,snd_emux_synth
snd                    42020  17 snd_seq_oss,snd_pcm_oss,      
     snd_seq_midi,snd_mixer_oss,snd_emu10k1,snd_pcm,snd_ac97_codec,
     snd_hwdep,snd_emux_synth,snd_seq_virmidi,snd_rawmidi,snd_seq_midi_event,
     snd_seq,snd_timer,snd_seq_device,snd_util_mem

Now try this command in the same console amidi -l

The output should look like this:
root@debian:/home/joachim# amidi -l
Device    Name
hw:0,0    EMU10K1 MPU-401 (UART)
hw:0,1    Emu10k1 Synth MIDI (16 subdevices)
hw:0,2    Emu10k1 Synth MIDI (16 subdevices)
root@debian:/home/joachim#

What about realtime in MusE?

If you start MusE for an console and get the following line:

midi thread 25351 _NOT_ running SCHED_FIFO

Your installation is not complete, go back to the Installation section. Depending on your Kernel (2.6.x) this could be because the "realtime lsm" modle wasn't loaded or done wrong.

By running MusE (0.6.x NOT 0.7.x) with the option '-R', MusE tries to set its internal threads to realtime, to get good timing in MusE this is pretty much a requirement. The 0.7.x branch does this automatically! We need the realtime support because we will get a stuttering midi out or even bad sound. Don't even think about recording something without this setting.

  • use capabilities patch (might require a kernel patch, if your kernel doesn't already have it applied)
  • if you are running kernel 2.6 or newer you could use the LSM realtime module
NOTE: 2.4.x kernel has much better realtime support than 2.6.x, this issue is currently discussed on the linux-audio-dev mailing list if you have further interest. So maybe it is the best to use a 2.4.x kernel with the old realtime patches (there are quite good tutorials for this out there how to patch the 2.4.x branche kernels).

We'll test the latency for your setup to see if it fits our needs:

http://www.gardena.net/benno/linux/audio/

You should download the latencytest source latencytest-0.42-png.tar.gz or something like that. Compile and install it. You can also grab the binary distribution from there.

I had to install libgd-dev to compile this test successfully:

root@debian:/home/joachim/tmp/latencytest0.42-png# dpkg -l | grep libgd-dev
ii  libgd-dev      1.8.4-35       GD Graphics Library (transitional package)

After you have compiled you get the binary called latencytest, try this:

root@debian:/home/joachim/tmp/latencytest0.42-png# ./latencytest /dev/hda
fragment latency = 23.219955 ms
cpu latency = 18.575964 ms
 23.2ms (  0)|
1MS num_time_samples=128 num_times_within_1ms=122 factor=95.312500
2MS num_time_samples=128 num_times_within_2ms=122 factor=95.312500
PIXEL_PER_MS=9

Hint: To stop this program press CTRL+C in your console.

Ok I got a very bad latency for audio because of this i get noisy sound when i'm on a high load. So if i would like to use my computer to record audio there will be allover crackling noise on my record. We don't want that.

The cure for this problem:

Check this out, here are some good documents about this problem for kernel 2.4

http://workshop.t0.or.at/workshop/w/linuxaudio

Hint: You can use a precompiled kernel 2.4 also, it is called Vanilla Kernel

For Kernel 2.6.4 I will describe it here:

Download realtime-0.0.4.tar.gz and linux-2.6.4-rt-0.0.4.patch.gz from here:

http://www.joq.us/realtime/

And get the latest kernel 2.6.4 in my case from:

ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.4.tar.bz2

After this unpack the kernel to /usr/src into /usr/src/linux and type make menuconfig

Create your configuration, don't forget the alsa-drivers

Now go to /usr/src/linux (where your new kernel 2.6.4 is) and copy the patch here, too.

Open 'console' and get 'root' and type:

root@debian:/usr/src/linux-2.6.4# patch -p0 < linux-2.6.4-rt-0.0.4.patch 
 patching file security/Kconfig
 patching file security/Makefile
 patching file security/realtime.c

Edit the /usr/src/linux/.config file and set the configuration as follows:

 CONFIG_MODULES=y
 CONFIG_SECURITY=y
 CONFIG_SECURITY_CAPABILITIES=m

For the next step you probably need the (kernel-package) this:

root@debian:~# dpkg -l |grep kernel-package
ii  kernel-package 8.079          A utility for building Linux kernel related

Now in /usr/src/linux type:

root@debian:~# make-kpkg 

and wait till your new kernel has compiled. This will take a while ~ 10-20min

After this you will find the /usr/src/kernel-image-2.6.4_10.00.Custom_i386.deb file. Install it with:

root@debian:~# dpkg -i kernel-image-2.6.4_10.00.Custom_i386.deb

Restart your computer now and boot the new kernel

After this get to /usr/src/realtime-0.0.4 and type:

root@debian:/usr/src/realtime-0.0.4# make install

All your modules will then be recompiled. After this, they are installed. Think about making a backup of /lib/modules/2.6.4 befor trying this. I get then:

 root@debian:/usr/src/realtime-0.0.4# make install
 make modules_install -C /usr/src/linux SUBDIRS=/usr/src/realtime-0.0.4
 make[1]: Entering directory `/usr/src/linux-2.6.4'
 /usr/src/linux-2.6.4/scripts/Makefile.modinst:16: *** Uh-oh, you 
   have stale   module entries. You messed with SUBDIRS, do not complain 
   if something goes wrong.
 INSTALL 
 if [ -r System.map ]; then /sbin/depmod -ae -F System.map  2.6.4; fi
 make[1]: Leaving directory `/usr/src/linux-2.6.4'

Type this:

root@debian:/# echo "modprobe realtime any=1" >> /etc/modules

Restart your computer now II and boot the new kernel again

After this, type this again:

root@debian:/home/joachim/tmp/latencytest0.42-png# ./latencytest /dev/hda

Using 'hdparm' to speed up disk usage

USE HDPARM WITH CARE - IT'S EASY TO LOOSE ALL YOUR FILES WITH THIS TOOL!

If you want to record your music with MusE or any other application installed on the same computer as you're running MusE you have to check if your harddrive is set to DMA mode. This will give a real performance hit if you play or record things with a high databandwidth.

 Get 'root' and type:
  hdparm /dev/hda
root@debian:/home/joachim# hdparm /dev/hda
/dev/hda:
multcount    = 16 (on)
IO_support   =  1 (32-bit)
unmaskirq    =  1 (on)
using_dma    =  1 (on)
keepsettings =  0 (off)
readonly     =  0 (off)
readahead    = 256 (on)
geometry     = 65535/16/63, sectors = 87930864, start = 0
  hdparm -c 1 -d 1 /dev/hda
root@debian:/home/joachim# hdparm  -c 1 -d 1 /dev/hda
/dev/hda:
setting 32-bit IO_support flag to 1
setting using_dma to 1 (on)
IO_support   =  1 (32-bit)
using_dma    =  1 (on)
Ok now we want to test our setup:
  Type:
  /sbin/hdparm -tT /dev/hda
root@debian:/home/joachim# /sbin/hdparm -tT /dev/hda
/dev/hda:
Timing buffer-cache reads:   524 MB in  2.01 seconds = 260.74 MB/sec
Timing buffered disk reads:   72 MB in  3.01 seconds =  23.89 MB/sec

General performance tips

Do not use KDE or GNOME. Use 'blackbox' or something like this. Maybe you should install a second user for this or use the root account. I suggest the second user!

This is because KDE & co have a high memory usage you could better use for your applications.

Powered by MediaWiki