Pro Audio
From ArchWiki
Contents |
[edit] Introduction to Professional Audio (Pro Audio) in Linux
Modern Linux/GNU systems are more than capable of supporting your professional audio needs. Latencies of 5ms and down as low as 1ms can be achieved on a properly configured machine. There also are a wide variety of applications available to suit whatever task you may need to perform.
- Jack is a sound server that handles the communication between applications and sound cards,and has the ability to run in realtime. It is available in the jack-audio-connection-kit package. There are lots of other applications that work in conjunction with Jack, such as Jack-rack and Jack-eq.
- LADSPA is a plugin system that provides professional reverbs and effects.
- Ardour is ideal for multitrack recording. Traverso is a nice recording application as well, and deserves support.
- Other applications that may be of interest include Rosegarden (audio and MIDI sequencer, score editor, and general-purpose music composition and editing application) and Hydrogen (an advanced drum machine/pattern editor with midi support).
Some resources:
- Linux equivalents to popular commercial software.
- The Arch Linux professional audio IRC channel on Freenode at #archlinux-proaudio.
- This long-running thread http://bbs.archlinux.org/viewtopic.php?id=30547 has lots of useful information.
[edit] Starting up
To start working with ProAudio:
- Add the proaudio repo to your pacman.conf:
- [proaudio]
- Server = http://arch.madfire.net/proaudio/i686
- pacman -Syu
- install applications of your choice
- pacman -S ardour rosegarden qjackctl etc.
- start and configure qjackctl (see guide below)
- open ardour or rosegarden
- start learning the apps
- enjoy!
The packages in the ProAudio repo are also available via SVN. These packages can be modified by the community, then checked and pushed to the ProAudio repo. This breaks the reliance on one maintainer keeping the builds up to date. Please contact us on the IRC channel if you would like to become a project member.
[edit] Tuning and Configuration
The following are guides to get your system running properly. Keep in mind that all machines are different, and that the Linux world is a rapidly changing environment.
[edit] Using hdparm to tune up hard discs
In order to get good performance you need the best read/write times possible out of your hardware. Here are a few tips to max out performance.
First and foremost *BACK UP YOUR DATA* before changing settings! I also recommend using sudo, but it's your machine/data so do as you like.
Drop back to single user mode by issuing the command
- $init 1
Get an initial test to benchmark your drives
- $hdparm -Tt /dev/hd?
You may want to even output this to a file for reference
- $hdparm -Tt /dev/hd? > initial_test
Now you can check your drive settings
- $hdparm -v /dev/hd?
We are looking for four things here, and you may need to experiment a bit to find what optimal for you.
First find out what your drives maximum multicount setting should be
- $hdparm -i /dev/hd? | grep MaxMultiSect
multicount: Mine is 16.
IO_support: This is an important one, and I set mine to 3 (32-bit w/sync). Some drives may support 32 bit w/async.
unmaskirq: This one you may want to experiment with. Although I noticed no benefit others claim to have.
using_dma: This needs to be set to 1
So to apply the new settings
- $hdparm -c3 -m16 -d1 /dev/hd?
Test your drives again and compare them against your original settings. These changes will not survive a reboot, so if your results are better add the commands to /etc/rc.local
- hdparm -c3 -m16 -d1 /dev/hd? > /dev/null
Adding the "noatime" option in /etc/fstab may also improve disk performance.
[edit] Setting up Jack
Qjackctl is a nice frontend for Jack and is recommended. The most important settings are realtime,sample rate,frames/period and periods/buffer. Realtime should be enabled for any real work to be done. I recommend leaving periods/buffer at 2. Sample rate is dependent on you hardware, and the setting in jack MUST match the setting on your hardware. For example if I set jack to 48khz and my delta1010 is set to 96khz I will get xruns out of control. The key here is to find the lowest latency possible with no xruns, so experiment with frames/period and sample rate until you get in the zone. The other settings can be potentially useful as well, and are described excellently here: http://w3.linux-magazine.com/issue/67/JACK_Audio_Server.pdf
You may also want to modify the way jack writes it's tmp files. This requires building the package with ABS.
Edit the jack-audio-connection-kit PKGBUILD by adding the following to the build section
- --with-default-tmpdir=/tmp/jack
Modify /etc/fstab
- none /tmp/jack tmpfs defaults 0 0
[edit] Setting IRQ Priorities
When working with audio in realtime mode you want to bump the critical priorities up. First move up jackd's priority by running
- $chrt -f -p 89 `pidof "jackd"`
We want jackd second in line behind the soundcard, so let's bump the soundcard up too.
- $cat /proc/interrupts
will show you what IRQ your card is on. Now move the soundcard up with
- $chrt -f -p 99 `pidof "IRQ-??"`
Optionally you could add these commands to Qjackctl's configuration in the "execute scripts after startup" field in options.
- chrt -f -p 89 `pidof "jackd"` && chrt -f -p 99 `pidof "IRQ-??"`
You also could add this to /etc/rc.local, but be aware that your soundcard might not always be on the same IRQ.
[edit] Realtime Kernel ( kernel26rt )
There is a patched kernel available in the proaudio repo as well as the AUR. The current version seems to have some stability issues because of it's experimental nature. Kernel 2.6.22.1 patched w/ patch-2.6.22.1-rt9 seems to be the best performing version at the moment.
A few notes on rt kernel configuration:
ACPI and apm should be disabled, either in the config or by adding acpi=off to your bootloader. Disabling kernel debugging seems to reduce some overhead. If you system supports hyperthreading test the rt kernel w/ it disabled in the BIOS. Also verify that irq_balancing is disabled as well.
The irqbalance package in the AUR is much better than the support in the kernel on multi cpu systems, and can really make a huge difference.
More information:
[edit] Realtime priority for users
You must be in the audio group for user realtime. The file /etc/security/limits.conf should look similar to this:
- @audio - rtprio 99
- @audio - nice -10
- @audio - memlock unlimited
This example is pushing it hard, but if you are getting good performance and not choking out other processes it's ok. Experiment.
[edit] Hardware Specific Information
This section is for details on using and configuring audio devices.
[edit] The M-Audio Delta 1010
This hardware requires that you install the alsa-tools package from the AUR, because it contains the envy24control program. Envy24control is a hardware level mixer/controller. You can use alsa-mixer but you will save yourself some hassle not to try it. Note that this section has no information on MIDI setup or usage.
Open the mixer application:
- $envy24control
This application can be more then a bit confusing, and I am yet to find a reasonable tutorial for its use. That said, here is a working setup for multitracking with Ardour.
- Set all monitor inputs and monitor PCM's to around 20.
- Patchbay/router tab: Set all to PCM out.
- Hardware Settings: Verify that the Master Clock setting matches what is set in Qjackctl. If these do not match you will have xruns out of control!