If you own an external USB MIDI controller (keyboard) or plan to buy one, you may be interested in how these things work with Ubuntu. Usually they are shipped with a CD that contains a Windows/Mac drivers & some music-making applications. Therefore it is common to see a note on their box that one needs Windows/Mac to use the instrument. No doubt this may discourage Ubuntu users from buying such controller, but is Linux really a not supported platform?
And, by the way, how to setup a working set of music applications, that will allow one to compose & perform music (regardless of whether you have an external keyboard or not)?
s.fox has recently posted a great guide on how to connect your USB keyboard with Ubuntu and get it to play some sounds in few easy steps. It’s great to get started in a very short time! In my post, I will explain some details on how (and why) this works and how you can use custom setups to your liking.
First things required to use external keyboard are drivers. I have never seen a USB MIDI keyboard that would have drivers for Linux included in it’s package. That’s not surprising, since nobody would need them. It turns out that ALSA manages to communicate with 100% USB MIDI controllers! The trick is that MIDI over USB is a common standard that every single USB controller uses. Therefore, since ALSA supports that standard, Ubuntu users need no additional drivers to use such keyboards. Just plug it in a free USB slot and ALSA will immediately discover it. Well, it won’t display a message, but you can ensure it has found the controller by running aconnect -i which lists all readable MIDI ports – your controller’s name will be included in the list too! (By the way, that makes me wonder why does other systems needs drivers for that…)
Okay, so it has successfully connected, but it plays no sound when I press a key. What is going on!?
That’s normal, and seems logical to me. How can it know what sound to play? The MIDI controller itself is not a synthesizer and it does not know much about sound, it is just meant to send keypresses and controller movement to a host device (your Ubuntu computer in this case). It needs some aid to be able to produce sound – an application capable of behaving as synthesizer.
On Windows/Mac you were probably welcomed with some cool music-studio application that is usually included with the MIDI controller, and installs alongside drivers. These digital audio workstations are usually really huge, and provide you with basic features you may need – that is notation editor, sequencers, synthesizers and recording tools (while sometimes free, such studio-applications require you sometimes to pay thousands of dollars to unlock professional features). They automatically detects your hardware and lets you play some music immediately. Using such tools you get a full studio within one application, which some people find very handy, but on the other hand it leaves you a bit less room for customizing your workplace. And of course these apps are not Linux-native, so they won’t run on Ubuntu, and WINE rarely supports them in full.
On Linux things are a bit different. You need to setup your studio on your own. There are some applications – LMMS for example – that behave similarly to such full-featured studios, by containing synthesizers, sequence editors and other stuff together. If you try out LMMS while having your USB controller plugged in, it will detect it and let you play & design music out-of the box.
But such studios are a rarity on Ubuntu. A popular philosophy common among many Linux applications is that an application should do just one thing, but do it well. That’s very true for music tools. There are many software synthesizers, note editors, recording tools, samplers, effect processors, sequencers – they are all separate applications. That means you need to create your own studio, by choosing tools you like and joining them together. Is it a lot of work? No. And a huge advantage is that you are free to choose every piece of your studio – you can change the synthesizer if you are not happy with the one your’re currently using, but leave the song-editor – which is not possible in case of huge studios.
So basically you are free to design the studio that will suit your needs best.
There is a great variety of audio/MIDI tools you can find for Ubuntu. Describing them all is not possible due to their amount so you will need to search for them on your own. Most likely you will need some of these:
- A synthesizer (or a few). That’s an application that takes MIDI signal as input, and transforms it into sound signal. So you give it notes, it plays them. There are several categories of synthesizers – there are ones that let you design the sound on your own and they process it in real-time, there are synthesizers that use soundfonts to playback notes you play (s.fox’s guide uses that kind of synthesizer), there are samplers that deal with pre-recorded bits of sound. Drum machines are synthesizers optimized for playing percussion/drums sounds. You can also design your own synthesizers with tools like PureData or SuperCollider - that requires some knowledge concerning sound synthesis, but has no limits in design complexity.
- A song editor. It allows you to arrange bits of music or notes in time, playback recorded MIDI or audio signal, and use features as quick transposition and many others that are helpful when designing tracks.
- A sequencer. Such tool is meant to play MIDI notes automatically, which is useful if you need something to accompany you. This can be also achieved with a song-editor, but sequencers usually are more flexible in this matter.
- What else you need to add solely depends on your needs and what else you want your studio to be capable of.
How do I connect these tools together, since they all are separate applications?
To connect MIDI signal (e.g. from a MIDI controller to a synthesizer) use ALSA’s MIDI connection capabilities. You can use aconnecct command, but there are also GUI applications, e.g. aconnectgui or kaconnect. To connect audio signal (e.g. from synthesizer to speakers or effect processor) – the best way is to use JACK audio server, and qjackctl frontend, which will allow you to start JACK and connect application’s audio as desired. A good tool that is capable of managing both MIDI and audio connections (provided JACK is running), and thus giving you a good overview of your studio is patchage .
To give you an overview of how things should be connected, I’ll use some diagrams.
The following diagram represents a setup used by s.fox in his guide:
Red arrows represents MIDI note signal, green arrows represent audio signal.
That’s a simple setup with just one synthesizer and no other tools. But this may easily get more interesting. Let’s add a MIDI song editor, and a drum machine.
Here, Hydrogen is used as a drum machine to add some percussion sounds. Rosegarden, a song-editor allows us to design a drum pattern and playback it as MIDI signal to Hydrogen. Such setup uses Rosegarden for one more thing – to capture and record notes one plays on the external keyboard. It can playback them later, passing MIDI signal to QSynth synthesizer, so that we can use the keyboard to play some other melody simultaneously. That’s a helpful trick if you are one of these who have only two hands to play with ;-)
Setups without external controllers are also possible.
In this case Rosegarden and harmonySEQ are used to design melodies & patterns and playback them. Rosegarden has a great notation editor and other tools for composing music, while harmonySEQ (a sequencer I am proud to have developed) is great for designing interactive loop patterns and repetitive melodies. This way one can compose music even without external MIDI keyboard!
Instead of a MIDI controller you can plug in your electric guitar!
No MIDI tools here. This is a simple setup, yet a skillful guitar player and wisely used Rakarrack effects may result in powerful effects! You may want to include harmonySEQ and Hydrogen in this design to add some background to your music, and you are ready for live performances!
Finally, as a more complex example, I will present the setup I use frequently.
As synthesizers, I like Yoshimi because of it’s incredible customization possibilities and PHASEX which allows to tune all it’s parameters in real time. I make a heavy use of harmonySEQ for all repetitive sections of my tracks, and use Rosegarden to playback background melodies (Sometimes I import audio recordings to Rhythmbox to playback some sound effects). Of course my setup different from track to track, that’s just the design I use most often.
If you want to learn more: Check out this great article by Louigi Verona describing his setup for live performances!
Final tip: Ubuntu Studio is an operating system based on Ubuntu that is optimized for multimedia creation – if you’re interested in installing Ubuntu to make some music, maybe give Ubuntu Studio a try? :-) (If you are already using Ubuntu there will be little benefit in switching to Ubuntu Studio – all these apps are available in Software Center, and other goodies can be brought to classic Ubuntu too.)
Concluding, you can design your own music studio on Ubuntu with ease by joining together audio/MIDI applications that are designed to do one thing, but do it well. It’s not difficult to experiment with them, so you will surely find something that suits you well. And as you can easily substitute modules of your studio, use the tools you like most!
I wish you have a great time while making music with Ubuntu!