Thursday, January 1, 2009

Recording music with Ubuntu Linux (Intrepid Ibex)

Here's a quick tutorial on setting up Ubuntu Linux for recording audio. This is not hard to set up, but can be a little confusing if you don't do it every day.

1. Basic linux setup.

First off, you will need to turn on the audio capture for the "line in" or "microphone in" for your sound card, and of course, plug in your wires. The easiest way to get to the Linux mixer is to double click the little speaker icon at the top bar:

Then go to:

Volume Control -> Preferences

And make sure that "Line In capture" or "Microphone Capture" switches are checked. This will give you additional check box options under the "switches" tab. Make sure at least one of these options are checked.

I prefer using "line in capture," taking the the output from a small mackie mixer. This will give you a lot more control over the input signal. Of course you can plug a mic directly in the back of the computer, but depending on the microphone, it might not sound as good.

Also you may want to turn off "line in" for playback, and only enable it for recording. Otherwise, you might heard a slight double hit for every sound, or phase shifting.

As a quick check you can try recording with something simple like Sound Recorder just to verify that the basic wire connections and linux audio settings are basically correct. This will verify that the audio signal is at least going through the sound card.

2. Now from synaptic or apt-get, install:

ardour (multi-track recorder),
jack-rack (a LADSPA effects rack), and
lame (mp3 converter)

In my opinion ardour is probably the best open source multi-track recorder for linux. My second favorite is traverso, although the interface is a little counter intuitive if you are used to something like ardour or cubase.

3. Now close any other programs which may be using the sounds card (like browsers, games, etc). You should be able to start Ardour, under the Applications group "Sound & Video".

Note: by default Ardour has a dark color scheme (which might make it a little hard to see where things are). To change to a lighter color scheme, you can go to (from the top menu bar):

Window -> Theme Manager

4. Now before you can record anything you need to add a new audio track. This is under

Session -> Add Track/Bus

For example:

Then you can select mono or stereo, depending on your input. Pick mono if you don't need stereo .. it will save disk space.

Also what the "Normal" and "Tape" mode means: in normal mode you can record multiple times on the same track. Overlapping clips in the same track are blended together, or can be moved independently. In tape mode, think of a tape recorder with one long continuous piece of tape. Whatever is recorded overwrites whatever was on the track. It's handy when mixing down (or bouncing) multiple tracks to a single stereo track. If you don't want to have to delete audio clips before re-recording.

The rest of the defaults are fine.

5. Now to actually record onto a track, it must be "armed." Otherwise, the tracks are protected from accidentally recording over them. To "arm" the track click on the little red circle on the leftmost end of the track:

Note the slider here controls the volume for playback (for quick mixing).
The "m" button "mutes" the track (during playback)
The "s" button "solos" the track, which is the inverse of mute (meaning you mute everything but that track)

If you press mute and solo together, your machine will blow up. Of course I'm just kidding :)

7. You should now be able to see the recording levels here (to the right of these buttons). If the signal is too loud you will see red clipping. Be sure to adjust the volume levels of the input sound, so that it's not too loud (distorted) or too quiet (not enough signal/noise).

8. Now the recording controls are similar to any standard tape recorder. Click the red circle and triangle to actually start recording onto the armed track. The square stops the recording.

The "|<" returns the play head to the beginning of the recording. Or you can move the play head around with the scrubber (the horizontal slider in the picture above). Or you can click on the timecode to move the play head to a specific location.

9. Basic audio editing: You can trim, change the fade in/out, or move the clips around with the pointer tool selected (the little hand).

This is the default editing selection tool. The "|<->|" icon, next to the hand pointer, is another important mode. It is for selecting time ranges of one or more tracks. For example if you want to cut a whole clip, use the hand. If you want to cut a region out of the clip, use the range selector.

One of the most useful edits is under Edit -> Split Region. It will split a recorded clip into two regions that can be moved independently. Like scissors. Select the tracks of the audio that you want to split. You can select, as a general convention, multiple items by holding down the CTRL key and clicking on the track(s).

Also, note the "Markers" on the time line. Punch in/out and looping is especially handy. If you don't see a "Loop/Punch Ranges" heading in the Markers area, right click, and check "Loop/Punch."

Suppose that 98% of a take is good but contains a mistake in the middle. You can set a range containing the mistake and record only the few seconds of the track within the punch in/out range. This protects the rest of the track from recording over it.

To set up a punch in/out region, drag a region in the time line, and select "Set Punch Range":

Then click the "Punch In" "Punch Out" buttons.

Click on the time line to position the playhead before the mistake. Then record as usual. The only section that will be recorded is the region within the punch markers. Click the punch in/out buttons again to turn off.

These simple edits should give you enough to mix down the "best-of" multiple takes and correct small mistakes.

10. After you record several tracks, you can do a initial mix (volume / pan) in the mixer window under:

Window -> Show Mixer

Mixing is a matter of taste and pretty intuitive I think. The main (vertical) slider controls the volume of each track. The horizontal slider (at bottom) controls the left/right panning. The rest of the defaults should be fine.

11. Post processing and effects. With jack-rack you can go to:

Window -> Track/Bus Inspector

to look at the routing and add effects to particular tracks. To add an effect to a track, select the audio track (on the left)

Pre-fader and post-fader means the effect is inserted before and after your volume slider control (on the mixing board). To make things easiest, I prefer pre-fader effects, then I can control the overall volume with the fader.

Then right click. You will get the following options:

These are categorized by the developer which makes them a little hard to find. There is a "Plugin Manager" also, although I'd avoid it for now, since it seems to be a little slow and has crashed more than once (at least on my machine).

A couple general purpose effects that are worth checking out:

Steve Harris -> Multiband EQ
Steve Harris -> Dyson Compressor
CMT -> FreeVerb

By default these effects are by-passed (meaning, off). Click the Bypass button to make them active. Also to compare the signal, you can toggle back and forth between the original and modified signal.

To adjust the effect setting double click on the effect.

A general rule on E.Q. is: to clean up muddy audio, think of cutting a notch in the spectrum for another sound to live in. Two sounds competing for the same audio space will sound muddy. Alternately, two similar sounds might be separated out by panning left and right respectively.

12. Importing existing wav audio files: The easiest thing IMO is to drag a clip from Gnome's file manager (nautilus) onto a track in ardour. This will import the audio, and then you can move it around.

13. Exporting to wav audio file: Use the Range Markers to define the start and stop of the song. To set the region, click and drag in the "Range Markers" time line:

Then go to:

Session -> Export -> Export Range to audiofile

If you are burning a CD, you can usually just drop the wav files onto the blank CD and burn them. Note though that CD audio is 44100 samples per second, and by default ardour records/exports at 48000.

14. If you want to create an mp3's copies, you can open up a terminal window, and run a command like:

lame /path/to/file.wav /path/to/new/file.mp3

This will create a copy of the wav, in mp3 format. I'm sure there's a graphical front end, but if you understand a little about the terminal it's really easier to use use the command line version for this.

Or you could rip a CD after it is complete.

15. Misc:

That should cover mosts all the basics of multi-track recording on Linux.

After you record a lot of audio takes, those unused files are still on the hard drive wasting space. To compress the size of the project, and delete unused audio, select:

Session -> Cleanup

Of course if you plan on doing a lot of multimedia work check out Ubuntu Studio (which is a flavor of Ubuntu optimized for audio/video production).

Also note, you may need to close out ardour when playing wav files off your hard drive (in case it locks down the audio driver).