Mar 292011

ensemble_1I came across by chance in what I consider one of the more comprehensive guide to creating audio in Linux, and Stefano gave me the permission to republish his material that I consider really good and that he uses as musician.

Stefano it’s an Ubuntu user and his guide it’s based on this distribution, he’s really active in the Ubuntu italian community, if you want to make him a question regarding his guide, you can post in this thread,278719.0.html, the language of the forum is Italian, but i’m sure that you’ll get some answers also if you ask kindly in English.

This is part 1, i plan to republish the whole guide in 4 parts in the next days.
The original article is in italian, if you have any comment about the translation, contact me.

1. Preparation

These instructions are for Ubuntu 10.04 and 10.10 (Lucid Lynx Meerkat and Maverick). Both 32 and 64 bits.

If you have not already done so, we must add the Medibuntu repository.

sudo wget`lsb_release -cs`.list --output-document=/etc/apt/sources.list.d/medibuntu.list; 
sudo apt-get -q update; 
sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring; 
sudo apt-get -q update


 sudo apt-get dist-upgrading

Finally, install proprietary codecs and other things that can be used:

 sudo apt-get install ubuntu-restricted-extras non-free-codecs w32codecs libdvdcss2 fusion-icon

If you have Ubuntu 64-bit, write w64codecs instead of w32codecs.

If it asks you things with a dialog box, you have to press “OK” or “Yes” using the TAB key on the keyboard (the one next to the letter Q) and then press enter.

In addition to the codec, you now also have Fusion-Icon. It is a program to deactivate and reactivate the 3D desktop effects, on the fly, in the case that some programs do not work with 3D effects (rotating, cube etc.). To start Fusion-Icon, go to Applications → System Tools → Compiz Fusion Icon. You will see a blue icon in the upper right. By right-clicking, select “Select Window Manager”.Choosing “Metacity” disables 3d effects on the fly, if you choose “Compiz” it will be reactivated.

2. Installing the RT kernel

NB: If you have Ubuntu 10.10 (Maverick Meerkat), proceed to step 3

But now we have to to do a strange thing … You should know that when you use MIDI with Windows you actually miss many small “beats” because the Windows kernel prefers to give priority to certain processes and programs rather than the music and then anything can “jump” while making music. Which is also good to make a piano bar, but not if you have to do a professional recording. That is why there are “Asio” drivers that will lower the latency of the sytem but then will not allow you to carry out “server” activities, until the “Asio” drivers are uninstalled/disabled.

The Linux kernel in Ubuntu (not the Ubuntu server) and Windows are a cross between a server (high latency) and music (low latency). A great choice for everyday applications, but if you do not have at least a dual core (in this case the difference is imperceptible latency), the choice is bad for both server applications and for music applications. To activate a version of the Linux kernel that is appropriate to make music we have to load a different kernel, created for that purpose.

2.1 – Installation

 sudo apt-get install build-essential linux-rt

If it asks you to reboot do not do it.
Then, you should already have the following but you never know:

 sudo apt-get install linux-headers-generic linux-headers-rt

Still don’t restart the system  if asked to do so. First we need to give permission to users to use the advantages of the Low Latency kernel.

2.2 – Change limits.conf

Open limits.conf:

 sudo gedit /etc/security/limits.conf

and before the line “ # End of file ” add these lines:

@audio - rtprio 99
@audio - nice -10
@audio - memlock unlimited

Save and close the file.

2.3 – Assign permissions for the use of low-latency kernel

You now have to add permissions to manage your sound card:
– System → Administration → Users and Groups
– Click on your user, “Advanced Settings” and enter the password.
– Go to “User Privileges” and select “Use audio devices”

Then you have to reboot.

2.4 – Using and troubleshooting

You have not done anything definitive: when you start your PC by pressing ESC you can choose to start with the kernel “music” or what you had before. from Karmic release,Shift must be pressed instead of ESC .

If the RT kernel does not work well and your PC is fairly new (a dual core for example) the fact that you installed it is enough to perform the minimum functions, although you’ll surely encounter difficulties when you’ll want to have very low latency (multiple records with many effects, for example). If your PC is powerful enough and you do not expect too professional results, use the generic kernel as well. Jack thinks he’s using the RT kernel and does not complain.

Almost all the problems found so far, however, are tied to two factors:
1) You have an ATI video card . The RT kernel is a new kernel,that is why when it starts for the first time it has to recompile all the proprietary drivers modules, such as vbox for example (if you use Virtual Box) or nvidia-common (if you have an Nvidia video card). For this recompilation, it automatically uses a very cool little program, called dkms , but often gives problems with proprietary drivers written badly, just like ATI drivers (“ATI IS EVIL” : as always remember Uncle Richard Stallman). The advice is to migrate as soon as possible to Intel, which is slow but very friendly and very open or, as an alternative that also discards open source principles, an Nvidia card, closed source but with higher performance.
2) You have a sound card which is performing poorly. If you want to make multitrack audio recordings with the sound card integrated in the motherboard or use a PC bought on the market as it is, forget it. Latency is obscene, Jack will not hold anything, the recording quality will be poor, full of noise and interference, and give you’ll lose heart with the management of inputs and outputs. Even (especially) on Windows, eh. A good sound card costs from € 100 up, new.Combined with a good microphone it is the only thing you need in terms of expenditure to make some decent music.

In this post of Corsair there are some tricks to solve the problems that often arise when installing the RT kernel on PC graphics cards with proprietary drivers (Nvidia and ATI): but remember to enter in the recovery mode rt kernel, not the generic kernel.

If all else fails, you can always go back starting with the previous kernel (by pressing ESC at the grub menu your PC, or Shift by Karmic on ). And if that fails there is always the further possibility of putting back the open driver : start with the generic kernel in recovery mode, and when it asks tell it to reconfigure xorg and everything else. It will start well in graphics, but without the proprietary drivers from Nvidia or ATI, which you can reinstall as you did before.

On Karmic and Lucid installation is incredibly smooth. DKMS takes care of recompiling the nvidia modules, virtualbox and everything else directly during the installation. Perfect.

3. Install the program and adjust the volume

3.1 – Software Installation

We install the required software:

sudo apt-get install ubuntustudio-audio ubuntustudio-audio-plugins lmms hydrogen-drumkits lingot rezound sweep fluid-soundfont-gs ams csladspa jokosher gmorgan wine jack-rack rosegarden qtractor nekobee

On Maverick (Ubuntu 10.10) add to the list this software as well:

 sudo apt-get install dssi-vst zynjacku rakarrack  blepvco vocproc

It is likely that on Maverick (Ubuntu 10.10) you are asked some things about Jack2. You always answer yes, moving with the arrow keys and with the Enter key.

Among the many things that you get you’ll find:

Rosegarden is the equivalent of Cubase, Cakewalk, Sonar, Finale … It is also more powerful and configurable, and it’s free.
Ardour is a recording studio, very very powerful. It is truly extraordinary for audio recording. here you can find a good tutorial to use it .
Audacity is an excellent audio editor, also available for Windows. Does not support Jack.
Qtractor is like Ardour. If you like it use it.
Bristol is an emulator for all the wonderful sounds of all different Moog (and more)
Nekobee is a nice emulator for Roland TB-303
Jokosher is more or less the same thing of Audacity, but has nicer interface for gnome, very very user-friendly and does not exist for Windows. It seems like Ardour, but does not support Jack.
Sweep is another audio editor, not multitrack , it can be convenient because it is very simple.
Rezound is another non-multitrack audio editor, simple and colorful. I use it as default for editing audio tracks in Rosegarden.
Gmorgan allows you to capture audio “live” from an external keyboard while the computer shoots out an arrangement with the style you want. Also useful as arranger style like Band In a Box .
Qsynth is a program that allows you to take the sounds of instruments and use them with effects and volume, turning a sound file of musical instruments in a rack module emulated by software. Essentially, it’s the same as my Korg. Even if you have a rack module or a cool keyboard full of sound, install Qsynth anyway , it is always useful, and doesn’t do just that, does a thousand other wonderful things.
Jackd is the heart of everything and is a patch bay, that is, a program that shows you all the entries and exits of all the programs you have loaded and the sound card that you can connect graphically . That is, it’s like a little box that connects all the cables from your instrument, with combinations done like a mad scientist (Actually by a mad musician): the dream of every musician …
Qjackctl is a graphical interface to jackd
Hexter is a VST, which is the software imitation of a device that produce particular sounds. In this case, the perfect imitation of the Yamaha DX7, that mythical ’80s keyboard that has become famous for the sound of “The Final Countdown” of Europe and “Jump” by Van Halen, but in general it’s both cool and absurd having it available because all the music of the 80s and early 90s used the sounds of this keyboard.
Xsynth-dssi is another VST that will mimic a perfect machine for electronic music, just like the old Moog, with hundreds of knobs to try out new sounds, and quite a few ‘ready-made’ sound all really electronic. There is also a perfect imitator of theremin. A Legend.
Flac is a codec (compression/decompression audio), widely used. Without installing it Rosegarden will also protest at startup.
Lingot is a tuner for your guitar
Hydrogen is a drum machine that, in strictly technical terms, kicks ass.
Hydrogen-drumkits are drumkit for hydrogen to … i’m sure you guess it.
Jack-rack allows you to make available some audio plugins. Similar to Dssi, but they are available for all applications and not just for Rosegarden
caps is the king of these plugins (called LADSPA), because it’s the one that simulate in real time any kind of amplifier distortion. There are really good distortions of the tube, and with a little of patience you can get sound from your guitar as if you had a Vox AC-30-style Brit-pop or a Marshall metal.
LMMS is the Linux equivalent of Windows FruitLoops (but is free and open source).
fluid-soundfont-gs is a bank of sounds.
ZynAddSubFX is a synthesizer that, in highly technical language, kicks several asses.
dssi-vst is a great plugin that allows you to upload several VST Windows
Rakarrack : See Appendix G
vocproc is a LV2 plugin, you need it to achieve effects like autotune.
zynjacku is like Jack Rack but for LV2 plugins. You will find it as “Lv2rack”.

3.2 – Configure wine

We also need to configure wine to use ALSA (sound module for Linux) and Jack (a program whose function we will see later).
Type in terminal:


Go to “Audio” and put the check mark only on “Jack” and “ALSA”. Press “OK “.

3.3 – Launch and configure alsamixer

At this point it is necessary to set up the volume of your sound card. Jack does not use system tools (Pulseaudio, what you normally find in the system preferences), but ALSA, it’s the sound card driver and come first than Pulseaudio.
To adjust the volume of ALSA, open the terminal and type:


If you get errors, it means that your sound card is not fully supported by Linux. You should buy a better-supported and more professional-grade card. If it starts, check whether it’s the sound card you want to use: in some cases, especially if you have a video card with HDMI or an additional professional sound card it’s possible that alsamixer starts with the wrong card. You see it easily because it shows the name.


To exit press ESC.

To know what cards you have, type in a terminal:

 cat /proc/asound/cards

If the correct card matches the number one, you’ll have to run Alsamixer like this:

 alsamixer -c 1

Obviously the number change depending on the card to be used.

If you want to disable the sound card that always bothers you (like a built-in sound card that you no longer need because you have bought a professional card) you could turn it off directly from the computer’s BIOS, if you can do it. But in some cases, the system sees it anyway. So it’s better to disable it. To do this, type:

 cat /proc/asound/modules

and locate the card module to delete. For example snd_hda_intel

then open the file with “black list” of kernel modelus:

 sudo gedit /etc/modprobe.d/blacklist.conf

And in the end add:

# integrated sound card
blacklist  'module name'

For example:

# integrated sound card
blacklist snd_hda_intel

Save and close. When you reboot, you will not see a trace of that sound card.

3.4 – Configure volumes

Once you open alsamixer, you can press the TAB (left of the letter Q on your keyboard) to switch between the “ Playback ” view to the “ Capture “(recording) view and vice versa.

To adjust the volume pass from one to another with the arrow keys (the right and left) while to increase and Decrease them press the buttons up arrow and down arrow

In the Playback view, to mute or to restore a volume, press M

In the Capture view to activate an input in the recording, press the space bar.

Adjusting the volume is essential. Keep Alsamixer open while you are producing audio or working on a project: it is from there that you really decide what goes in and what comes out from the sound card.

4. Install the soundfont

SoundFonts are banks of sounds of instruments. In practice, a full orchestra: MIDI files are the musical score, and the musicians are the soundfont. Obviously, different orchestras each have a different “sound” . I recommend two in particular, for free. Open the terminal and type (one line at a time!)

gunzip Unison.sf2.gz
gunzip PC51f.sf2.gz
sudo mv Unison.sf2 /usr/share/sounds/sf2/
sudo mv PC51f.sf2 /usr/share/sounds/sf2/

In addition, you can download from here all you want:
Once unpacked, you just copy them in /usr/share/sounds/sf2 for example opening the file manager of Ubuntu as administrator:

sudo nautilus

This is the End of Part 1 of this guide on how to produce Music with Linux, stay tuned for the next 3 parts.

Thanks to Hans for the proofreading.
And thanks once again to Stefano Droghetti for this guide.

[amazon_enhanced asin=”1886411344″ price=”All” background_color=”332610″ link_color=”FFFFFF” text_color=”D4CE99″ /]
[amazon_enhanced asin=”1593272707″ price=”All” background_color=”332610″ link_color=”FFFFFF” text_color=”D4CE99″ /]

Popular Posts:

Flattr this!

  11 Responses to “Music Production in Linux 1”

  1. Great Tutorial!
    I was looking for it. I’m waiting for the others parts.
    Even that English is not my main language, it’s easier for me to understand than Italian.
    Sorry for my poor English.

  2. Very nice.
    Hope to see much more of these.
    I am not an Ubuntu user, but there is no problem to do the same in other distros…… far 🙂

  3. Timely article series, might come handy soon.
    One question though, can’t one just use the open source ATI drivers with the RT kernel?

  4. This is great!

    I have been looking at moving from Mac based audio production to Linux and I have been using Ubuntu Studio that has a lot of audio stuff already installed. There is some good information about a musician called Kim Cascone who also moved from Mac to Linux, this is what inspired me to try using Linux as a platform for music and sound production:

  5. How can I do this on Debian? Wich are the packages installed with these two packages: ubuntustudio-audio ubuntustudio-audio-plugins?

  6. The world of music is something that can soothe as well as pep up the mood of a person. No wonder music of diverse kinds has been a very vital and integral part of media and entertainment. Production music and music stings occupy a very conspicuous part of the entertainment industry. It is very true that any form of a video clip has an amplified impact upon the audience when an appropriate piece of music is incorporated into it. Consequently, the demand for music has been considered invaluable since time immemorial. These music bits are basically produced by music libraries that also own the possession rights of the music piece.

  7. Can I post this on my blog in Portuguese?

    • Hello Danilo, all the contents of my blog is released under Creative Commons 3.0 license, just follow the rules : attributions and same license and you can do it 😉
      Also don’t forget to thanks Stefano that’s the real author of this article.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>