Pages

Thursday, December 30, 2010

Converting Lossless Music To Other Formats

Some quick notes on ways to convert your lossless (eg. FLAC) files into other audio formats.

Using Foobar - FLAC To MP3


Note that Foobar doesn't ship with encoders, so you'll have to go download extras to handle the formats you want to use.
  1. Get Foobar
  2. Launch Foobar
  3. Open/drag FLAC files in
  4. Select all, right-click and do a "convert", for output format pick MP3 - might want to set up an entry with chosen bitrate, constant/variable preference
  5. Pick a folder to dump the converted files into
  6. The first time you do this, you might have to tell Foobar where your lame.exe encoder is (see below)
  7. Watch the progress bar, go collect your files when done

Options


Foobar lets you set up a number of converter options, so if the defaults aren't enough, do an edit/add new.

My settings for MP3 are
Encoder type: "custom"
Encoder: lame.exe
Extension: mp3
Parameters: -S --noreplaygain -b 192 - %d
Format: lossy
Highest BPS: 24
Encoder name: "MP3 (LAME), 192kbps CBR"
Bitrate: 192
Settings: CBR

Apple Lossless

Foobar doesn't ship with the apple lossless decoding, I had to grab an extra plugin (try the Foobar website for download).


Getting LAME


LAME is the encoder engine that actually converts to MP3. If you don't have the LAME encoder (lame.exe), get latest from Rarewares. Download the zip (it should contain an exe, a DLL, and a bunch of HTML and CSS) and unpack all the files into somewhere like "C:\Program Files\Lame" (just create a new folder).

Tuesday, December 28, 2010

Ripping And Rocking With EAC

OK, I go on and on about using a decent ripping package for turning all those CDs into digital files for your music library, streamer, portable player etc, and I'm sure that just about everyone takes one look, gets scared and runs back to the safety of using iTunes to turn CDs into MP3s. So here's the thing: using a decent ripper isn't hard. Or it shouldn't be. So here's my quick guide to setting up and using EAC for ripping CDs.

Quick note: this post was mostly written with EAC version 0.99. I'll update for new features in 1.0beta1, such as the new artwork downloader, when I have time.

Setup


First thing, go get EAC from http://www.exactaudiocopy.de/. Install it (make sure you install the FLAC component too, do a full install and you should be fine), run it, go through the setup wizard - accepting the defaults should be fine, although when it asks you for formats, pick FLAC rather than MP3/WMA. Some of the FLAC encoding level and filename options, we'll set later, but for now defaults will do (it's lossless, you can always re-convert, and post-rip tagging is a doddle). You also need to give your email address in return for access to the tagging database.

Options


Some of the settings you'll want to tweak...

Tools: "Do not open external compressor" - do you want a DOS window showing the FLAC compression happening?

Filename: use naming scheme "%D\%C\%N - %T"

Directories: set directory to whatever space you've set aside for your FLAC files eg. "music\flacTunes".

Ripping


The process of ripping a CD is quite simple. Fire up EAC, bung in a CD, hit ALT-G to query the freedb database and get the tagging info - if you get multiple entries, select one, you can always re-query if it looks wrong. You'll also get prompted for an album cover art search (medium sizes are probably fine) - hover over to preview, select/highlight the best and hit the big "save with EAC" button. Images are saved as "folder.jpg" in the album folder.

If the CD wasn't found, or there are tagging errors, enter/fix the info (double-click on a track title to edit), but you can always fix the tags later. Also note the "first track number" option, very useful for binding two-disc sets together into a single album (you'll also want to hack the "disc two" out of the album title).

Hit SHIFT-F5 to start ripping (if no directory set in options, it'll prompt you for one). This can take a while, EAC is pretty persistent and will try its best to get an accurate rip. When it's all done, you'll get a success/error report.

You can even watch the progress as the files get converted and written - temporary WAV and FLAC files get written along the way.

The Next Step


With your CD now in FLAC, you have options. Save it to your library for streaming. Convert to some other format (eg. MP3).

And then you can start really playing with EAC...

More Options


EAC has tons of options, this post just covers the basics.

For advanced drive configuration, you'll need a good, unscratched CD for EAC to do a test rip with (yes, this software actually tweaks itself for your CD/DVD drive), probably best to pick a nice long 70-minute CD (don't worry, it won't take nearly that long to do the test rip).

External Compression Options


Under EAC->Compression Options->External Compression, I have the following set:
Use external program for compression
Use file extension ".flac"
Program "C:\Program Files\Exact Audio Copy\FLAC\FLAC.EXE"
Additional command line options: -8 -V -T "ARTIST=%a" -T "TITLE=%t" -T "ALBUM=%g" -T "DATE=%y" -T "TRACKNUMBER=%n" -T "GENRE=%m" -T "COMMENT=%e" %s -o %d
Bitrate: 768kbps, high quality
Delete wav after compression
Check for external programs return code

Copy Range Feature


When the CD doesn't allocate the tracks exactly as you need, whether it's those pesky hidden tracks or strangely-placed index markers, you can fix things using the "Copy Range" feature to move where the CD tracks start/end or split tracks up.

The first thing to find out where your tracks start and end. If you can get exact CD block positions from a ripping log, great, otherwise at least note the times. Do "Action->Copy Range->Compressed" to start a partial track rip. In the dialogue, use the sliders and "snap track" to get a rough start/end position, fine tune with cursor left/right, or enter the block position directly. Once you've set the start and end positions, hit "OK" and the track rips.

Note that the file is saved outside of the normal album folder (defaults to the root of your music ripping directory) so you'll have to do some file moving afterwards. Name the file with standard "01 - Trackname.flac" scheme, and correct the tags afterwards (track number and name may default to whatever track was selected when you started the partial ripping.

For more in-depth details, see this guide.

Friday, December 24, 2010

Digital Music: Gapless Playback

I use the term "gapless playback" a lot. These days it's kind of essential when talking about music playback. "Advances" in digital music playback have spawned the need for this rather curious term. "Gapless" is basically
"the ability to play one song followed by another song without introducing additional gaps or silence"
Obvious really. It's something that was a standard feature on all music formats and playback devices - vynyl, cassette, CD - until the rise of modern digital music players. Something we took for granted as standard for over 60 years is now an optional extra.

Be warned: this post mightwill turn into a bit of a rant. Gapless playback is something I care about a lot. It's been an absolute deal-breaker with my last four digital music player purchases. It's technically possible, it should just be the minimum acceptable standard.

I'm not going to list all the various gapless solutions and guilty parties on this post, if gapless playback is something that concerns you, do the research.

Disclaimer: gapless isn't an issue all the time, only if you're listening to albums. If you think the album format is dead and music must be listened to as individual songs, shuffled or compiled into playlists, stop reading. Otherwise...

What's the big deal?


If you're thinking "but all my albums have gaps between the songs anyway, what's the big deal", well what about live albums, dance music, prog rock records, etc? Some random examples of bands with studio albums that require gapless playback: The Beatles (Sgt. Pepper, Abbey Road), Pink Floyd (Dark Side of the Moon, The Wall), Dream Theater (Six Degrees, Systematic Chaos), The Prodigy (The Fat of the Land), Wu-Tang Clan (Forever), Nine Inch Nails (Pretty Hate Machine, The Downward Spiral), Slayer (Reign in Blood), Tool (Lateralus), Linkin Park (Meteora, A Thousand Suns), My Chemical Romance (Danger Days).

OK, the Beatles probably were wrong to start the whole "album format" thing without considering the limitations of future music players, but we're stuck with a larger number of albums that the average portable player can't handle. Oops.

Gapless doesn't mean "no gaps"


Yes it's confusing. "Gapless" doesn't mean "no gaps between songs", just "no added gaps between songs". So, if we take the Beatles as an example, Revolver has long gaps between the songs on the record, but Sgt. Pepper and Abbey Road let the songs seamlessly flow into each other. Gapless playback recreates the record exactly as it was.

OK, I'm converted. I want gapless. How do I get it?

  1. Use a "gapless" format eg. OGG, FLAC, MP3 (*)
  2. Buy a "gapless" player eg. iTunes/iPod
*Not all MP3s are created equal
Oh, and just because your format is gapless, doesn't mean your player will handle it. My Sony phone plays OGG files, but it leaves a massive gap between them. Spotify also apparently has issues playing its OGG files gaplessly. However, there are gapless-capable formats for both lossy and lossless, and music players capable of handling them. Gapless playback is available if you want it.

Why is gapless so hard to do?


Well, on vynyl/tape/CD, gapless is built into the format - it's a continuous stream of music, and "tracks" are nothing more than index markers you can fast-forward to. Where digital music is concerned, each track is a separate file, to be unpacked (if compressed) and re-combined into the album/playlist running order.

So really, why is gapless so hard to do?


It's not that hard. Many formats manage to store the necessary information. However, playback requires a little thought. Only a little.
  1. Buffering 101: you need a very basic knowledge of buffering - you need to be uncompressing a track slightly ahead of playing it. If you were to build a music player that:
    1. Played first track (slight delay as the music starts buffering) exactly as it is on the CD
    2. Waited until it finished then thought "oh, there's more?" and went off to fetch the next track
    3. Played second track...
    ...and so on, you'd probably get gaps due to disc access, buffering, etc, creating a time interval of greater than 0.0 seconds between tracks. Remember, those tracks already have whatever gaps (or "no gaps") existed on the CD.

  2. Track Length: The track must know when it begins and ends - astonishingly, MP3s can't be relied on to know how long they are (the original specification only stored "roughly" how long a track was, so you often ended up with the track stored as a number of "frames", the last of which contained the end of the song plus some silence to pad it out), although modern encoders seem to do fine.
To play gaplessly, you need to basically treat your tracks as contributing to a seamless playlist, sort of like re-creating a CD on the fly.

But surely if gapless was a problem they'd have fixed it by now?


MP3s have been around for years now. The original specification didn't address gapless playback, although subsequent revisions (and decent encoders like the latest LAME) now allow for gapless (it's not guaranteed that MP3s you buy will be gapless though). And subsequent formats (specifically AAC) based on MP3 repeated the same problem. When apple got so fed up with the situation they first fixed it (for iTunes/iPods only, of course) with a hack for not-necessarily-gapless MP3s that was rightly announced as a major new iPod feature. In 2007.

Apple's hack was basically to figure out how long the track should be (the info that OGG, FLAC etc files keep and MP3s originally threw away) so it can be played gaplessly. There's space in an MP3 to store this info (again, modern encoders create gapless files), but as gapless is not part of the original MP3 spec, no guarantees your player will manage to playback properly.

Getting gapless on non-gapless players


A couple of unsatisfactory hacks:
  • The 'Single Track' hack - OK, you could join all the songs on a CD together into one very long track (apple used to offer a 'join tracks' mode in the old pre-gapless iTunes days) but would you really want to?
  • Crossfading - by having your tracks fade-out and fade-in, slightly overlapping, you eliminate gaps. Of course, you also eliminate any sudden powerful track start/end that should be there, any pauses that should be there, etc. Save it for DJ mixes - crossfading is not gapless.

My 20-Year Turntable / Tape Deck / CD Player does Gapless - surely my shiny new MP3 player does too?


Why did gaps ever appear? Why hasn't the gapless problem been completely eradicated? My guess is that people either don't notice or don't care enough to choose a different player, so the extra effort needed to allow gapless playback isn't considered necessary. People buy individual songs or listen to their own playlists. For many, the convenience of the ubiquitous MP3 format far outweighs its many drawbacks (poor sound quality, inefficient compression, no automatic gapless). It took apple six years to get round to fixing this. Sony used to offer gapless (albeit via ATRAC only) but abandoned it along with their hard-drive players. Spotify considered it such a low priority that they took forever to implement it (and their "free" mode is still flaky).

So if you care, do the research and buy gapless. Or just put up with your player/format adding extra gaps between songs.

Note: updated to cover Spotify etc. finally getting gapless.