next up previous
Next: Installing Planet CCRMA on Up: Planet CCRMA at home Previous: Installing Planet CCRMA on


Installing Planet CCRMA on Fedora 7

The Planet CCRMA package collection for Fedora 7 (i386 or x86_64 architectures) resides in a Yum (Yellowdog Updater Modified) repository that can be accessed through the Internet.

You will need to have a reasonably fast network connection to the world to install Planet CCRMA by connecting directly to its repository or one of its mirrors.

Installing Planet CCRMA is easy. You will be guided through the install process in the following pages.


Installing Fedora

The first step is to install Fedora 7 itself. You can download cdrom or dvd images from the main Fedora site at RedHat or one of its mirrors. Or you can use the re-spins from the Fedora Unity project which include more up to date packages and will save you a lot of downloads later.

Regardless of which dvd or cdrom you use, make sure you upgrade to the latest security and functionality upgrades before proceeding. Run this (as root) from a terminal:

yum upgrade

It could take a long time to download and install all the upgrades...


Installing the Planet CCRMA package signature

All packages in the Fedora 7 Planet CCRMA repositories are signed (that is, rpm will know if the package has been altered if you have the proper signature installed).

First install the GPG signature key for Planet CCRMA, if you are connected to the Internet just do:

rpm --import http://ccrma.stanford.edu/planetccrma/RPM-GPG-KEY.planetccrma.txt


Adding the Planet CCRMA repositories

You now need to add the proper urls to your Yum configuration files so that it can access the Planet CCRMA repositories.

rpm -Uvh http://ccrma.stanford.edu/planetccrma/mirror/fedora/linux/planetccrma/7/i386/planetccrma-repo-1.0-3.fc7.ccrma.noarch.rpm

This will install configuration files for Yum that will enable it to access the Planet CCRMA repositories.


Installing the low latency kernel

Planet CCRMA provides a version of the Linux kernel that includes the realtime preemption patches by Ingo Molnar. While the stock Fedora kernels will also work for non-critical audio work the realtime preemption patches are pretty much a requirement for reliable behavior at low latencies.

Before installing the Planet CCRMA kernel you should edit this yum plugin configuration file and disable it:

/etc/yum/pluginconf.d/installonlyn.conf

(by default this yum plugin will force yum to keep only the latest two kernels you install and will erase any older kernels. That's not usually what you want if you are trying out kernels - you always want to have the original kernel around in case something goes wrong).

In the latest updates of yum the functionality of this plugin has moved to the core yum implementation, if that is the case you will need to edit /etc/yum.conf and add this line to its end:

installonly_limit=0

NOTE: we are not installing the kernels directly. There's a reason. The planetccrma-core package is empty but it requires all the actual packages needed, and with the proper versions. The core packages include the patched kernel itself, a patched version of PAM that has access to realtime scheduling and memory locking for all users (that is, anyone can hang the machine - but you need this for good low latency performance) and a startup script that reorders the priority of the interrupt handling to favor the sound cards.

So, go ahead and install the Planet realtime kernel:

yum install planetccrma-core

If this is an update, that is, you have previously installed the jack-audio-connection-kit that is part of the Fedora repository, you will need to edit /etc/security/limits.conf to modify the permissions for realtime scheduling and memory locking (which are set by the Fedora Jack package to much more conservative values than what Planet CCRMA needs).

So, edit /etc/security/limits.conf and see what you have for the values of ``rtprio'', ``nice'' and ``memlock'' parameters, if the lines where those parameters appear start with anything other than ``*'' then you need to change the file. Change those lines to be:

* - rtprio 99
* - nice -10
* - memlock 4000000

(this will give any user access to realtime scheduling and memory locking - not just a group - and the maximum usable priority will be 99 instead of - last time I checked - 20).


Testing the new kernel

At this point you can cross your fingers and reboot the machine. At the grub prompt press any key to access the boot menu and then select the kernel you want to try (the Planet CCRMA kernel, if it was the last kernel installed, should be the default).

If at any time you want or need to change the default boot kernel you can edit the /boot/grub/grub.conf file and changing the ``default='' line to point to the kernel you want to boot by default. Kernels are zero base indexed, ``0'' being the first in the list of kernels that follows the default line. Depending on how many kernels you just installed, and which one you want to boot by default, the ``default='' line should read ``0'' or ``1''.


Installing applications

You are done with the hard stuff. At this point you have a machine that has a low latency kernel and it is booting happily (hopefully).

Now you have to install the actual applications and start having fun!

One way to do this is to just go ahead and browse through the web pages of the Planet CCRMA repoview (or here for the Planet CCRMA Core components).

I'm providing a meta package (an empty package that requieres other packages) so that you can install all major apps in one yum incantation. If you want to do that then type this in a terminal (as root):

yum install planetccrma-apps

Good luck in your explorations of the musical world hosted on Linux! Be patient, if you are coming from other operating systems there is a new world to learn and discover. Getting to know it is rewarding but it will take time.


Configuring multiple sound cards

Fedora Core 5 has a utility that let's you configure your soundcards. Sometimes I still prefer to do things manually.

If you have multiple sound cards (including external usb MIDI controllers, which also count as a soundcard) you most probably want to define which one is going to be the default. For that you will have to (carefully) edit the "/etc/modprobe.conf" file. Otherwise cards whose kernel modules are loaded by the hotplug subsystem early in the boot process - such as usb soundcards - will automatically become the first card, probably not what you want if that soundcard is just a MIDI interface with no audio capabilities.

You can use the following template as an inspiration for what you have to add to modprobe.conf. Be aware that there will be more lines in your modules.conf file, including ``install'' and ``remove'' lines for the soundcards that Kudzu has configured, leave those lines alone:

alias snd-card-0 snd-CARD_0
options snd-CARD_0 index=0
...
alias snd-card-N snd-CARD_N
options snd-CARD_N index=N

In this template ``...'' stands for more lines here, one for each extra card (don't copy the dots! :-) ``CARD_N'' is the name of the kernel module that corresponds to the card you want in position ``N'' (N=0 is the first card, usually the default device used by all programs).

In the case of USB soundcards you will have to add the ``alias'' line manually as kudzu does not include it in modprobe.conf:

alias snd-card-N snd-usb-audio
options snd-usb-audio index=N

Here is a filled in example that includes three cards (this ommits the ``install'' and ``remove'' lines):

alias snd-card-0 snd-ice1712
options snd-ice1712 index=0
alias snd-card-1 snd-ens1370
options snd-ens1370 index=1
alias snd-card-2 snd-usb-audio
options snd-usb-audio index=2

And this is how the audio part of modprobe.conf looks like in my laptop configuration (wrapping of the install and remove lines added to better fit the width of this page):

alias snd-card-0 snd-intel8x0
options snd-intel8x0 index=0
install snd-intel8x0 /sbin/modprobe --ignore-install snd-intel8x0 && \
        /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-intel8x0 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; \
        /sbin/modprobe -r --ignore-remove snd-intel8x0
alias snd-card-1 snd-usb-audio
options snd-usb-audio index=1

After you are done editing the file, use depmod to parse it again and determine module dependencies:

/sbin/depmod -a

You can now restart the sound driver to test it. If you are logged in into X you probably want to logout first and do this from a text console, as stopping the alsa system will kill the audio control panel in Gnome. Note: this will not test what happens when hotplug find an audio device early in the boot sequence, you will have to reboot to test that.

/etc/rc.d/init.d/alsasound stop

Then start it again:

/etc/rc.d/init.d/alsasound start

It should load all the modules for all your soundcards in the specified order.


Tuning the system

There are a lot of factors that affect the audio performance of a given system. I'll just detail a few of the most important. If your new kernel works and you are impatient to try out some cool software you can safely skip the following recommendations and come back here later to get the best performance from your system.


Tuning the hard disks

If your computer uses EIDE hard disks (instead of SCSI) it is vitally important to tune the driver. Although newer versions of Fedora Core do a good job by default, it is still a good idea to check things.

The linux kernel uses conservative settings for the IDE driver because of the possibility of data corruption in very old motherboards and drives. AFAIK all modern mobos and drives are fine so you should definitely tune your setup. Backup your important data before trying...

Use hdparm for that. To check what the current settings for your driver are type (replace /dev/hda with the drive you want to check):

/sbin/hdparm /dev/hda

This is one incantation I'm currently using:

/sbin/hdparm -c 3 -d 1 -m 16 -A1 /dev/hda

This means: '-c 3' enables 32 bit transfers with sync through the pci bus, '-d 1' enables DMA operation, '-m 16' turns on multisector transfers (with 16 sectors) and '-A1' enables the driver read ahead feature. Read the hdparm man page for all the gory details. Run '/sbin/hdparm -t' before and after each optimization to check for improvements. Some options ('-m' and '-u') are dangerous for some chipset and drive combinations and can lead to massive filesystem corruption. Test on a filesystem you don't mind losing (you do have backups right?). Actually, '-u' can make the latency worse (understandable if you read the man page) so don't turn it on for now.

Depending on what drivers and motherboard you have there might not be much improvement in the overall speed. Don't worry, even though it does not appear to be running any faster, the latency performance has improved (but hdparm cannot test for that). The latest Fedora releases are much better at optimizing hard disks so you might also find that most parameters are already tuned and nothing needs to be done.

More enabled options do not necessarily mean better performance. For example, in my current laptop adding the '-u 1' flag actually makes the latency worse. Speaking of laptops with relatively recent hard disks, or hard disks that have ``acoustic management'' you should try ``/sbin/hdparm -M /dev/hda'' (assuming hda is your drive) to see if the drive understand the ``acoustic management'' interface. If it does you will get a boost in performance by using the '-M 254' parameter in your configuration file (at the cost of more seek noise).

And do not forget the hardware itself, in particular the cable connecting the drive to the motherboard. To use the newest high speed modes you will need to have a good quality 80 conductor cable, older 40 conductor ones will not give you the best speed (thanks to Martin Rocamora for this tip).

Once you are satisfied with the optimization you have selected you can change the /etc/sysconfig/harddisks configuration file to put your selected options there so they are activated automatically when you boot the computer.

See this page for the gains you can obtain by tuning your EIDE hard disks.

A nice article about hdparm and how to use it.

Don't forget your cdrom

The Fedora boot process only optimizes hard disks. You can and should also optimize your cdrom (if it is EIDE). To see the current settings for your cdrom (assuming it is hdc) type:

/sbin/hdparm /dev/hdc

You will probably get some lines with data, and some ``Input/Output errors''. Those errors correspond to things the cdrom drive cannot do, so you can safely ignore them. Most probably you will be able to use dma and use 32 bit transfer modes and that's probably enough. To get that to be permanent copy /etc/sysconfig/harddisks to /etc/sysconfig/harddiskhdc (if your cdrom is hdc) and tune the parameters there according to the test you just did.


Interrupt priority and the PCI latency timers

I plan on writing something simple and clear about these two important issues. They can have a huge impact in the latency you can get out of your system.

For now it is enough to say that it pays big time to try to set up your audio card to use one of the highest priority interrupts. You can find more details in this thread of the ardour-dev mailling list. The third response (from Mark Knecht) is particularly useful. On some motherboards you can actually use the BIOS to configure which interrupts go to which card slots, but that is not very common. Most of the time you will have to swap cards till you find the right combination.

Another issue is how the different cards and devices that are connected to the pci bus actually share (or not) it. It is possible to tell a card to use ``less'' pci bandwidth (or more) and significantly improve the overall performance. Please read this article by Daniel Robbins, it is a case study that includes very clear explanations of what is going on underneath the hood of your pc.


CDROM polling

Some desktop environments periodically poll the cdrom drive to find out if a cdrom or cd has been inserted (and then automount it, or execute programs, or start a cd player application). Polling the cdrom can take a substantial ammount of time and might introduce latency hits (I never noticed this because I always disable cdrom polling, I like to mount things manually). So go to the control panel of your favorite desktop and disable this feature if you want to do low latency work.

If you use Gnome go to ``Settings'', then ``Peripherals'' and finally to ``CD Properties''. Turn off ``Automatically mount CD when inserted'' and ``Run command when CD is inserted''.



Subsections
next up previous
Next: Installing Planet CCRMA on Up: Planet CCRMA at home Previous: Installing Planet CCRMA on

© Copyright 2001...2008 Fernando Lopez-Lezcano, CCRMA, Stanford University.
All rights reserved.