[proaudio] Gentoo DAW HOWTO - 0.2

[ Thread Index | Date Index | More lists.tuxfamily.org/proaudio Archives ]


OK, I had been able to finish it :)
I decided to relase it under Creative Commons Attribution Sharealike 2.5.
This should be ready to be put in the wiki as a starting point. Feel
free to use and modify it.

I'll port it to Gentoo forums too, to see if anybody else will give
contributions/suggestions/corrections, OK?
Any feedback is welcome (specially for the parts I wasn't able to complete)


Paolo





*************************




If anybody is interested on this subject, please give me some feedback,
so that I know what is more interesting to be published (focusing on
installation processes, the various kind of programs, tips about EQing,
plugins, mastering, etc).
Please, don't write about application bugs on this thread. Open a new
one or write directly to Gentoo bugzilla.

UPDATED:
14th May 2006: English translation (it will have the priority over the
original Italian one). Added some programs to be tested to the list.
15th May 2006: Relased under
[url=http://creativecommons.org/licenses/by-sa/2.5/]Creative Commons
Attribution Sharealike 2.5[/url]

[i]Note:[/i] Because my
[url=http://forums.gentoo.org/viewtopic-t-228122.html]old Italian
HOWTO[/url] was taken and copied around the web (and it's been quite
frustrating), I decided to relase it under
[url=http://creativecommons.org/licenses/by-sa/2.5/]Creative Commons
Attribution Sharealike 2.5[/url].
I expect from who decides to modify, copy or redistribute it:
- At least the link of this forum post or
[url=http://proaudio.tuxfamily.org/wiki]of evermind's overlay wiki[/url]
I discuss about in the HOWTO
- Give me credit
- Give credits to those I gave credits

Sorry if it sounds harsh to someone, but I think it sounds pretty fair
and straight forward.


#####################


[b]Introduction[/b]

This HOWTO would be a (little?) overview about how it could be possible
to use Linux (I'll focus on Gentoo Linux) as an Hard Disk
Recording/Mastering Workstation.
I hope, after finishing that, to be able to give some misc tips, for
example about how to use your Gentoo box as part of your multi-effects
rack for live performances and stuff like that (any suggestions are VERY
appreciated!)

I know very well there's A LOT of work to be done to reach the quality
of the ultra-expensive MAc or Win professional softwares (and their
quality continues to increase...), but you'll see that our penguin is
already able to let us produce decent audio productions (demos, simple
soundscores, etc)

Before starting Ialso want to warn you that most of the software I'll
talk about are still in beta (or even alpha) versions... So keep in mind
they could crash or even lead your whole system to a crash.

Our Workstation will be made at least by the following elements:
[list]- Low Latency Sound Server (Jack)
- SEQUENCER (Rosegarden) + DRUM MACHINE (Hydrogen)
- MULTI-TRACK Editor/Recorder (Ardour)
- DSP MultiEffects (LADSPA plugins and VSTi/VST Plugins under Rosegarden
and Ardour)
- AUDIO EDITOR (Rezound)
- MASTERING Software (Jamin)[/list]


[b]PREREQUISITES: [/b]
- I'll suppose your workstation has a working audio card, with working
ALSA drivers.
This HOWTO has been written for Gentoo-Linux with 2.6 kernel, but could
be easy adapted to other distros with different kernels (I'll discuss,
for example, how to configure a 2.4 kernel, that were better than early
2.6 kernels regarding latency)
- I HIGLY reccomend you to use the unstable (~arch) versions of all the
programs I'll discuss here.
So be always ready to run a [code]nano
/etc/portage/package.keywords[/code] to add the application you want to
install.
I know that won't ensure you a 100% reliability, but the new features
(an example was the introduction in some programs of DSSI, VST support,
etc) introduced by the latest versions are often too much important if
you want to be productive.

Another good reason to do that is that, if you find something wrong, you
can make a good bug report that will help the whole community (the
number of musicians doesn't seem to be too high, in fact)


[b]INSTALLATION OF
[url=http://forums.gentoo.org/viewtopic-t-427211.html]EVERMIND's
OVERLAY[/url][/b]
What is this?
It's a portage Overlay with tweaked and more updated versions of most
Linux Audio-related programs. Here you'll find almost everything you
need for at least a simple home-recording (or, off course,
studio-recording, if you will go deeper with the subject)

Even if I'll try to write step-by-step instructions
, I suggest you to check these links about
([url=http://svnweb.tuxfamily.org/filedetails.php?repname=proaudio+%28ckpp%29&path=%2F00-README&rev=0&sc=0]overlay
installation[/url],
[url=http://svnweb.tuxfamily.org/filedetails.php?repname=proaudio+%28ckpp%29&path=%2F00-OVERLAY-INFO&rev=0&sc=0]base
packages installation[/url] and
[url=http://svnweb.tuxfamily.org/filedetails.php?repname=proaudio+%28ckpp%29&path=%2F00-PACKAGES-LIST&rev=0&sc=0]packages
list[/url])

- Let's start by installing subversion:
[code]emerge subversion[/code]
- Then let's checkout the overlay
[code]mkdir /usr/local/portage-proaudio
cd /usr/local/portage-proaudio
svn co svn://svn.tuxfamily.org/svnroot/ckpp/proaudio[/code]
Note that I created the /usr/local/portage-proaudio dir. Obviously, you
can choose any name/destination you like.
- Now let's add the overlay in /etc/make.conf
[code]PORTDIR_OVERLAY=""
PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/portage"
PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/portage-proaudio"[/code]
If what I wrote above semms voodoo-magic, take a look
[URL=http://gentoo-wiki.com/HOWTO_Installing_3rd_Party_Ebuilds]here[/url],
so you'll be able to manage your overlays, if you already have more than
one.
- To update the overlay, you just have to do:
[code]cd /usr/local/portage-proaudio
svn up[/code]

Note: Sometimes it may happen you obtain error messages like "digest
verification failed". That happens when someone forgets to re-digest
ebuilds when they submit them. To solve that (supposing your package
name is foo), a
[code]cd /directory/of/the/ebuild/foo
ebuild foo.ebuild digest[/code]
should be enough to solve the problem.


[b]Sound Server (jack) configuration[/b]

Jack is an audio-server made to work with low-latency. Unlike other
famous sound-servers (Arts, ESD, Gstreamer, etc), it has some features
(and we'll discover some of them, such low latency, flexible audio
routing between applications, AUDIO/MIDI syncronization during this
HOWTO) that make it a core compoent of a Linux DAW.

[b]- Instrucions for [size=18]2.4 Kernels[/size] (OBSOLETE) [/b]
Before compiling it, we need to make the following modifications:
[code]Processor type and features --->
[*] Preemptible Kernel
Device Drivers --->
Character devices --->
<*> Enhanced Real Time Clock Support
Sound --->
Advanced Linux Sound Architecture --->
<*> RTC Timer support[/code]
Because it's a good idea to use Jack (and all the applications that
depend on it) as normal user, but we don't want to lose real time
scheduling advantages, we need to activate "POSIX draft capabilities"
(called, more commonly, caps).
That's not difficult, we just need to modify a configuration file.

The file to modofy is:
[code]/usr/src/linux/include/linux/capability.h[/code]
Let's look for the following 2 lines:
[code]#define CAP_INIT_EFF_SET to_cap_t(~0 & ~CAP_TO_MASK(CAP_SETPCAP))
#define CAP_INIT_INH_SET to_cap_t(0)[/code]
Now, change them to:
[code]#define CAP_INIT_EFF_SET to_cap_t(~0)
#define CAP_INIT_INH_SET to_cap_t(~0)[/code]

If you don't like to edit files by hand, you can try this patch:
[url]http://nospoof.de/linux/patches/posix-draft-capabilities.patch[/url]
(the link should be correct, but I've never tried it)

IMPORTANT: Every time we install/reinstall a new/different version of
kernel sources, we need to remember to make this operation manually, or
the new kernel won't be "caps-enabled", OK?


[b]- Instructions for [size=18]2.6 Kernels[/size][/b]
[color=red](WARNING: THIS PART OF THE GUIDE MUST BE UPDATED, because
realtime-lsm is discouraged. The recomended method is to use
sys-libs/pam with rt-limits activated. It can be found on the overlay.
If anybody could give me some documentation, I'll be able to integrate
it here immediatly, or you'll have to wait I'll learn to use/test it
before putting it on this HOWTO)[/color][/b]

If you already did the changes written above, then you better undo them :D
If you don't want to do that, rimply re-emerge your favourite
kernel-sources.
(the command jackstart would work anyway, but I noticed performances
were better with the following method)

In 2.6 kernels, in fact, there's a new way to allow users to perform
real-time tasks; let's see how to enable it:

First let's compile the kernel we like with the following options (this
is not the translation of the Italian guide I wrote, but it's taken from
[url=http://demudi.agnula.org/wiki/Low-latencyKernelBuildingHowto#Configuringthekernel]this
link[/url])


Low-latency specific configuration

You should set these voices in the kernel configuration to achieve good
low-latencies performances:

[code] Processor type and features --->
Preemption Model (Preemptible Kernel (Low-Latency Desktop))
[*] Preempt The Big Kernel Lock
Timer frequency (1000 HZ) [/code]

and:

[code] Block layer --->
IO Schedulers --->
<*> Anticipatory I/O scheduler
<*> Deadline I/O scheduler
<*> CFQ I/O scheduler
Default I/O scheduler (CFQ)[/code]

JACK needs support for the tmpfs pseudo file system to achieve good
performances:

[code] File systems --->
Pseudo filesystems --->
[*] Virtual memory file system support (former shm fs) [/code]

The RTC can be needed by some applications, is better to compile it:

[code] Device Drivers --->
Character devices --->
<M> Enhanced Real Time Clock Support
<M> Generic /dev/rtc emulation
[*] Extended RTC operation [/code]


The IDE sub-system can be a bottleneck if not properly configured. As
pointed out by Con Kolivas in his
[url=http://ck.kolivas.org/faqs/audio_hints]Audio Hints[/url], you
should set the following config option for your ATA drive (relevant on
and off options are showed):

[code] Device Drivers --->
ATA/ATAPI/MFM/RLL support --->
<*> ATA/ATAPI/MFM/RLL support
<*> Include IDE/ATA-2 DISK support
[*] Use multi-mode by default
[ ] IDE Taskfile Access
< > generic/default IDE chipset support
[*] PCI IDE chipset support
[*] Generic PCI bus-master DMA support
[*] Use PCI DMA by default when available
<*> Intel PIIXn chipsets support[/code]

The latest config option is just an example and, almost certainly, you
have to change it to reflect your hardware (again lspci -v will tell you
which chip-set you have).


Finally, if you want to use the realtime-lsm module to grant realtime
privileges to normal user you should also set:

[code] Security options --->
[*] Enable different security models
<M> Default Linux Capabilities [/code]

If you don't find that voice, make sure in your
[code]/usr/src/linux/.config[/code] there are the following lines (as
written in realtime-lsm documentation):
[code] CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_SECURITY=y
CONFIG_SECURITY_CAPABILITIES=m
CONFIG_SECURITY_SELINUX=y [/code]
[b]It's VERY IMPORTANT that CONFIG_SECURITY_CAPABILITIES is compiled as
a module, or the patch WILL NOT WORK[/b]

Now let's compile the kernel as always, with a:
[code]make && make modules[/code]
copy the new bzImage in /boot, reinstall the bootloader, etc etc, then
let's install the patch [b](we need to redo that each time we recompile
the kernel)[/b]
[code]emerge realtime-lsm[/code]
Let's complete the module installation with:
[code]make modules_install[/code]

To have the patch working from boot time, I added this line to
/etc/modules.autoload.d/kernel-2.6
[code]realtime gid=18[/code]
NOTE: The gid 18 is necessary, because it's the number given by default
to audio group in Gentoo; you can experiment with any other group. An
alternative approach would be to use the option any=1, but remember it
could give some security problems, because you would allow every user to
launch programs with realtime priority (and, if something goes wrong, it
could crash the whole system :-D)

There are some other interesting options you can try, but I wont discuss
them here. simply take a look in
/usr/portage/distfiles/realtime-lsm-number-version, or read
[url=http://jackit.sourceforge.net/docs/faq.php]jack FAQ[/url]


NOTES:
A) I read that kernel preemption support decreases realtime performances
for Sound Server (Jack). But, because we're musicians, we also have to
use lots of applications in multi-tasking and it would be frustrating to
wait 3 secs to switch from sequencer to multi-track editor... So I think
it's an important feature. Don't you think?
B) I also read that aggressive settings for hdparm could increase
latency too (somebody said at least 59 ms!! TOOO MUCH FOR A MUSICIAN!).
Honestly, I use hdparm only to have DMA mode on My various Hard Disks,
so I don't have problems.
So, if you find your latency too high, keep in mind this suggestion.


[b]Important note about ALSA[/b]
DON'T use alsa-modules included on your kernel sources. Just follow the
official Gentoo guide (that suggests to use the alsa-driver package).
You'll find it here:
[url=http://www.gentoo.org/doc/it/alsa-guide.xml]qui[/url].
Why?
If you have a professional audio-card, maybe you'll need the package
[code]alsa-firmware[/code], whose version must be the same of the
installed alsa-driver or you may have problems.
Alsa modules included on your kernel sources may be older than current
alsa-driver (and alsa-firmware)


[b]- Installation of jack[/b] (note we're using the overlay version, not
the portage one)
Once installed the new kernel, rebooted, etc etc, we're ready to install
Jack; remember we'll need the following USEFLAGS (add them to make.conf
manually or with ufed or remember to specify them before every emerge)
[code]USE=”+caps,+jack,+jack-tmpfs”[/code]
now let's install jack and its dependencies:
[code]emerge sys-libs/libcap
emerge alsa-lib
emerge alsa-jack
emerge jack-audio-connection-kit [/code]
I repeat once again it's better to use the latest unstable (~arch)
version... But who have to decide is you.


If you find too many xruns when working with audio-programs, you could
add to try these lines to your /etc/fstab
[code]#questa riga dovrebbe già esser presente
shmfs /dev/shm shm defaults 0 0
none /tmp/jack tmpfs defaults 0 0 [/code]
Then, after creating the /mnt/ramfs dir:
[code]mkdir /mnt/ramfs [/code]
add this line too
[code]
none /mnt/ramfs tmpfs defaults 0 0 [/code]
(you can understand why that gives better cjak performances by reading
the FAQ on Jack's homepage:
[url]http://jackit.sourceforge.net/docs/faq.php[/url] )

Now let's test if jack works:
[code]jackstart -v -R -d alsa -H -M -m[/code]
[color=red]IMPORTANT: DON'T SCROLL THE WINDOW! IT COULD CRASH YOUR
SYSTEM!! If something goes wrong, simply press ctrl+C, OK?[/color]

[b]Note for 2.6.x Kernels:[/b] use jackd instead of jackstart or it'll
give you an error message (it'll say you need capabilities anabled...
but if you folowed the guide, now you're using a perfectly configured
2.6 kernel! :D)

Now, if you want, you can use jack from commandline (for example to
launch it on boot time), so read carefully
[code]man jackd[/code]
that can avoid you some future headcaches.

But, believe me... it's not too much comfortable!
That's the reason why I suggest you to use qjackctl:
[code]emerge qjackctl[/code]
This is a frontend to control Jack and its connections between programs.
But we'll see that in the following part of the guide.

The only thing I can tell you, for now, is that it must be executed
BEFORE other audio apps (or they won't work.)


[b]INSTALLATION OF THE MOST IMPORTANT PACKAGES FROM THE OVERLAY:[/b]

[b]VST Support[/b]
[i]What is a VST plugin?[/i] Without being too much technical, I can say
VST is a plugin format used by most Win/Mac audio-related applications.
It allows you to use inside your program (called host) real time
effects, virtual synths and other things. If you are interested and want
a more detailed explanation, take a look
[url=http://en.wikipedia.org/wiki/Virtual_Studio_Technology]here[/url].
[i]Do I really need that stuff? I [b]hate[/b] Wincows, Micro$oft and
Macintrash![/i] Yes. You need it. Just take a look at
[url]http://kvraudio.com[/url] to see how many tons of free plugins
(some are really really good!) you can have access to.
[i]How could it be? Sounds like magic; I suppose I didn't understand
anything[/i]
There are at least 2 systems to use VST plugins under Linux:
-dssi-vst: it's a dssi plugin (so the host you're going to use must
supporte DSSI!) that can make use of VST plugins. To do that, it uses
Wine, DSSI headers and Steinberg VST SDK headers (VST protocol, in fact,
was created by Steinberg)
-fst: it's a server that, with the combination of Wine, Jack and
Steinberg VST SDK, allows you to use VST plugins under Linux
-[url=http://www.notam02.no/arkiv/src/]Vst server[/url]. This should be
the first program who gave VST support to Linux. I did never understand
how to use it, so if you know how to, please write me a note, so I can
add it to this documentation.
[i]OK, it sounds cool. What do I have to do?[/i] First go here
[url]http://www.steinberg.net/532+M52087573ab0.html[/url], read the
agreement and download the 2.3 version of the SDK (or a following one,
depending on what the overlay will require by the time you read this).
If the link doesn't work anymore, go to Google to find the vstsdk2.3.zip
file (it's part of the vst_sdk2_3.zip archive).
Remember that [b]YOU CANNOT REDISTRIBUTE IT[/B], SO READ CAREFULLY THE
AGREEMENT I told you above. If you don't like it, simply don't use it
(and you won't have VST support).

Once you found vstsdk2.3.zip (good luck), copy it in
[code]/usr/portage/distfiles[/code]
Now add to your [code]/etc/make.conf[/code] the following (new)
useflags:[code]dssi vst jackmidi[/code]
(I know you just need the vst USEFLAG, but I prefer to set them all at
this stage). This should be enough to let you have that support in
Ardour, rosegarden and other important applications.

NOTE: museseq may not compile with fst-1.7, so, if it gives you
problems, try to install it with a [code]USE=-vst emerge museseq[/code]


[b]Lash and Ladcca[/b]
Almost all the newest audio applications now use
[URL=http://www.nongnu.org/lash]Lash[/url], instead of
[url=http://pkl.net/~node/ladcca.html]Ladcca[/url]. After recommending
you to take a look at their web sites, I also suggest to remove ladcca
(emerge -C ladcca) and re-emerging your (~arch) version of wkeybd,
jack-rack and museseq so they'll use Lash libraries.

[b][url=http://www.rosegardenmusic.com]Rosegarden[/url] (sequencer)
installation[/b]
With this one we can start to be a bit productive... Rosegarden is an
audio and MIDI sequencer, based on KDElibs+QT (sorry for the users who
hate this DE :-P). In the beginning it was written only to manage/edit
MIDI files, but now audio support has been integrated (OK... it cannot
be compared to Cubase or Sonar... But... It's growing quite well). It
also have a good score editor, that allows you to export files to
[url=http://www.lilypond.org/]Lilypond[/url] and nice editing features.

So, if you want to start using it, you just need to do an
[code]USE=”+jack +dssi” emerge rosegarden[/code]
(remember I suggest you to use the latest ~arch version).
On the overlay you'll also find rosegarden-cvs. Take a look at it too,
because audio support is getting better and better in newest relases
Why did I add DSSI useflag?
DSSI is a "temporary" API for wirtual instruments with a GUI. Without
going deep in details, I'll just tell you there are some nice virtual
synths using it and that there's an extra-plugin that lets you use VSTi
and VST plugins under rosegarden (or other DSSI-compatible hosts), but
if you read this guide carefully, you already know that. Take a look at
[url]http://dssi.sourceforge.net/[/url] for further informations.

Remember that, if you want audio support, you have to run jackd BEFORE
Rosegarden. It would be a good idea to run it through qjackctl.


[b]Ardour Installation (multi-track audio editor)[/b]
If you need VST support, you just have to do a
[code]USE=vst emerge ardour-cvs[/code]
If that gives you problems, try to emerge ardour instead of ardour-cvs
(I prefer the cvs version).
You can also try to emerge ardour2-cvs if you want a bunch of new features.



[b]Interesting Virtual synths[/b]
zynaddsubfx: Real time Virtual Analog synth
fluidsynth: MIDI virtual Synth based on SoundFont. You can use it either
via qsynth (a nice QT GUI) or via his DSSI version, called fluidsynth-dssi
hexter: A Yamaha DX7 reprodution via DSSI. It can also import your old
Yamaha DX5 and DX7 patches. Take a look if you need a nice FM synth
hydrogen: A very good drum machine
ams: Alsa Modular Synth (still have to try it)
amsynth: another virtual synth that seems to sound very nice (I found
filters to be a bit "cold", but I still have to experiment well with it)
Csound: As the homepage says: "Csound is a sound and music synthesis
system, providing facilities for composition and performance over a wide
range of platforms". Ehm... Still have to try it too :D


[b]Rezound (audio editor) installation[/b]
If you need to cut&paste samples, resample, apply offline effects,
remove noise, to put quickly your latest demo on a CD, converting it to
mp3, ogg and other things, a sequencer couldn't be enough... You need an
audio editor!
Lots of people use Audacity, because it's muti-platform, it's well
known, etc etc. Well, I really hate it. That's why I suggest to try
rezound. First because I find its GUI is more intuitive, second because
it can use jack as an output.

To install it, a
[code]USE=”+jack” emerge rezound[/code]should be enough. Feel free to
add other USEFLAGS you may need (emerge -pv rezound to have a complete
list).
Once again, I recommend to put rezound and its deps to
/etc/portage/package.keywords so you can use the latest version.


[b]Jamin installation[/b]
Jamin is a "simple" mastering suite, made by a multi-band compressor and
a 30-bands EQ. As all the other mastering suites, it requires you know
very well what you're doing.
You can install it with a simple [code]emerge jamin-cvs[/code] (or
jamin, if you don't want the cvs version).
Remember that mastering is the final stage of the audio-production
process, so, when you route the signal via qjackctl, insert jamin right
before the ouutput you want to send audio to. (Jamin is used as an audio
effect, so it must be used in real time with jack! you cannot import,
for example, wave files on it to modofy them!)

Mastering is a very important aspect of music production, because it
decides how your music will sound when played all around the world (from
the ultra-expensive stero to the cheapest walkman or mp3 player).
That's why you need a studio and amplification system made just for
mastering. If you don't have it... Well... You better give your precious
single to a studio specialized in mastering ;)


TODO:
- Adding at least a part of ,
[url=http://demudi.agnula.org/wiki/Low-latencyKernelBuildingHowto]
this[/url],ande [url=http://ck.kolivas.org/faqs/audio_hints] this guide
[/url], tweaking them to work with Gentoo and the overlay (adding an
rt-sources HOWTO?).
- tips on EQ, mixing, mastering, automation
- an introduction to the main effects used during HD recording
(flangers, reverbs, panning) and how/when to use them
(help appreciated)
- To insert other programs, after testing them: Wired (DAW with
nativeakai support), Seq24 (light sequencer for live performances),
Bristol (moog emulator, etc)


CREDITS:
Jack-audio-connection-kit HOWTO:
[url]http://forums.gentoo.org/viewtopic.php?t=88781&postdays=0&postorder=asc&start=0[/url]
Jack Homepage:[url]http://jackit.sourceforge.net/[/url]
Evermind's post about his overlay and related links
[url]http://forums.gentoo.org/viewtopic-t-427211.html[/url]



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/