How To: Rip CDs with EAC and Lame in Linux

I think I’ve tried pretty much every piece of CD ripper software on Linux, and my considered weapon of choice is none of them. That’s not to say there aren’t good CD rippers for linux, there are some great ones – but they all either have problems or quirks or lack features I deem essential for my own personal ripping tastes, so one by one they get ruled out until there is literally nothing left. What I wanted to use all along was simply EAC (Exact Audio Copy) with the Lame encoder – just in Linux. So that’s exactly what I’m going to do…

Wine Setup

Wine is a piece of software which acts as a Microsoft Windows compatibility layer / API interpreter, that is, it contains a rewrite of the Windows APIs and interprets the calls made by Windows software (which a Linux system cannot natively understand) into a Linux-specific system calls (which of course Linux can work with). If this is all a bit more detail than you need then the take away is this: You can run most Windows applications on Linux through Wine.

Installing and configuring Wine on any modern Linux distribution is pretty straight-forward, assuming you’re using Ubuntu just snag it from the standard repositories through Synaptic or grab it through apt-get with:

Next, you’ll want to configure it, so if the Wine configuration window isn’t launched as part of the install, then run the following command to bring up the configuration dialogue:

From here hit the Drives tab and then click on the [Autodetect…] button – what you see on your machine will obviously differ from what I see on this machine in terms of detected drives:

Wine EAC Drive Autodetect

With the drives detected (don’t worry about not seeing your CD drive for the moment) just click the [OK] button and we’re done for this bit.

A final note – Wine creates a hidden folder called .wine in your home folder, and this is where it puts its configuration files along with all installed Windows applications. If you can’t see this folder (i.e. you have Show Hidden Files disabled) and you’re using Gnome/Nautilus then you can toggle it through the View | Show Hidden Files menu option (Shortcut: Ctrl+H).

Getting and Installing Exact Audio Copy

EAC is freely available from here. Get yourself a version =D

Update: I found when re-installing EAC at a later point that 1.0 beta 1 version of EAC would fail to start with Wine, while 0.99 beta 5 would work perfectly. Find older versions here.

Once you’ve downloaded the installer .exe, right-click on it and select Properties from the pop-up menu, then go to the Permissions tab and check the Allow executing as a program checkbox followed by the [Close] button:

EAC Allow Executing As A Program

Because not every Windows program will work through Wine, and it’s often useful to see at what point it’s failing, it’s good practice to launch Windows apps through Wine via the command line by using:

This way, you can see any Wine or program output in the console, and see what’s going on. You’re free to just right-click on an exe and choose Open with Wine Windows Program Loader (and if you know a program works properly that’s probably the best option), but first time at least, run it through the command-line so you can see what (if anything) is happening when you launch the executable.

EAC itself is pretty easy to install, just click Next / Next / Finish etc and let it install to the default location (do pay attention to the part of the install process where it wants you to install the Ask toolbar though – you probably don’t want that rubbish). Skip ahead briefly at this point if you’d like to grab Lame in time to configure it during install, otherwise you can always configure it later on.

Once EAC’s installed, you can launch it from the terminal with the following (rather fugly) command:

Installing the Lame Encoder (Windows version)

Lame is IMHO the best mp3 encoder available, and is free, open-source software – but you probably don’t want to build it yourself. It’s a lot quicker and easier to grab a copy from somewhere like here. Once you’ve got the zip file, extract it and move the lame.exe and lame_enc.dll files into your Exact Audio Copy folder (wine ~/.wine/drive_c/Program\ Files/Exact\ Audio\ Copy/) then navigate to that folder, right click on lame.exe and enable the execution flag on it just like we did for the EAC installer earlier.

Two points to note are that you need to get the 32-bit version of Lame, as Wine won’t handle the 64-bit version, and that you shouldn’t get an alpha/testing version because it’ll occasionally crash during the encoding. Something like the 32-bit 3.98.4 version is perfect.

During install EAC will ask you where it can find lame, and will have a try at finding it itself – either allow it to or click the [Cancel] button to manually point it at the lame executable.

Using EAC

Configuration of EAC is a huge topic, and how far you want to go with it is entirely up to you (and entirely outside the scope of this article) – but I will say that when you’re ripping any audio, you’re going to rip it once, and listen to it a hundred times – so it makes sense to go for a relatively slow and accurate rip, and then encode the rip at a high bitrate using variable-bitrate encoding.

For my own Lame encoding, I use the following set of parameters to maximise the quality and bitrate of the final mp3 using variable-bitrate encoding:

These need to be entered into the Compression options section of EAC (from the File menu), so my setup looks like this:

EAC Lame Compression Options

Wrap Up

With all this in place, you should be able to use EAC just like you might’ve done before in Windows, with the exact same functionality, and obtaining the exact same quality results. It’s worth noting that although once configured and working you can easily launch EAC through the Wine menu entry in Gnome or KDE or whatever you’re using, but if you launch it from the command line get to see the lame encoding output so you can see what kind of bitrate different parts of any given song are using.

Cheers!
Flattr this

How-To: Easily Remove the Vocals from Most Songs

2015 Shortcut: When I wrote this article Audacity didn’t have an automatic center-panned vocal canceling effect… but now it does, so rather than do the stereo-separate / invert-one-track / play-both-as-mono trick (and that’s pretty much all there is to it), you should be able to find the Vocal Remover option in the Effects menu – but it’s more fun / interesting and can give better results if you do it yourself! =D

Audacity now has a built-in center-panned vocal canceling effect.


I found this trick the other day whilst stumbling the Interwebs and thought I’d do a quick-write up w/ pictures to make it as easy as possible… For this exercise we’re going to be using a piece of free audio software called Audacity, which you can get for Linux, Windows and Mac.

The track I’m using in this example is the first 50 seconds of Ben Folds – Zak and Sara, where the voice kicks in at the 11 second mark, and the original sounds like this:

Once you’ve got a copy of Audacity for your platform of choice, fire it up and follow these simple steps to get rid of the vocals from most songs:

1.) Import Some Audio

From the menu in Audacity, choose File | Import | Audio and then select an mp3 (or any audio format Audacity understands) to work with.

Audacity - Import

2.) Duplicate The Tracks

We’re going to come back later and use the bass from this to give it a nice, full sound – but for now just duplicate your imported audio by going to Edit | Duplicate:

Audacity - Duplicate

Once you’ve duplicated the tracks, we’ll mute our copy for now by clicking on the Mute button to the left of the waveform as shown:

Audacity - Mute

3.) Separate Our Original Tracks, Convert To Mono and Invert One Of Them

This is the key part of the process: because vocal tracks on songs are commonly recorded as mono and then mixed into stereo – by separating the tracks and making them act as separate mono tracks, we can then invert one of them to have them cancel each other out! And since usually only the vocal waveform is identical (i.e. mono mixed to stereo) it’s only the vocals that magically disappear from the sound! Ha!

So, to start off we need to click on the little down-arrow to the left of our original wave form and select Split Stereo Track:

Audacity - Split Stereo Track

Once the waveform’s been split (so we can mess with both channels individually) double click in the lower of the two waveforms (the right channel) to select it all, and then from the menu choose Effect | Invert as shown:

Audacity - Invert Right Channel

Now for the last really important step – simply set both left and right channels to output as mono by clicking on the little down-arrow to the left of each waveform and selecting Mono. Don’t forget to set both of them to Mono or the magic won’t happen!

Audacity - Convert to Mono

With that done, give it a play and see what happens! With any luck, there won’t be any vocals in the track – so with my example, it now sounds like this:

You’ll notice at the end that the vocals come back (the backing singing etc.) – why? Because it wasn’t recorded as a mono source, and hence doesn’t get cancelled out by the inversion we did earlier – so this technique won’t work for all songs – only ones where the voice is recorded in mono and then mixed into stereo, which to be fair, I think it a pretty large swathe of ’em, and it’d be perfect for karaoke or something like this anyway because you’d want the backing vocals there!

If you wanted to know more about how this wave-form cancellation works, you can always look up Superposition of Waves, but I’ll leave that as an exercise for the curious =D

4.) Filter Our Original To Add Back The Bass

Update: BigFuz points out in the comments below that an easier way than using equalisation to filter our copy so that it only keeps the bass is to use a Low Pass filter and just enter a value of 200Hz or 250Hz (whichever works best for you). You won’t be able to add back both bass and treble with a single pass using this method, but you may not want or need to! To apply a low pass filter to the copy, you can just select Effects | Effects 1 to 9 | Low Pass Filter from the menu – too easy! Relatedly (and yeah, it’s a bit obvious, but I use this to keep track myself), a quick way to remember which way around low-pass/high-pass goes is to think that a low pass filter allows everything below the given frequency to pass through, so a high pass filter must allow any frequencies higher than what you provide to pass through.

The voice-cancelled audio above sounds pretty good, and the vocals are definitely gone, but in the process we’ve stripped out a lot of the lower frequency sounds (i.e. the bass). So remember when we duplicated our waveform and muted it right at the beginning? This is where it fits in…

Un-mute our duplicated (and still stereo) audio copy by clicking on the Mute button to the left of the waveform, double click on the waveform to select it all, and then from the menu choose Effect | Equalization as shown:

Audacity - Equalisation

When the equalisation window pops up, we’re going to filter it so that all sounds above 200Hz are stripped out. To do this, just click somewhere on the main part of the window and a white dot will appear, click again and another will – then click on them to drag them around until you get a shape that looks kinda like this:

Audacity - Only Keep Bass

Notice that I’ve dragged the bottom-left slider all the way down to get access to the full 120Db and not just the 30Db on the scale by default.

You might have to have a bit of a play to get it right, but all we’re really doing is saying “Leave anything with a frequency of 200Hz or less alone, but drop the volume of anything over that frequency by around 120Db” (i.e. remove it entirely!).

If you mute our top two mono tracks and play it back, you should get the filtered version of the stereo track with only the bass remaining, which for my example sounds like this:

5.) Un-mute Our Original Voice Cancelled Tracks

With the vocal-free (but a bit tinny) audio playing at the same time as our bass-only version, we get a pretty neat sound with good bass and no vocals! Result! =D

You can then just go to File | Export to save the finished vocal-free version to an mp3 or such, if you wanted to keep it.

Wrap Up

I’ve read that some people like to cut out the sections between 200Hz and 1000Hz or so (1KHz, although I’ve also seen people push it up to 6KHz) to keep the low-end and high-end sounds, but when I was playing with this I kept getting some voice creeping back into the mix. This could well have been because I was only dropping 30Db when I was messing around with it though – so go nuts and experiment if ya wanna!

The shape I used for that EQ setting was:

Audacity - Keep High and Low Only

With that all said and done, I hope you found this guide useful – I didn’t come up with the technique or anything like that, I just saw a 10 line how-to and had to mess around for half an hour to get it to work, so thought I could knock up a quick guide that shows how it’s done really clearly, and I hope you have fun with the technique!

Cheers!
Flattr this

How To: Easily Convert FLAC audio to MP3s in Linux

I grabbed a bunch of FLAC files the other day, and as nice as they sound, I don’t think ~30-40MB per track is acceptable, so I did a bit of research and stumbled across this great post on LinuxTutorialBlog.

Turns out there’s a dead simple GUI based tool called SoundConverter – which really is as simple as pointing it at a directory and configuring your transcoding preferences (mp3, ogg, file-naming etc). A swift sudo apt-get install soundcoverter and a couple of clicks later and the job’s done.

SoundConverter1SoundConverter2

If you really want a bash method, there’s a bunch of scripts and links in tfa, such as this one by Octavio Ruiz :

I’ve modded the LAME_OPTS line in the above script to use the -q 0 switch in lame (so it uses the highest quality algorithm it can), and changed the order of when the ${LAME_OPTS) options are passed to lame, which results in them actually being honoured. Which is nice. Should you have any specific encoding goals, you can always browse through the lame switches and mod it to your hearts content.

Sweet like chocolate =D

Note: To run the above script, just copy & paste into a file, maybe flac2mp3.sh or something, then chmod +x flac2mp3.sh to make it executable and run it on a folder like flac2mp3.sh MyFolderOfFLACFiles.