How To: Simply Convert A Directory of FLAC files to MP3 with FFMPEG in Linux

Stick the following in a file called flac2mp3 or such, chmod +x it, then put it in somewhere like /usr/local/bin

To use it, simply go to your folder of .flac files and run flac2mp3, then perhaps rm *.flac to get rid of the (massive) flac files you don’t want anymore.

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: Convert a Directory of MP3s to WAVs in Linux

I went to burn a couple of audio CDs for the boy today, and bod-frickn-dammit if Brasero / GnomeBaker and K3B didn’t all threw their hands in the air in dismay that I might actually have the nerve to want to convert mp3s to CD-audio on the fly. Very poor.

So, as wav files come in less flavours than mp3s and tend to work first time, I knocked up a quick script to convert a directory of mp3s to .wav files using mpg123, it even handles spaces correctly after I’d given it a stern talking to… Anyways:

To use the script:
– Copy and paste the above code into a new text file called mp32wav or something
– Make it executable with chmod +x mp32wav, then
– Copy it to /usr/local/bin for easy access with sudo cp mp32wav /usr/local/bin/

With that all done you can just go into a folder of mp3s in the terminal and fire it off. It’ll create a folder called WAV inside whatever directory you’re in and stick the converted wav files there with the original filename but with .wav tacked on the end.

Cheers!

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.