The Ultimate Lossless Compression Format with Hybrid Mode and Open Source: WavPack

Way the hack didn’t I trip over WavPack (wv) earlier — it’s been around for some time now and astonishingly ultimate. To make it short and obvious (see hydrogenaudio.org for complete list):

Pros

  • Open sourc
  • Good efficiency (fwd is even better than mp3’s on foobar2000)
  • Hybrid/lossy mode (see below)
  • Tagging support (ID3v1, APEv2 tags)
  • Replay Gain compatible (which is no deal with fb2k anyway, but still)

Cons

  • Limited hardware player support
  • does take long to encode with optimal settings (not really because one time procedure)

Other features

  • Supports embedded CUE sheets
  • Includes MD5 hashes for quick integrity checking
  • Can encode in both symmetrical and assymmetrical modes
  • Supports multichannel audio and high resolutions
  • Fits the Matroska container
  • streaming support
  • Error robustness

So it’s open source! Most distros even come along with WavPack preinstalled. The only other lossless formats that I know are open sourced are two: FLAC which has bad tagging support and Shorten (to put it short: out dated). MAC (Monkey Audio Codec, ape) has an open sourced version but it’s not developed any longer.

The next great feature is hybrid mode which means you decode to lossy small file and an additional file containing “the rest” of the information. Only one other format is capable of this: OptimFROG (ofr) in DualMode. That means, putting both files together you get your 100% original back. The lossy file can be used entirely on it’s own. While encoding there is a second file, called correction file, that stores the difference between lossy and original — compressed that is. So what that means is you don’t have to convert your files each time you’re to shove them onto your portable. The only bad thing is you need to ensure the device can decode (read: play) them.

WavPack Properties after encodeTo give an example: If you convert a 27.5 MB ofr file to wv, hybrid enabled with lossy bitrate set to 192, you’ll get one 6.31 MB sized .wv file and a second 22.8 MB sized .wvc file. It took 12 min. 15 sec (playtime 4:25). Insane settings where: Compression Mode “high”, Processing Mode “6” (best encoding quality), Hybrid Lossy Mode “192kbps”. When you open the .wv file only in fb2k it’ll handle correction files automatically (see picture). However moving the file with foobar2000’s dialog “” will only move .wv files. I cannot speak for other software players but this way it’s just easy to handle two qualities of one file — one hifi one and on “to go”! After I now have converted an entire album here are the approximate file sizes comparing MAC, OptimFROG and WavPack and MP3/OggVorbis as lossy counterpart to “portable wv” (to be added to .ape/.ofr):

.ape 311 MB
.ofr 306 MB
.wv 70 MB
.wvc 255 MB
.wv+.wvc 325 MB
.mp3 (V2, ~190kbps) 74 MB
.ogg (q5, ~160kbps) 61 MB

Tagging: Unlike FLAC it uses APEv2 (or ID3v1) so tags can be used with most players, software and portable devices’ ones, without intervention.

While I ran encoding test’s with foobar2000 (which has decoding WavPack “build-in” by the way) I noticed when converting from, say, OptimFROG to WavPack fb2k went right at it. No temporary wav files as with OptimFROG to MAC, for example! But mind you it does take a long time if you use optimization for file size and quality. It seams to be somewhere around 0.7x (slightly slower than plain play time). I don’t see why this really is an issue because in most cases you’ll only encode once as it’s true for all lossless formats anyway.

Resources:

Archive Audio CDs to APE (MAC) or FLAC Image Files and Toss Away Your Dust Catchers

If someone is interested in archiving your audio CD collection in a really save manner to get rid of them after the encoding, or I should say transcoding process you might want to have a look at Neil Popham’s guide. Neil Popham, by the way, wrote some features for the APEv2 tagging tool wapet. His guide utilizes Windows batch scripts, adds tags and employs PAR2 for parity information. The later is needed to overcome seldom yet possible bit failures which would compromise an ape file. The ripping is done with EAC, the meanwhile well-known audio CD accurate ripping tool by Andre Wiethoff.

Using one single image file per CD has the benefit over multiple files to include, among others, audio information from before the first track, lead-in silence and TOC information. On the other hand, for audio library handling and daily playback where tagging plays a more important role, one file per track is much more comfy. That way all tags can be written directly to the audio file. This, however is resolutely limited with cue sheets. For example, with foobar2000 it’s transparent whether you have your playlist made up from an ape image with cue sheet or from multiple audio files with tags. It’s all the same with randomizing the list, seeking forward and backwards and the like. But once it comes to playback statistics or ReplayGain this will not be written to any file besides fb2k’s library database.

For my daily usage I copied the file MAC.exe (the actual encoder) from the Monkey’s Audio directory to foobar2000’s one and set up an encoding preset in it’s converter preferences using one of the following parameter taken from hydrogenaudio:

-c1000 Fast / large file
-c2000 Normal
-c3000 High / medium file
-c4000 Extra High
-c5000 Insane / small file

Prefixed by the source and destination file variables %s %d. I mainly chose ape over flac because of ape’s flexible tagging feature and neglected the in terms of encoding far better codec OptimFROG because this one needs heaps of CPU usage for decoding (while listening). When CPU power is not a constraint any longer I will most likely switch to ofg (if at that time it still has the best compression around). Don’t forget to enable the secure mode for your CD drive in fb2k under file -> open audio cd… -> select your drive and than drive settings. You can also access the rip wizard from there. Or go via “add to playlist” and convert the tracks manually.

Update: I have found out about WavPack which IMHO is a much better choice to MAC (APE) and FLAC because of better support, tagging and hybrid mode.