Using WavPack 4.2

WavPack consists of two complimentary executable programs, WavPack and WvUnpack. These programs allow you to compress (and restore) audio files in the Microsoft .wav format. The audio files must be uncompressed PCM (not ADPCM, for example), but other than that there are few restrictions. The files may any resolution from 8 to 32 bits; they may be mono, stereo, or multichannel; they may even be ieee floating point data. The programs are full 32-bit executables and therefore must only be used under Windows (for real DOS applications or with Windows 3.1 use WavPack 3.4 instead). They are initiated from the MS-DOS command line prompt with the following syntax:

Usage:
WAVPACK [-options] [@]infile[.wav]|- [[@]outfile[.wv]|outpath|-]
WVUNPACK [-options] [@]infile[.wv]|- [[@]outfile[.wav]|outpath|-]

The filename extensions will be defaulted if not provided and the input filename may contain wildcards for doing batch operations. Specifying the output filename is optional, and if more than one input file is specified (with wildcards) then the only acceptable output specification is an output path. If the input filename begins with a '@' then the file is assumed to contain a list of newline separated filenames to be processed in batch mode (the output file may also be done this way although it may contain only a single line). The Windows frontend uses this mechanism for passing filenames, although it could be used for other purposes. Either filename can be replaced with "-" to allow use of stdin or stdout, although because the hybrid lossless mode uses two files it is not compatible with pipes.

Both programs will warn before overwriting any file (unless the -y switch is specified). The programs will also (unless the -q switch is specified) display progress in percentage complete and when finished with each file will give the compression ratio (or bitrate for lossy files), whether the compression was lossy or lossless, and the processing time. They will also display the progress percentage for the whole batch of files on the title bar which is useful when they are being run minimized. If a batch of files is run then both programs will indicate when complete whether any errors occurred and how many files were processed.

The compressed file format (.wv) contains all original header information and the compressed audio data for one .wav file. The file can be used by WvUnpack to restore the original file, or the .wv file can be played directly by a player that supports WavPack files like winamp, foobar2000 or Apollo using the supplied plug-ins. Also, there are plugins available to use WavPack files with Adobe Audition (formerly CoolEdit) and Nero Burning ROM.


WavPack Options

-a = Adobe Audition (CoolEdit) mode for 32-bit floats

The WAVEFORMATEXTENSIBLE structure is used (if present) to determine the format details. However, there are some programs that use their own non-standard format extensions. The most popular of these is Adobe's Audition (previously Syntrillium's CoolEdit) which created two new 32-bit floating point formats. An option has been added to WavPack (-a) to force the "adobe" interpretation of these floating point formats. If you are compressing integer files do NOT use this option.

-bn = enable hybrid compression, n = 2.0 to 23.9 bits/sample, or
                                 n = 24-9600 kbits/second (kbps)

The default operation of WavPack is pure lossless, which means that the .wv file contains all the information that was in the original .wav file. The hybrid mode allows the user to specify a target bitrate for the output file, either in kilobits per second (kbps) or bits per sample. If the track can be losslessly compressed without exceeding the specified bitrate, then it will be and WavPack will report the compression as lossless. If lossless compression would exceed the specified bitrate, then WavPack will begin carefully discarding the least significant portion of the audio information to stay within the limit. Every effort is made to keep this inaudible, including the use of joint stereo, dynamic bit allocation and noise shaping. WavPack will report this as "lossy" compression. Although the option accepts bitrates as low as 24 kbps, the actual value that WavPack can achieve is usually much higher than that. For example, with CD-audio sampled at 44.1k the lower limit is about 196 kbps.

-c = create correction file (.wvc) for hybrid mode (=lossless)

If the -c option is specified (in addition to the -b option), then WavPack will generate an additional file that will contain the information that was discarded to generate the lossy .wv file. This file will have the same name as the .wv file but will have the extension .wvc (the 'c' is for "correction"). When WvUnpack is used to restore the .wav file, it will attempt to find the .wvc file in the same directory as the .wv file. If it is found then the decompression will be lossless and will be reported as such, otherwise lossy decompression will be reported (assuming that any information was actually discarded during the original compression). If -c is specified but no actual information is discarded, the correction file will be deleted. The extra overhead involved with having these two files instead of a single pure lossless file is usually less than 1% of the original .WAV file and can be as low as 0.25% at high bitrates. Note that CRCs are stored for both the lossy and lossless versions, so error detection works correctly whether the .wvc file is used or not.

-cc = maximum hybrid compression (hurts lossy quality & decode speed)

Normally, when the -c option is used to create a correction file in the hybrid mode, WavPack attempts to optimize for the quality of the lossy file and let the combined lossless compression of the two files fall where it may. This option tells WavPack to optimize for the overall compression ratio instead, even if this means some possible degradation of lossy quality (and this can also have a small effect on lossless decompression speed). Keep in mind the effect of this option is not too significant either way.

-d = delete source file if successful (use with caution!)

Self explanatory.

-e = create self-extracting executable (needs wvselfx.exe)

WavPack can be used to create self-extracting archives (Windows only) with a .exe extension. In this way it is possible to distribute compressed audio without having the recipient install any other programs (or have any dlls) to unpack the archives. When the .exe file is run (directly or by double-clicking) it extracts the original .wav file into the same directory. If it can't (because the file exists or it is run on a read-only device) then it displays a standard Windows "Extract to" dialog box and allows the user to specify the destination. The self-extracting feature can be used with WavPack's hybrid modes as well as pure lossless. If a .wvc file (with the correct name) is present in the same directory as the executable, then a lossless extraction is automatically performed. It is possible to turn the .exe file back into a valid WavPack by simply changing the extension back to .wv (although the extra 30k unpacking header will still be there).

To convert an existing WavPack 4.x file into a self-extracting executable use the DOS copy command to prepend the self-extracting stub (wvselfx.exe) to the .wv file:

C:\music_files>copy /b wvselfx.exe+music.wv music.exe

-f = fast mode (fast, but some compromise in compression ratio)

The "fast" mode should be used when compression (or decompression) speed is more important than compression ratio (or, in lossy mode, audio quality).

-jn = joint-stereo override (0 = left/right, 1 = mid/side)

WavPack normally defaults to joint stereo (sometimes called mid/side) in which the left and right channels are combined to form an alternate representation (essentially L+R and L-R) that compresses better in lossless mode and improves quality in lossy mode. This option allows this feature to be forced either on or off.

-h = high quality (best compression in all modes, but slower)

The "high" mode should be used when compression ratio (or, in lossy mode, audio quality) is more important than compression (or decompression) speed. This option slows both by about a factor of 2.

-i = ignore length in wav header (no pipe output allowed)

Some programs that pipe data to encoders do not always give the correct length in the wav headers that they provide (foobar's clienc and CDex are examples). In these cases use this option to force WavPack to ignore the header and accept the actual length. Because WavPack must seek to the beginning of the file to write the correct length, this option cannot be used with piped output.

-m = compute & store MD5 signature of raw audio data

Calculate and display the MD5 checksum of the uncompressed audio data and store it in the compressed file. These sums are commonly used in file trading communities to compare versions of tracks, and as such the sums generated by WavPack match those of FLAC, OptimFROG, Shntool, and get_id3(). They can also be used by WvUnpack during decompression to verify the data integrity of lossless files.

-n = calculate average and peak quantization noise (hybrid only)

This causes WavPack to calculate the average and peak quantization noise generated in the lossy version of the hybrid mode, both referenced in decibels below full scale. While it is impossible to use this as a guide to determine the audibility of the noise, it is useful for comparing the various compression options and for comparing WavPack's lossy performance to other programs. Note that this option does not currently produce meaningfull results for floating point or multichannels files.

-p = practical float storage (also 32-bit ints, not lossless)

This option reduces the storage of some floating-point data files by up to about 10% by eliminating some information that has virtually no effect on the audio data. While this does technically make the compression lossy, it retains all the advantages of floating point data (>600 dB of dynamic range, no clipping, and 25 bits of resolution). This also affects large integer compression by limiting the resolution to 24 bits.

-q = quiet (keep console output to a minimum)

Self explanatory.

-sn = noise shaping override (hybrid only, n = -1.0 to 1.0, 0 = off)

WavPack uses first-order noise shaping to improve the perceived quality of lossy files and to improve the hybrid lossless compression ratio. Normally WavPack will choose the noise shaping most appropriate for the application, but this option allows the user to override the default. The parameter range is +/- 1.0, where positive values shift the noise higher in frequency and negative values shift the noise lower in frequency. Values very close to -1.0 are clipped to prevent problems associated with very high gain near DC.

-t = copy input file's time stamp to output file(s)

Self explanatory.

-w "Field=Value" = write specified metadata to APEv2 tag

Write specified information to APEv2 tag appended to WavPack file(s). May be used multiple times for multiple fields. APEv2 tags are the preferred tag format for WavPack files and are read by all the standard WavPack playback plugins. If the specified value begins with a '@', then the value is assumed to be a filename which is used to obtain the item's actual value. This is handy for including the CUESHEET field for use with images files with cuesheets and foobar2000.

-x[n] = extra encode processing (optional n = 1-6 for more/less)

Like previous versions of WavPack (and many other compressors), WavPack 4.2 normally works "symmetrically" in that encoding and decoding operate at about the same rate (regardless of the mode used). However, WavPack now has an option to work "asymmetrically", so that extra processing can be done during encoding to provide better compression, but with NO corresponding cost to decoding performance!

This is enabled with the -x option and provides an average improvement in CD music compression of about 1% in "fast" mode, about 0.5% in the normal mode, and about 0.25% in "high" mode. Because the standard compression parameters are optimized for "normal" CD music audio, this option works best with "non-standard" audio (synthesized sounds, non-standard sampling rates, etc) where it can often achieve enormous gains. It should be noted that this mode is not just a little slower than the regular mode; it is MUCH slower. However, the fact that it has no effect on decode time could make it attractive in some situations.

The "extra" option provides a level of extra processing that has been optimized for the encoding mode selected (i.e. normal, "fast" or "high"). This level can be overridden with the optional numeric parameter from 1 to 6, although this is not generally recommended.

-y = yes to all warnings (use with caution!)

Self explanatory.


WvUnpack Options

-d = delete source file if successful (use with caution!)

Self explanatory.

-i = ignore .wvc file (forces hybrid lossy decompression)

This option forces WvUnpack to not look for a corresponding correction file when unpacking hybrid mode files. This could be used to compare the effects of the hybrid lossy mode or in the case that the .wvc had become corrupt and was preventing decompression (although this is unlikely).

-m = calculate and display MD5 signature; verify if lossless

Enables the calculation and display of the MD5 checksum on the uncompressed audio data. If an MD5 sum for the original audio data is stored in the WavPack file then this will be displayed also. For lossless operation these numbers should match (and WvUnpack will verify that they match). For lossy operation these numbers should not match.

-q = quiet (keep console output to a minimum)

Self explanatory.

-r = force raw audio decode (skip RIFF headers & trailers)

This option causes WvUnpack to strip off the standard wav file header (and any trailer) and only output the uncompressed audio data. If a file is created then it will be given the .raw extension instead of the standard .wav extension.

-s = display summary information only to stdout (no decode)

This option causes WvUnpack to simply display general information about the specified WavPack files including source information, encoder version and options and original MD5 checksum. This information can be directed into a file with the ">" operator. No file decoding or verification can occur with this option.

-t = copy input file's time stamp to output file(s)

Self explanatory.

-v = verify source data only (no output file created)

This option allows the user to verify the integrity of WavPack files (including any correction file). Note that this option not only verfies that a WavPack file has not been corrupted since creation, but it also verfies that the audio data is being unpacked exactly as intended (even in the lossy mode). Therefore, it can also detect algorithm errors, incompatible implementations of the encoder or decoder, and even faulty processor hardware.

-y = yes to overwrite warning (use with caution!)

Self explanatory.


Usage Guide

The options of WavPack can be a little confusing at first, so here's a little tutorial on what to try first if you're not sure. First of all, if you are only interested in lossless compression, try the default operation with no options. This will give a decent compression ratio at a very good speed for both packing and unpacking. If speed is less of an issue try the "high" mode (-h), this will just about double both the packing and unpacking time (although still not nearly as slow as many other lossless compressors) while improving the compression ratio somewhat. If speed is paramount use the "fast" (-f) option. This gives the fastest packing and unpacking speed possible with WavPack, while still providing a very reasonable compression ratio.

If decoding speed is important, but the time to encode is not (because it happens only once), give the -x option a try. This will slow the encoding way down (like 5 to 20 times, depending on mode!) but has no effect on decoding speed. In some music files, this option can actually bump the compression ratio a whole mode (i.e. the "fast" mode can match the default mode, etc.). For the best lossless compression WavPack can offer, use -hx.

If you want to try the hybrid mode, all the above applies but you also have to choose a bitrate. The quality of WavPack's lossy mode cannot match the conventional lossy codecs like MP3 and WMA at similar bitrates, and in fact it won't even operate at the most common bitrate of 128 kbps (with CD audio, at least). The lowest bitrate that I recommend for WavPack lossy is 256 kbps which can provide transparent reproduction for most non-critical listening situations and is roughly equivalent to MP3 at 160 kbps. Above 256 kbps the quality of WavPack's lossy mode increases rapidly, with added quantization noise (which is the only artifact) dropping by about 1 dB for every 15 kbps. At 320 kbps the quality is difficult for even critical listeners to distinguish from the original, and at 384 kbps WavPack becomes essentially transparent.

The various modes and options that apply to lossless mode also apply to hybrid mode. However the "extra" mode (-x) deserves a special mention. Most of the time, the "extra" mode makes only modest improvements because WavPack has already been finely tuned for ordinary music. However, sometimes there is an instrument or sound situation that does not compress well with the standard settings and the "extra" mode can make a significant improvement. In lossless mode this would slightly improve the overall compression ratio and would probably go unnoticed. However, in lossy mode that difficult section might trigger clearly audible noise to be added, and in this case the "extra" mode would save the day by greatly reducing the noise in the exact spot where it might have been audible.

Here is a chart of recommended settings for the various useful bitrates:

	 Bitrate     High quality   Faster Encode   Faster Decode 
 	 -------     ------------   -------------   ------------- 
 	 256 kbps    -hb256x        -hb256          -b256x 
 	 320 kbps    -hb320x        -hb320          -b320x 
 	 384 kbps    -b384x         -hb384          -fb384x
				

Plugins

The documentation for the various WavPack plugins is provided as readme.txt files included with those plugins.


WavPack and its associated utilities are free programs; feel free to give them to anyone who may find them useful. There is no warrantee provided and you agree to use them completely at your own risk. Be sure to visit www.wavpack.com for the latest version of WavPack.


home

XHTML 1.0
CSS 2.1