Forgoing typical lossless audio compression for... reasons

| 3 minutes


Anyone who stores lossless music knows what a lossless codec is. Basically, you give the program the original file, and out comes a new file with no loss that is usually ~50% smaller than the source. But how do they compare to non-audio optimised algorithms?

Test setup

The audio files

  • A 384 kHZ, 24-bit (converted from 32-bit floating point for FLAC) WAV file. The song used is Whale Lullaby from Forgotten Tales of a Forest by Ikumi Ogasawara.
  • A DSD256 DSF file. Anyone who has ever looked into this format knows that the files are huge. The song used is My Funny Valentine from Some Other Time: The Lost Session From The Black Forest by Bill Evans.
  • A normal CD quality 16-bit 44.1 kHZ WAV file, in this case the radio edit of Sandstorm by Darude.

The compression algorithms

  • FLAC. It doesn’t really need an introduction, but unfortunately does not currently support DSD or 32-bit audio.
  • WavPack. It’s the only audio compression format that I know of that can compress DSD and 32-bit audio.
  • LZNT1. This is the standard transparent NTFS compression you can apply via Windows File Explorer (or the compact command).
  • LZX. Starting from Windows 10, this is the strongest compression algorithm NTFS supports. It can be used via the compact command’s EXE flag, which despite the flag name is not limited to executables.
  • zstd. It’s fast and has good compression ratios, making it one of the best general-purpose compression algorithms today. The Linux filesystem btrfs and current versions of OpenZFS support transparent compression using this algorithm.

The results

Song Original LZNT1 LZX zstd (level 3) zstd (level 9) WavPack (high) FLAC (default level 5)
Whale Lullaby 622 MiB (652858040 B) 622 MiB (652722176 B) 586 MiB (615124992 B) 590 MiB (619328672 B) 590 MiB (619089779 B) 368 MiB (386444841 B) 363 MiB (380976755 B)
My Funny Valentine 1.09 GiB (1180876892 B) 1.02 GiB (1105793024 B) 677 MiB (709988352 B) 699 MiB (733875445 B) 633 MiB (664135806 B) 375 MiB (393315356 B) -
Sandstorm 38.1 MiB (40037938 B) 38.1 MiB (39866368 B) 36.2 MiB (38051840 B) 36.5 MiB (38319319 B) 36.5 MiB (38275202 B) 29.2 MiB (30678271 B) 29.3 MiB (30779443 B)

First, let’s digest the generic algorithm results:

  • The default NTFS compression is clearly not worth consideration, as it only made a minor difference with DSD, and basically none with the WAV files.
  • LZX is a considerable improvement and makes a real difference with DSD, but is still far from amazing with WAV files.
  • zstd fares similarly as LZX at level 3 (which happens to be the default level used by btrfs compression), but manages to score a win with the DSD at level 9.

The audio-specific compression results don’t require much explanation:

  • FLAC is widely used for a reason - it compresses well at the default level, and is supported almost universally.
  • WavPack achieves the best result with compressing DSD. This is not a surprise at all, as it is specifically designed to do so. With WAV, the results are close or slightly better. It’s a good choice for your music collection, particularly if your music collection has DSD and 32-bit audio.

Conclusion

The only situation where it makes sense to use a non-audio-specific algorithm is with DSD, as not all tools and players can deal with WavPack-compressed DSD. In such situations, use transparent filesystem-level compression. In all other situations, use the right tools for the job.