There are several ways to obtain good latency with the current 2.6 Linux kernel. Due to the lack of good documentation about how to install a realtime kernel some hints are provided below, which benefit MusE and other realtime capable programs.
Setup realtime in Linux
Please see this page: http://jackaudio.org/linux_rt_config for instructions on setting up realtime capabilities on a recent (2011) Linux distribution. The Chapter below contains some distributions that may have a default configuration that already enables this. Of course there are more distributions, shop around for multimedia or pro audio linux distributions if you feel so inclined.
Use a Multimedia Optimized Linux Distribution
The easiest way to obtain low latency realtime performance is to use a Linux distribution that is optimized for multimedia and includes a realtime kernel. The distribution usually also provides other programs and optimized settings to properly set up and configure the system. There are many distributions that do this and each has its own characteristics. For example a few well known distributions include:
Common Tweaks For Best Performance
Older Information (pre-2008)
Note that the information below here was last edited in 2007. Linux is rapidly changing and the advice may not be up to date. It is being kept here should someone find it still applicable or useful.
Low latency patches from Ingo Molnar for 2.6 kernel
There you can also find some stuff on getting realtime priority for normal users and tune your hardware.
This has been integrated into the linux kernel.org kernels for some time now and is working nearly out of the box. At least you don't have to install patches which is much more complicated compared to a single recompile.
We maintain a small installation guide here: Realtime-lsm_module
Nice Gentoo documentation:
Here are some mails I've collected, maybe they give you some hints.
> i would like to take the chance to document what latency-methods are > implemented and as far as i know it's: > - libcaps (2.4 or 2.6 only?) > - 2.4 preemptive patches (there is a howto) > - 2.6 lsm module
The libcap and lsm are not strictly for getting lowlatency but for allowing realtime threads from a program run by a normal user.
> is there more? > i think a 2.6 preemptive patch is also being worked on lately.
Yes, even the standard (vanilla) kernel is catching up. I'm running the 2.6.10 with very good performance at this moment.
Though, I think what Erich is asking is only partly answered by this:
There are several kinds of latencies. The one described is the realtime latency between playing a sound and that it will reach the ear.
The other kind of latency is what happens when there are latencies introduced by different parts of the system. E.g. plugins can add latency.
MusE does not compensate for plugin latencies as far as I know. Recorded wav files I am unsure about. It has never been an issue for me.
If there is latency in the recording then it should be the same as the setting in Jack I think. buffersize*number_of_buffers
Mmm, this begs for some experimentation. How about recording the output of a softsynth to different tracks with different buffer setting, does this change the delay? I'll see if I can try that later.
I realize I didn't quite answer the question as I wanted to.
libcap - realtime support for 2.4 suid binary - realtime support for 2.4 and 2.6 lsm-realtime - realtime support for 2.6 (best option)
About latency (this is a still a jungle...)
For 2.4 the standard kernel is not good enough. You need one of the patches, there are several, the ll-patch from Andrew Morton is the most used one. http://www.zipworld.com.au/~akpm/linux/schedlat.html
For 2.6 the standard kernel has since 2.6.10 been catching up and has very good lowlatency capabilities if 'desktop-preemption' is enabled.
There is also a patch from Ingo Molnar that supposedly gives _extreme_ reliability with a correctly tuned system though this seems black magic to set up. http://people.redhat.com/mingo/realtime-preempt/
I was hoping to find some more info in the alsa wiki but I wasn't really... http://alsa.opensrc.org/