Music Studio
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Musicians nowadays use computers to compose their songs. Linux has had tools for creating music for quite some time, but not every part of setting up a working musician's studio seems to be obvious. This HOWTO will try to help you setting up a music studio ready for mixing, effects processing and composing of music.
[edit] Introduction: what will we use?
The keyword in linux music studios is jackd. jackd (part of media-sound/jack-audio-connection-kit) is a server which aims to virtualize the world of jack connections. In practice, it provides you low-latency interfaces to audio hardware and software. jackd is a server to which clients (both audio-in and audio-out) connect to exchange their sounds. jackd then sends sounds to alsa's drivers as needed to actually get you some music.
Of course, we'll also need some audio software (just a virtual jack plugging device doesn't suffice ;-)). For example, Rosegarden, Ardour and vkeybd could be useful. If your audio card lacks a midi device, we'll need to add some timidity magic. A little bit of kernel configuration will probably be mandatory.
[edit] Assumptions
Your everyday user is called john, and he's in the audio group. ALSA works and is compiled into the kernel. You have followed the official gentoo realtime guide and user john has those discussed realtime capabilities. Your ALSA configuration is in /etc/asound.conf (as opposed to ~/.asoundrc).
[edit] Disadvantages
- Unless you have an audio card with hardware mixing capabilities, you will not be able to use applications that aren't jackified. MPlayer is, for example, but adobe's Flash isn't.
- Your system's security might be affected by the needed realtime capabilities.
[edit] Configuring your kernel
There's not a lot to configure about your kernel, except for the discussed realtime capabilities and your midi hardware devices, if you have any. For example, a piano keyboard which is connected to your computer is a midi device. If you don't know, you can probably skip this step.
If your midi device is a USB device:
| Linux Kernel Configuration: USB Midi device configuration |
Device Drivers --->
[*] USB support --->
Sound --->
Advanced Linux Sound Architecture --->
<M> Advanced Linux Sound Architecture #module or compiled into your kernel, i don't care, as long as it's usable.
USB devices --->
<M> USB Audio/MIDI driver #again, i don't care how you build it, as long as you can use it.
|
If your midi device is not a usb device and has a normal midi connector:
| Linux Kernel Configuration: Analog Midi device configuration |
Device Drivers --->
#Something should be configured here, but I don't have a friggen idea what.
|
| FIXME: normal midi device kernel config |
If you have a MIDI hardware device, you should now be able to use it. Rosegarden (will be discussed later) will automagically recognize it, but you may have to connect it to Rosegarden in qjackctl.
[edit] Installing jack
Installing jack is quite easy:
# emerge -av media-sound/jack-audio-connection-kit
For those who like GUIs, consider installing qjackctl:
# emerge -av media-sound/qjackctl
Please make sure you have the jack USE flag enabled globally, unless you know what you're doing (and are being an optimization *ss)
[edit] Installing alsa plugins
For jack to work, we'll need media-plugins/alsa-plugins to be installed.
# emerge -av media-plugins/alsa-plugins
[edit] Installing editing software
There is tons of software for doing audio work in linux, much of it in Portage. Below is a shortlist of things generally considered good.
| Name | Description | Compare with | Overlay |
|---|---|---|---|
| Ardour | Very powerful hard disk multi-track recording software | Protools | |
| Audacity | Easy-to-use audio editor and recorder | ||
| Csound | Audio programming language with a bajillion opcodes | SuperCollider | pro-audio |
| Hydrogen | Linux advanced drum machine | ||
| Jack-rack | Effects rack that works over JACK | ||
| Jamin | Real-time jack audio mastering | ||
| Lilypond | The stand-out sheet music typesetter | Finale, Sibelus | |
| Meterbridge | Jack meter app using SDL | ||
| Rosegarden | MIDI sequencer with a gentler learning curve | ||
| Sox | "The swiss army knife of sound processing programs" |
Note that much of this software in portage has a other versions in the overlay (including a number of live ebuilds for those that like to live on the edge).
| FIXME: Find more useful apps. |
[edit] Setting up ALSA
We'll need to add a small section for jackd to work with ALSA:
| File: /etc/asound.conf |
pcm.jackplug {
type plug
slave { pcm "jack" }
}
pcm.jack {
type jack
playback_ports {
0 alsa_pcm:playback_1
1 alsa_pcm:playback_2
}
capture_ports {
0 alsa_pcm:capture_1
1 alsa_pcm:capture_2
}
}
|
There's no need to restart ALSA, this file is read at play time.
[edit] Starting jackd
Obviously, what we want is a setup in which we only need to start one application to launch the entire studio, but for troubleshooting purposes we will first try to launch on a per-program basis.
$ jackd -R -d alsa
If you can't start jackd, please make sure no application is currently using ALSA, as jackd will, depending on whether you have hardware mixing (if you do you're lucky!), want exclusive access to your ALSA hardware device.
[edit] Starting Rosegarden
Now, we're basically done with configuring our setup. If you are using gnome, you can find Rosegarden in Applications->Sound & Video->Rosegarden.
| FIXME: Where can this be found in KDE/XFCE/anything? |
Of course, you can also simply start rosegarden from your terminal:
$ rosegarden
Does everything work all right? You'll probably get messages about XML-Twig missing, as well as KDialog. Those packages are needed for certain exporting features. If you want those, feel free to emerge them:
# emerge -av dev-perl/XML-Twig kde-base/KDialog
Now that Rosegarden itself works, you might already be there. If you only want to compose music, and have hardware with everything you need, you should basically be done now. However, if you don't have midi hardware, for example, you'll need some software emulation of that. Keep on reading.
[edit] Virtual MIDI output
For virtual MIDI output, we'll use timidity++. There's an official guide about this, but that's only useful when you don't use jack. We DO use jack, so we'll need a different approach. Get started by emerging timidity++
# emerge media-sound/timidity++
Normally, timidity++ is used to play one midi file. However, we want to use it as a kind of daemon. To do this, simply run (with jackd running!):
$ timidity -iA -Oj
Yep, that's it. Virtual MIDI output should be setup for you now. If you have a global ALSA timidity daemon running as well, please make sure to select the right one in rosegarden.
[edit] Virtual MIDI Piano
If you don't have a real MIDI piano (it's a real pleasure if you're serious about music composing), you can use media-sound/vkeybd instead.
# emerge -av vkeybd
If you're using Gnome, you can now find vkeybd in Applications->Sound & Video->vkeybd. Make sure jackd is running before launching vkeybd. Controlling vkeybd isn't unusual, but it's not obvious either. It assumes that you are using the qwerty keyboard layout. Check its man page for more information (man vkeybd).
| FIXME: Where can this be found in KDE/XFCE/anything? |
[edit] Starting the entire studio at once
Make a new file called musicstudio wherever you want in your normal user's home directory (I chose to install it in ~/bin/). In it, put the following:
| File: ~/bin/musicstudio |
jackd -R -d alsa & sleep 1 #it takes a little bit of time to start jackd timidity -iA -Oj #comment out if not needed vkeybd & #same as for timidity rosegarden & #i guess you'll need this ;-) qjackctl & #might be interesting to check everything's in place echo "Happy composing, my friendly musician!" |
Now make it executable:
$ chmod a+x ~/bin/musicstudio
And of course, try it!
$ ~/bin/musicstudio
Good luck composing!
