Pages

Wednesday, December 15, 2010

Digital Music: Format Wars

Which format should you save your tunes in? If your automatic answer is "MP3", it's worth reviewing your options.

There are two basic choices:
  1. Lossless ie. CD quality eg. FLAC, Apple Lossless, AIFF, WAV
  2. Lossy eg. MP3, AAC, OGG, ATRAC, WMA
Lossy compression is based on the idea that actually, you could throw away the stuff that people tend not to hear, and get a decent approximation of the original for a fraction of the file size.

The ideal is lossless, it's better quality and future-proofed. The really awesome bit is that if you go the lossless route, you can get the lossy version, in multiple different formats (including some not yet invented) for free. Note that not all lossless formats are compressed - FLAC and apple lossless compress, but WAVs don't.

One other thing - most formats allow tracks to be "tagged" (ie. all the track title, number, artist, album, year, singer's dog's name info stored in every file). WAV seems to be the only major exception - all you can rely on with WAV is what you can squeeze into the filename.

Pros and Cons or Lossy vs Lossless


Lossless (eg. FLAC)

Pros:
  • High quality - it's CD quality, because it's a perfect copy with nothing thrown away
  • Future-proofed - you can easily convert to whatever lossy or lossless format best suits the music player you're going to buy in two years' time

Cons:
  • Not universally supported (but hey, you can just convert)
  • Takes up space (but disc space is cheap, and you can easily spit out a portable version for your MP3 player)

Lossy (eg. MP3)

Pros:
  • OK quality (it's a compromise for space)
  • Convenience - you can buy music in MP3 format RIGHT NOW! CDs require a postman or a walk to the store
  • Small size - they fit on your MP3 player

Cons:
  • Sound quality is sacrificed - OK for headphones or small speakers, but not on a decent system
  • Transcoding to a different format is basically out - if your chosen format/bitrate doesn't work for you or your player, you gotta re-buy or re-rip


Other Stuff


Sound Quality Considerations

Ever thought "MP3 is good enough", "there's no difference between MP3 and CD" or even "MP3 sounds better"?

First off, are you comparing like for like? Lets assume you're comparing a CD and an MP3 ripped from the same CD. And to be super-scientific, you disguise which is which. Part of the design of MP3 is to throw away part of the sound, the parts that don't seem very significant. Every time I've done these tests, heavy (or actually not-so-heavy) bass tends to give away the MP3.

The problem is, sometimes "good enough" isn't good enough. On small speakers (eg. laptop, iPod dock) or headphones, sure, MP3s will do, you probably won't notice a difference. On large hifi speakers, you almost certainly will. Your ears. Your future buying decisions. Your choice.

What Bitrate?

Bitrate indicates the available data bandwidth (typically in "kilobits per second"), and therefore the quality. If the music has been compressed into a lossy format, bitrate is a good indicator of quality (higher the better). For lossless music, any bitrate value is only an indication of file size, there's no actual music compression going on.

All format/bitrate decisions are going to be a trade-off between what sounds good to you and the file size. Personally, I need full lossless quality in the house, 160kbps AAC is fine for headphones when working/commuting. But then I choose to have the luxury of being able to switch my portable copy to a different format/bitrate at the drop of a batch script.

It's worth noting that different formats have different compression algorithms and possibly different performance. Do some tests at various bitrates to see what works for you. My settings preferences for a portable copy are basically: 132kbps ATRAC = 160kbps AAC = 160kbps OGG = 192kbps MP3.

Just for comparison with lossy formats, lossless files run at a bitrate of about 1400kbps for the raw WAV, but in terms of filesize, this can be compressed down to almost half that before you need to apply lossy compression.

Constant vs Variable Bitrate

Pretty straightforward for lossy compression. Constant bitrate just uses a uniform bitrate throughout, you can predict how big your files are going to be, every second of music gets the same attention whether it's silence or mayhem. Variable bitrate compression tries to achieve an average bitrate, but allocates more or less of the "bit budget" depending on how busy things get (so you can't predict exactly how big a four-minute music file will be, but that big silent gap before the hidden track will cost nothing to store). Look for the "CBR" or "VBR" settings when selecting your encoding preferences.

Doesn't apply to lossless formats - while some formats offer more efficient storage than others, there's no compression of the actual music.

Gapless Playback

One extra complication is "gapless playback", or the ability to play successive tracks without the player introducing extra pauses between songs. Scarily, there is a term for this. Many formats (MP3/AAC) and players (eg. Sony) are unable to manage this due to a mixture of format flaws and lazy coding. If you ever experienced advanced audio technologies like CD and cassette tape, trying to listen to an album on an average MP3 player requires a major downgrading of expectations. I rant about this at length on this post.

No comments:

Post a Comment