WavPack: Difference between revisions

From Hydrogenaudio Knowledgebase
(Added file extention and magic number)
(Rewrite draft for comments; I will revert this ASAP and publish a permalink for discussion in the forum, and then hopefully ...)
Line 5: Line 5:
| caption = Hybrid Lossless Audio Compression
| caption = Hybrid Lossless Audio Compression
| maintainer = David Bryant
| maintainer = David Bryant
| stable_release = 5.1.0 (20-01-2017)
| stable_release = 5.4.0 (2021-01-21)
| preview_release = None
| preview_release = None
| operating_system = Windows, Mac OS/X, Linux/BSD/Unix
| operating_system = Windows, Mac OS/X, Linux/BSD/Unix
Line 13: Line 13:
}}
}}


'''WavPack''' is a royalty-free, open source and [[lossless]] or high-quality lossy audio compression format developed by David Bryant.
'''WavPack''' (pronounced "wave-pack") is a [[lossless]] and hybrid lossless/[[lossy]] audio [[codec]].  It is distributed as a free open-source encoder/decoder with a library and a large number of tools, including a Windows GUI and a range of plugins for both audio players and other software. Third party implementations are available (ffmpeg).  WavPack supports and/or can be played back on a large number of platforms/OSes including mobile (Android, iOS), portable ([[Rockbox]]) and even web apps.


== Description ==
WavPack might be the most feature-rich among the lossless compressors, supporting a unique range of input formats including [https://en.wikipedia.org/wiki/Direct_Stream_Digital Direct-Stream Digital] and a hybrid lossy/lossless mode for lossy/lossless versions of the same file.  While many special features might require the user to apply the WavPack executable directly (see the ''Using WavPack'' section below), everyday use is supported by a wide range of players and taggers.
WavPack (pronounced "wave-pack") allows users to compress (and restore) all [[PCM]] audio formats including 8, 16, 24 and 32-bit ints; 32-bit floats; DSD audio; [[mono]], [[stereo]], and [[multichannel]]; [[sampling rate]]s from 6 to 192 kHz. Like other lossless compression schemes the data reduction varies with the source, but it is generally between 30 % and 70 % for typical popular music and somewhat better than that for classical music and other sources with greater dynamic range.


WavPack also incorporates a unique "hybrid" mode that provides all the advantages of lossless compression with an additional bonus. Instead of creating a single file, this mode creates both a relatively small, high-quality lossy file that can be used all by itself, and a "correction" file that (when combined with the lossy file) provides full lossless restoration. For some users this means never having to choose between lossless and lossy compression!
Performance-wise, WavPack defaults to a fast codec - compressing around [[FLAC]]'s default size, albeit not decoding as ultra-light.  The user might fine-tune compression/CPU load trade-off through a lot of options, including "extremely slow" encoding (quoting the manual) - but all will ''decode'' faster than the high-compression [[Monkey's Audio]]/[[OptimFROG]] codecs. In a major lossless comparison test, only one codec - the Windows/Wine-only [[TAK]] - could outperform WavPack on both compression and encoding speed and decoding speed.<ref>http://audiograaf.nl/downloads.html Martijn van Beurden's comprehensive lossless comparison. All comparisons taken from version 4 (WavPack version 4.70.0.)</ref>


* Default file extentsion: <code>.wv</code>
For more on WavPack, including on its history and technology, see the [https://en.wikipedia.org/wiki/WavPack Wikipedia entry].
* Magic number: <code>wvpk</code> (4 bytes)
 
== Features ==
For an end-user considering WavPack as a an audio format, its feature-richness might be the big selling point.  WavPack supports pretty much all the more common features noted at [[Lossless_comparison| HA Wiki's Lossless Codec Comparison]] as in the following first list, but several users might consider the more unique features listed under the subsequent headline.


== Feature Summary ==
* Fast and efficient encoding and decoding
* [[Open source]], released under a BSDish license
* Audio files > 4GB
* Multiplatform
* Hardware support
* Error robustness
* Streaming support
* Streaming support
* Supports multichannel audio and high resolutions
* Seekable playback
* DSD compression
* Error handling. Optional audio checksum for integrity verification (use the -m option).
* Hybrid/lossy mode
* High-resolution audio support up to 32 bits per channel (including floating-point, see below) and sample rates apparently up to 4 GHz PCM (including non-standard rates).
* Tagging support ([[ID3v1]], [[APE tags]])
* Multichannel support up to 255 channels, supports [https://docs.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible WAVEFORMATEXTENSIBLE].
* Supports [[RIFF]] chunks
* Piping support for encoding, and support for RAW PCM input.
* Supports embedded CUE sheets
* Can input and output WAVE, RF64, Wave64, and CAF audio files (including > 4 GB files).
* Includes MD5 hashes for quick integrity checking
* RIFF chunks supported for recreating also non-audio chunks of the original .wav files (see below)
* Ability to create self extracting files for Win32 platform
* Tagging: APEv2 tags at the end of file (also supported, but deprecated: ID3v1)
* [[ReplayGain]] compatible
* Cuesheet support
* Unicode support
* Can be used in the [[Matroska]] container.
* Drag and drop support: Dropping a file on to wavpack.exe/wvunpack.exe will encode/decode it (using default settings, to source directory).
 
Even if the bit depth must be 8 or 16 or 24 or 32 bits, WavPack is known to employ a "wasted bits" strategy that treat a a (say!) 20 bit signal in a 24 bit container by detecting that 21 to 24 are "wasted" and compress the 20-bits without size penalty: see van Beurden's lossless comparison, section 2.3.
 
=== Special/unique features ===
* DSD support: can losslessly compress Philips DSDIFF and Sony DSF files (see "Using WavPack" below); can import ID3v2.3 tags from DSF.
* 32-bit floating-point support.  Also handles CoolEdit/Adobe Audition's 32-bit float format (use the -a option only if the .wav was generated by CoolEdit/Audition).
* Will by default restore the input file (.wav/.dsf etc) - not only the audio and the RIFF metadata, but also select the same version of the WAVE container to recreate the input ''file'' bit-by-bit.  This behaviour can be overridden by forcing output format (which may also be used to fix obsolete-format .wav files - or to decode DSD streams or float (lossy!) into 24-bit integer PCM WAV) - or by stripping these data upon encoding (-r, or passing stream-only like when using a player like foobar2000) like is default in e.g. FLAC.
* Hybrid lossy/lossless mode (can also be used as lossy).
* Can create self-extracting (.sfx) files for Windows
* Even-quicker-than-audio-MD5 integrity checking (wvunpack -vv from version 5).
 
 
 
=== Limitations ===
* Despite being available for several platforms, PCM in AIFF is not supported.  (However, both endianness CAF files are.)
* Can currently not import ID3v2.4 tags from DSF files, only ID3v2.3 (use [[Mp3tag]] to copy tags)
* WavPack 5 does no longer support WavPack 3.x and below (though older WavPack versions are still available)
* Current Windows version no longer supports Windows XP (older versions still available)


== History ==
WavPack has traditionally had less hardware support than FLAC ([[Rockbox]] having been the most notable platform, others listed at https://www.wavpack.com/index.html#Hardware ), but with WavPack playback through Android and iOS players, the distinction between "hardware" and "software" is arguably blurred.
David Bryant started development on WavPack in mid-1998, with the release of version 1.0. This first version compressed and decompressed audio losslessly, nothing else, but by then it already featured one of the best efficiency versus speed ratio among lossless encoders.


Very soon after the release of version 1.0, Bryant released v. 2.0, which featured lossy encoding (using only quantization for data reduction – no psychoacoustic process was applied to the stream).
== Using WavPack ==
WavPack files can be played back in supported players (see below), and several of these can encode to WavPack. However, often one must use the WavPack binaries to access certain of its features. For example, you cannot count on RIFF support by encoding through players which often deliver only the audio to the encoder - and you cannot count on such players to restore non-audio data faithfully.  Also, the input format might exceed the player's internal decoding; e.g. trying to convert 32-bit integer or DSD with foobar2000 will yield a warning that it will not be lossless (also, converted DSD will be many times the size).


In 1999, the developer released version 3.0, which featured novelties such as a fast mode (with reduced compression ratio), compression of RAW files and error detection using CRC checksums.
The rich set of options means that wavpack encoder and the wvunpack decoder (and wvgain) have to "re-use letters"; while some do the same in the wvunpack and wavpack commands (like -d for delete input file, -y for "yes to all" and -l for "run with low priority" (Windows only)) and others cover the same purpose (like -m and -v), there are letters used for completely unrelated functions in wvunpack as in wvpack (like -b, -c, -r). Options can be concatenated like for example writing -h -x2 -m -y -l as -hx2myl. 


WavPack development is still going on, and a major feature added in late 3.x versions is the hybrid mode, where the encoder generates a lossy file + a correction file, so that both can be decompressed back to the original PCM stream.
=== Lossless encoding ===
Dragging and dropping a (supported) file to wavpack.exe (/wvunpack.exe) will encode (/decode) it. This might be the simplest way, and in particular if the source is DSD (or 32-bit integer WAV) which players might decode to PCM floats - but will only apply default options.  Dropping a .wv file onto wavpack.exe will recompress it using default settings (a bad deal if it was encoded with, say, -x4 - but default settings also means you will be prompted before it overwrites).  


WavPack 4 has been released in 2004. It included important changes, such as fast seeking, multichannel support, high resolution audio support, etc. turning it into one of the most full featured and modern lossless audio compressors.
For fine-tuned performance, one might want to use the command-line encoder (or, Windows only, the GUI).
The basic encoding usage is wavpack filename.wav (which creates filename.wv) or wavpack infilename.wav outfilename.wv; file extensions can be dropped (like wavpack infilename outfilename will encode infilename.wav to outfilename.wv) if there is no ambiguity.
The manual (online, or included as wavpack_doc.html in the distribution) gives an exhaustive reference, and the following is merely a selection.  Encoding using -hxm seems a sensible trade-off between compression and CPU load.
* Compression.  WavPack has four compression modes that affect compression as well as encoding ''and'' decoding time: fast (-f), default (no switch), high (-h) and very high (-hh).  The WavPack manual warns against -hh for portable use due to its CPU-intensive decoding, which in van Beurden's comparison test amounts to twice the CPU load of -f. On top these modes, the optional -x1 to -x6 settings will perform extra compression that does not affect ''decoding'' CPU load, but take extra time ''encoding''.  -x without number is synonymous to -x1, which is often recommended (in all modes, fast/normal/high/extra high).  The official manual calls -x4 to -x6 "extremely slow".
With DSD files, there are only two compression settings, normal (selected by -f or no switch) and high (selected by -h or -hh), and the -x switches are silently ignored.
* Guarding against errors: Encoding with "-m" will compute an audio MD5 sum (like FLAC does by default) and store it for later verification.  The "-v" switch will verify by computing (but not storing!) the MD5 sum upon encoding.  (Using the corresponding switches in wvunpack will check without producing output file, however wvunpack also has a faster verification -vv for WavPack 5-encoded files.)
* --import-id3 will import ID3v2.3 tags (currently not v2.4) present in the source file - typically in Sony DSF files - and convert them to WavPack's preferred APE tags.  (This does not affect the chunk stored for restoring the original file.)  By default, this is limited to 1 MB; for more, use --allow-huge-tags.
* -r: remove extra (non-audio) chunks.  By default, WavPack will store these in the .wv file for later bit-by-bit restoration of everything, not only the audio. To throw them away - like encoding through most players appear to do - use this setting.
* -y: "yes" to everything.  Use with caution, will overwrite. 
* -d: delete source file afterwards.  Again, use with caution.
* -l will force WavPack to run at low priority (Windows only)
* -c with -b to select quality: Create correction file for hybrid use.


WavPack 5 finally released on 6th December, 2016.  
WavPack can recompress .wv files in place (using a temporary file until done).  For example, wavpack -hx4mly wavpackfile.wv will recompress wavpackfile.wv the file in high mode, using -x4 extra processing, with low priority (assuming the Windows platform), write audio MD5 to it - and once done writing a temporary file, overwrite the old wavpackfile.wv.
Now it accepts audio files bigger than 4 GB and can compress the Direct-Stream Digital (DSD) audio recording format.
 
Including handling with many new file formats like Sony Wave64 or Philips DSDIFF makes WavPack to an "universal audio archiving solution".
=== Decoding ===
(To be expanded. Basic decoding usage is wvunpack filename.wv , which will decode to precisely the same as the input file provided that information was included upon encoding.  Output filename can be given as )
 
 
=== using WavPack (hybrid) & using wvgain ===
(to be added)


== Software support ==
== Software support ==
With Android support and playback through ffmpeg, it might no longer be feasible to maintain a list of applications that can play WavPack files, and  the following is  most certainly incomplete - as is the list at https://www.wavpack.com/#Software . 
=== Players ===
=== Players ===
* [[foobar2000]] advanced freeware audio player plays/decodes WavPack out of the box on both Windows, MacOS, Android and iOS (Windows: supports encoding if wavpack.exe is installed, and redistributes the official wavpack.exe through its "Free encoder pack" addon for encoding. With ReplayGain & Cuesheets support.)
* [http://www.videolan.org/vlc/download-windows.html VLC] multiplatform media player
* [http://www.vuplayer.com/vuplayer.php VUPlayer] (official plugin, supports encoding)
* NullSoft [[Winamp]] (plugin with ReplayGain & Media Library support) and Winamp-compatible players
* NullSoft [[Winamp]] (plugin with ReplayGain & Media Library support) and Winamp-compatible players
* [[foobar2000]] Advanced Audio Player (official encoding/decoding addon, with ReplayGain & Cuesheets support)
* [http://www.vuplayer.com/vuplayer.php VUPlayer] (official plugin, supports encoding)
* [[Windows Media Player]] and other directshow-based players (MPC, TCMP, RadLight) (with [http://www.hydrogenaudio.org/forums/index.php?showtopic=103693 CoreWavPack] directshow filter)
* [[Windows Media Player]] and other directshow-based players (MPC, TCMP, RadLight) (with [http://www.hydrogenaudio.org/forums/index.php?showtopic=103693 CoreWavPack] directshow filter)
* [http://cogosx.sourceforge.net/ Cog] Audio player for MacOS X.
* [http://cogosx.sourceforge.net/ Cog] Audio player for MacOS X.
Line 67: Line 103:
* [http://mpxplay.sourceforge.net/ MPXplay] for DOS!
* [http://mpxplay.sourceforge.net/ MPXplay] for DOS!
* [http://aqualung.sourceforge.net/ Aqualung] for GNU/Linux
* [http://aqualung.sourceforge.net/ Aqualung] for GNU/Linux
* [http://www.videolan.org/vlc/download-windows.html VLC Player]
* Cowon [http://www.jetaudio.com/ JetAudio Player]
* Cowon [http://www.jetaudio.com/ JetAudio Player]
* Konvertor [http://www.logipole.com/index.html Konvertor]
* Konvertor [http://www.logipole.com/index.html Konvertor]
*[http://www.un4seen.com/ XMPlay] Plugin required (WavPack input plugin) and (bass library) to play 'wv' files
* [http://www.un4seen.com/ XMPlay] Plugin required (WavPack input plugin) and (bass library) to play 'wv' files


=== Frontends ===
=== Frontends ===
Line 82: Line 117:
* [http://media.io/ Online Audio Converter]
* [http://media.io/ Online Audio Converter]
* Konvertor [http://www.logipole.com/index.html Konvertor]
* Konvertor [http://www.logipole.com/index.html Konvertor]
* [http://cuetools.net CUETools] converter and AccurateRip/CTDB checker


=== Editors ===
=== Editors ===
Line 94: Line 130:
=== Taggers ===
=== Taggers ===
* [http://www.mp3tag.de/en/index.html Mp3tag] Universal Tag Editor
* [http://www.mp3tag.de/en/index.html Mp3tag] Universal Tag Editor
* [https://picard.musicbrainz.org/ MusicBrainz Picard] Tagger with audio identification
* [http://www.jtclipper.eu/thegodfather/ The GodFather] Tagger / Music manager
* [http://www.jtclipper.eu/thegodfather/ The GodFather] Tagger / Music manager
* [[Tag.exe|Case's Tag]] command line tagger
* [[Tag.exe|Case's Tag]] command line tagger
Line 101: Line 138:
* [http://www.bunkus.org/videotools/mkvtoolnix/ mkvtoolnix] – tool to multiplex WavPack streams inside the Matroska container
* [http://www.bunkus.org/videotools/mkvtoolnix/ mkvtoolnix] – tool to multiplex WavPack streams inside the Matroska container
''It's worth mentioning the [[Matroska]] guys decided to concentrate on WavPack as the lossless compressor of choice for their container. Quite an honor... :-)''
''It's worth mentioning the [[Matroska]] guys decided to concentrate on WavPack as the lossless compressor of choice for their container. Quite an honor... :-)''
* [https://support.pkware.com/display/PKSZLU/PKZIP+Toolkit+for+Windows PKWare]'s .zip format compresses audio by WavPack since version 6.3.2 (2007).  Beware that there is no expectation that other decompression software handles these zip files; even if PKWare co-designed the format and PKZip was the original .zip implementation, their subsequent compression methods are outside the ISO/IEC standardized zip format specification.


->[http://www.wavpack.com/#Software WavPack Software Section]
== Hardware Support ==
* iRiver iHP-120/iHP-140 with the open source [http://www.rockbox.org Rockbox firmware]
* Roku PhotoBridge HD (with [http://www.wavpack.com/downloads.html#binaries plugin])
->[http://www.wavpack.com/index.html#Hardware WavPack Hardware Section]
== Technology description ==
To ensure high-speed operation, WavPack uses a very simple predictor that is implemented entirely in integer math. In its "fast" mode the prediction is simply the arithmetic extrapolation of the previous two samples. For example, if the previous two samples were -10 and 20, then the prediction would be 50. For the default mode a simple adaptive factor is added to weigh the influence of the earlier sample on the prediction. In our example the resulting prediction could then vary between 20 for no influence to 50 for full influence. This weight factor is constantly updated based on the audio data's changing spectral characteristics, which is why it is called "adaptive".
The prediction generated is then subtracted from the actual sample to be encoded to generate the error value. In mono mode this value is sent directly to the coder. However, stereo signals tend to have some correlation between the two channels that can be further exploited. Therefore, two error values are calculated that represent the difference and average of the left and right error values. In the "fast" mode of operation these two new values are simply sent to the coder instead of the left and right values. In the default mode, the difference value is always sent to the coder along with one of the other three values (average, left, or right). An adaptive algorithm continuously determines the most efficient of the three to send based on the changing balance of the channels.
The developer has developed a unique data encoder for WavPack that he believes is better than Rice coding in two different areas. It is impossible to encode more efficiently than Rice coding because it represents the optimal bit coding (sometimes known as the Huffman code) for this type of data. WavPack's encoder is slightly less efficient than this, but only by about 0.15 bits/sample (or less than 1% for 16-bit data). The first advantage of WavPack's coder is that it does not require the data to be buffered ahead of encoding, instead it converts each sample directly to bitcodes. This is more computationally efficient and it is better in some applications where coding delay is critical. The second advantage is that it is easily adaptable to lossy encoding because all significant bits (except the implied "one" MSB) are transmitted directly. In this way it is possible to only transmit, for example, the 3 most significant bits (with sign) of each sample. In fact, it is possible to transmit only the sign and implied MSB for each sample with an average of only 3.65 bits/sample.
This coding scheme is used to implement the "lossy" mode of WavPack. In the "fast" mode the output of the non-adaptive decorrelator is simply rounded to the nearest codable value for the specified number of bits. In the default mode the adaptive decorrelator is used (which reduces the average noise about 1 dB) and also both the current and the next sample are considered in choosing the better of the two available codes (which reduces noise another 1 dB).
The developer has decided to not use any floating-point arithmetic in WavPack's data path because he believes that integer operations are less susceptible to subtle chip to chip variations that could corrupt the lossless nature of the compression, the Pentium floating point bug being a blatant example of this. It is possible that a lossless compressor that used floating-point math could generate different output when running on that faulty Pentium. Even disregarding actual bugs, floating-point math is complicated enough that there could be subtle differences between "correct" implementations that could cause trouble for this type of application. To further ensure confidence in the integrity of WavPack's compression, the encoder includes a 32-bit error detection code to the generated streams.
WavPack source code is very portable. It has been compiled on several Unices (Linux, Mac OS X, Solaris, FreeBSD, OpenBSD, NetBSD, Compaq Tru64, HP-UX...) as well as Windows, DOS and OpenVMS. It works on architectures such as x86, ARM, PowerPC, SPARC, DEC Alpha, PA-RISC, MIPS, Motorola 68k...


== External links ==
== External links ==
* [http://www.wavpack.com/ Official website]
* [http://www.wavpack.com/ Official website]
* [https://github.com/dbry/WavPack Github repository]
* [http://www.rarewares.org/lossless.html Unofficial multiplatform versions] at RareWares
* [http://www.rarewares.org/lossless.html Unofficial multiplatform versions] at RareWares
* [[Lossless_comparison|Lossless Codec Comparison]]
* [[Lossless_comparison|HA Wiki's Lossless Codec Comparison]]
* [[EAC_and_WavPack | Configuring EAC and WavPack]]
* [[EAC_and_WavPack | Configuring EAC and WavPack]]
<references/>


[[Category:Codecs]]
[[Category:Codecs]]
[[Category:Lossless]]
[[Category:Lossless]]

Revision as of 20:39, 11 January 2022

WavPack
Official WavPack logo

Hybrid Lossless Audio Compression
Developer(s) David Bryant
Release information
Initial release {{{released}}}
Stable release 5.4.0 (2021-01-21)
Preview release None
Compatibility
Operating system Windows, Mac OS/X, Linux/BSD/Unix
Additional information
Use Encoder/Decoder
License BSD license
Website http://www.wavpack.com/

WavPack (pronounced "wave-pack") is a lossless and hybrid lossless/lossy audio codec. It is distributed as a free open-source encoder/decoder with a library and a large number of tools, including a Windows GUI and a range of plugins for both audio players and other software. Third party implementations are available (ffmpeg). WavPack supports and/or can be played back on a large number of platforms/OSes including mobile (Android, iOS), portable (Rockbox) and even web apps.

WavPack might be the most feature-rich among the lossless compressors, supporting a unique range of input formats including Direct-Stream Digital and a hybrid lossy/lossless mode for lossy/lossless versions of the same file. While many special features might require the user to apply the WavPack executable directly (see the Using WavPack section below), everyday use is supported by a wide range of players and taggers.

Performance-wise, WavPack defaults to a fast codec - compressing around FLAC's default size, albeit not decoding as ultra-light. The user might fine-tune compression/CPU load trade-off through a lot of options, including "extremely slow" encoding (quoting the manual) - but all will decode faster than the high-compression Monkey's Audio/OptimFROG codecs. In a major lossless comparison test, only one codec - the Windows/Wine-only TAK - could outperform WavPack on both compression and encoding speed and decoding speed.[1]

For more on WavPack, including on its history and technology, see the Wikipedia entry.

Features

For an end-user considering WavPack as a an audio format, its feature-richness might be the big selling point. WavPack supports pretty much all the more common features noted at HA Wiki's Lossless Codec Comparison as in the following first list, but several users might consider the more unique features listed under the subsequent headline.

  • Streaming support
  • Seekable playback
  • Error handling. Optional audio checksum for integrity verification (use the -m option).
  • High-resolution audio support up to 32 bits per channel (including floating-point, see below) and sample rates apparently up to 4 GHz PCM (including non-standard rates).
  • Multichannel support up to 255 channels, supports WAVEFORMATEXTENSIBLE.
  • Piping support for encoding, and support for RAW PCM input.
  • Can input and output WAVE, RF64, Wave64, and CAF audio files (including > 4 GB files).
  • RIFF chunks supported for recreating also non-audio chunks of the original .wav files (see below)
  • Tagging: APEv2 tags at the end of file (also supported, but deprecated: ID3v1)
  • Cuesheet support
  • Unicode support
  • Can be used in the Matroska container.
  • Drag and drop support: Dropping a file on to wavpack.exe/wvunpack.exe will encode/decode it (using default settings, to source directory).

Even if the bit depth must be 8 or 16 or 24 or 32 bits, WavPack is known to employ a "wasted bits" strategy that treat a a (say!) 20 bit signal in a 24 bit container by detecting that 21 to 24 are "wasted" and compress the 20-bits without size penalty: see van Beurden's lossless comparison, section 2.3.

Special/unique features

  • DSD support: can losslessly compress Philips DSDIFF and Sony DSF files (see "Using WavPack" below); can import ID3v2.3 tags from DSF.
  • 32-bit floating-point support. Also handles CoolEdit/Adobe Audition's 32-bit float format (use the -a option only if the .wav was generated by CoolEdit/Audition).
  • Will by default restore the input file (.wav/.dsf etc) - not only the audio and the RIFF metadata, but also select the same version of the WAVE container to recreate the input file bit-by-bit. This behaviour can be overridden by forcing output format (which may also be used to fix obsolete-format .wav files - or to decode DSD streams or float (lossy!) into 24-bit integer PCM WAV) - or by stripping these data upon encoding (-r, or passing stream-only like when using a player like foobar2000) like is default in e.g. FLAC.
  • Hybrid lossy/lossless mode (can also be used as lossy).
  • Can create self-extracting (.sfx) files for Windows
  • Even-quicker-than-audio-MD5 integrity checking (wvunpack -vv from version 5).


Limitations

  • Despite being available for several platforms, PCM in AIFF is not supported. (However, both endianness CAF files are.)
  • Can currently not import ID3v2.4 tags from DSF files, only ID3v2.3 (use Mp3tag to copy tags)
  • WavPack 5 does no longer support WavPack 3.x and below (though older WavPack versions are still available)
  • Current Windows version no longer supports Windows XP (older versions still available)

WavPack has traditionally had less hardware support than FLAC (Rockbox having been the most notable platform, others listed at https://www.wavpack.com/index.html#Hardware ), but with WavPack playback through Android and iOS players, the distinction between "hardware" and "software" is arguably blurred.

Using WavPack

WavPack files can be played back in supported players (see below), and several of these can encode to WavPack. However, often one must use the WavPack binaries to access certain of its features. For example, you cannot count on RIFF support by encoding through players which often deliver only the audio to the encoder - and you cannot count on such players to restore non-audio data faithfully. Also, the input format might exceed the player's internal decoding; e.g. trying to convert 32-bit integer or DSD with foobar2000 will yield a warning that it will not be lossless (also, converted DSD will be many times the size).

The rich set of options means that wavpack encoder and the wvunpack decoder (and wvgain) have to "re-use letters"; while some do the same in the wvunpack and wavpack commands (like -d for delete input file, -y for "yes to all" and -l for "run with low priority" (Windows only)) and others cover the same purpose (like -m and -v), there are letters used for completely unrelated functions in wvunpack as in wvpack (like -b, -c, -r). Options can be concatenated like for example writing -h -x2 -m -y -l as -hx2myl.

Lossless encoding

Dragging and dropping a (supported) file to wavpack.exe (/wvunpack.exe) will encode (/decode) it. This might be the simplest way, and in particular if the source is DSD (or 32-bit integer WAV) which players might decode to PCM floats - but will only apply default options. Dropping a .wv file onto wavpack.exe will recompress it using default settings (a bad deal if it was encoded with, say, -x4 - but default settings also means you will be prompted before it overwrites).

For fine-tuned performance, one might want to use the command-line encoder (or, Windows only, the GUI). The basic encoding usage is wavpack filename.wav (which creates filename.wv) or wavpack infilename.wav outfilename.wv; file extensions can be dropped (like wavpack infilename outfilename will encode infilename.wav to outfilename.wv) if there is no ambiguity. The manual (online, or included as wavpack_doc.html in the distribution) gives an exhaustive reference, and the following is merely a selection. Encoding using -hxm seems a sensible trade-off between compression and CPU load.

  • Compression. WavPack has four compression modes that affect compression as well as encoding and decoding time: fast (-f), default (no switch), high (-h) and very high (-hh). The WavPack manual warns against -hh for portable use due to its CPU-intensive decoding, which in van Beurden's comparison test amounts to twice the CPU load of -f. On top these modes, the optional -x1 to -x6 settings will perform extra compression that does not affect decoding CPU load, but take extra time encoding. -x without number is synonymous to -x1, which is often recommended (in all modes, fast/normal/high/extra high). The official manual calls -x4 to -x6 "extremely slow".

With DSD files, there are only two compression settings, normal (selected by -f or no switch) and high (selected by -h or -hh), and the -x switches are silently ignored.

  • Guarding against errors: Encoding with "-m" will compute an audio MD5 sum (like FLAC does by default) and store it for later verification. The "-v" switch will verify by computing (but not storing!) the MD5 sum upon encoding. (Using the corresponding switches in wvunpack will check without producing output file, however wvunpack also has a faster verification -vv for WavPack 5-encoded files.)
  • --import-id3 will import ID3v2.3 tags (currently not v2.4) present in the source file - typically in Sony DSF files - and convert them to WavPack's preferred APE tags. (This does not affect the chunk stored for restoring the original file.) By default, this is limited to 1 MB; for more, use --allow-huge-tags.
  • -r: remove extra (non-audio) chunks. By default, WavPack will store these in the .wv file for later bit-by-bit restoration of everything, not only the audio. To throw them away - like encoding through most players appear to do - use this setting.
  • -y: "yes" to everything. Use with caution, will overwrite.
  • -d: delete source file afterwards. Again, use with caution.
  • -l will force WavPack to run at low priority (Windows only)
  • -c with -b to select quality: Create correction file for hybrid use.

WavPack can recompress .wv files in place (using a temporary file until done). For example, wavpack -hx4mly wavpackfile.wv will recompress wavpackfile.wv the file in high mode, using -x4 extra processing, with low priority (assuming the Windows platform), write audio MD5 to it - and once done writing a temporary file, overwrite the old wavpackfile.wv.

Decoding

(To be expanded. Basic decoding usage is wvunpack filename.wv , which will decode to precisely the same as the input file provided that information was included upon encoding. Output filename can be given as )


using WavPack (hybrid) & using wvgain

(to be added)

Software support

With Android support and playback through ffmpeg, it might no longer be feasible to maintain a list of applications that can play WavPack files, and the following is most certainly incomplete - as is the list at https://www.wavpack.com/#Software .

Players

  • foobar2000 advanced freeware audio player plays/decodes WavPack out of the box on both Windows, MacOS, Android and iOS (Windows: supports encoding if wavpack.exe is installed, and redistributes the official wavpack.exe through its "Free encoder pack" addon for encoding. With ReplayGain & Cuesheets support.)
  • VLC multiplatform media player
  • VUPlayer (official plugin, supports encoding)
  • NullSoft Winamp (plugin with ReplayGain & Media Library support) and Winamp-compatible players
  • Windows Media Player and other directshow-based players (MPC, TCMP, RadLight) (with CoreWavPack directshow filter)
  • Cog Audio player for MacOS X.
  • XMMS (with Kuniklo's plugin)
  • LAMIP (official plugin)
  • MPXplay for DOS!
  • Aqualung for GNU/Linux
  • Cowon JetAudio Player
  • Konvertor Konvertor
  • XMPlay Plugin required (WavPack input plugin) and (bass library) to play 'wv' files

Frontends

Converters

Note: Several players, like Cowon JetAudio, foobar2000 and VUplayer, can also convert from other formats to WavPack!

Editors

  • Adobe Audition and Cool Edit (filter with 32-bit floats & extra info save support)

CD writers/rippers

Taggers

Other tools

It's worth mentioning the Matroska guys decided to concentrate on WavPack as the lossless compressor of choice for their container. Quite an honor... :-)

  • PKWare's .zip format compresses audio by WavPack since version 6.3.2 (2007). Beware that there is no expectation that other decompression software handles these zip files; even if PKWare co-designed the format and PKZip was the original .zip implementation, their subsequent compression methods are outside the ISO/IEC standardized zip format specification.


External links

  1. http://audiograaf.nl/downloads.html Martijn van Beurden's comprehensive lossless comparison. All comparisons taken from version 4 (WavPack version 4.70.0.)