WAV

Waveform Audio File Format (WAVE, or WAV due to its filename extension; pronounced  or  ) is an audio file format standard for storing an audio bitstream on personal computers. The format was developed and published for the first time in 1991 by IBM and Microsoft. It is the main format used on Microsoft Windows systems for uncompressed audio. The usual bitstream encoding is the linear pulse-code modulation (LPCM) format.

WAV is an application of the Resource Interchange File Format (RIFF) bitstream format method for storing data in chunks, and thus is similar to the 8SVX and the Audio Interchange File Format (AIFF) format used on Amiga and Macintosh computers, respectively.

Description
The WAV file is an instance of a Resource Interchange File Format (RIFF) defined by IBM and Microsoft. The RIFF format acts as a wrapper for various audio coding formats.

Though a WAV file can contain compressed audio, the most common WAV audio format is uncompressed audio in the linear pulse-code modulation (LPCM) format. LPCM is also the standard audio coding format for audio CDs, which store two-channel LPCM audio sampled at 44.1 kHz with 16 bits per sample. Since LPCM is uncompressed and retains all of the samples of an audio track, professional users or audio experts may use the WAV format with LPCM audio for maximum audio quality. WAV files can also be edited and manipulated with relative ease using software.

On Microsoft Windows, the WAV format supports compressed audio using the Audio Compression Manager (ACM). Any ACM codec can be used to compress a WAV file. The user interface (UI) for Audio Compression Manager may be accessed through various programs that use it, including Sound Recorder in some versions of Windows.

Beginning with Windows 2000, a  header was defined which specifies multiple audio channel data along with speaker positions, eliminates ambiguity regarding sample types and container sizes in the standard WAV format and supports defining custom extensions to the format.

RIFF
A RIFF file is a tagged file format. It has a specific container format (a chunk) with a header that includes a four-character tag (FourCC) and the size (number of bytes) of the chunk. The tag specifies how the data within the chunk should be interpreted, and there are several standard FourCC tags. Tags consisting of all capital letters are reserved tags. The outermost chunk of a RIFF file has a  tag; the first four bytes of chunk data are an additional FourCC tag that specify the form type and are followed by a sequence of subchunks. In the case of a WAV file, the additional tag is. The remainder of the RIFF data is a sequence of chunks describing the audio information.

The advantage of a tagged file format is that the format can be extended later while maintaining backward compatibility. The rule for a RIFF (or WAV) reader is that it should ignore any tagged chunk that it does not recognize. The reader will not be able to use the new information, but the reader should not be confused.

The specification for RIFF files includes the definition of an  chunk. The chunk may include information such as the title of the work, the author, the creation date, and copyright information. Although the  chunk was defined for RIFF in version 1.0, the chunk was not referenced in the formal specification of a WAV file. Many readers had trouble processing this. Consequently, the safest thing to do from an interchange standpoint was to omit the  chunk and other extensions and send a lowest-common-denominator file. There are other INFO chunk placement problems.

RIFF files were expected to be used in international environments, so there is  chunk to specify the country code, language, dialect, and code page for the strings in a RIFF file. For example, specifying an appropriate  chunk should allow the strings in an   chunk (and other chunks throughout the RIFF file) to be interpreted as Cyrillic or Japanese characters.

RIFF also defines a  chunk whose contents are uninteresting. The chunk allows a chunk to be deleted by just changing its FourCC. The chunk could also be used to reserve some space for future edits so the file could be modified without being resized. A later definition of RIFF introduced a similar  chunk.

RIFF WAVE
The top-level definition of a WAV file is:  → RIFF('WAVE'                              // Format of the file                   []         // Fact chunk                   []          // Cue points                   []     // Playlist                   [] // Associated data list                    )       // Wave data The top-level RIFF form uses a  tag. It is followed by a mandatory  chunk that describes the format of the sample data that follows. This chunk includes information such as the sample encoding, number of bits per channel, the number of channels, and the sample rate.

The WAV specification includes some optional features. The optional  chunk reports the number of samples for some compressed coding schemes. The  chunk identifies some significant sample numbers in the wave file. The  chunk allows the samples to be played out of order or repeated rather than just from beginning to end. The associated data list allows labels and notes to be attached to cue points; text annotation may be given for a group of samples (e.g., caption information).

Finally, the mandatory  chunk contains the actual samples in the format previously specified.

Note that the WAV file definition does not show where an  chunk should be placed. It is also silent about the placement of a  chunk (which specifies the character set used).

The RIFF specification attempts to be a formal specification, but its formalism lacks the precision seen in other tagged formats. For example, the RIFF specification does not clearly distinguish between a set of subchunks and an ordered sequence of subchunks. The RIFF form chunk suggests it should be a sequence container. Sequencing information is specified in the RIFF form of a WAV file consistent with the formalism: "However,  must always occur before , and both of these chunks are mandatory in a WAVE file." The specification suggests a  chunk is also a sequence: "A LIST chunk contains a list, or ordered sequence, of subchunks." However, the specification does not give a formal specification of the  chunk; an example     chunk ignores the chunk sequence implied in the   description. The  chunk definition for   does use the   chunk as a sequence container with good formal semantics.

The WAV specification supports, and most WAV files use, a single contiguous array of audio samples. The specification also supports discrete blocks of samples and silence that are played in order. The specification for the sample data contains apparent errors: The  contains the waveform data. It is defined as follows:  → {   (undefined) and   (defined but not referenced) should be identical. Even with this resolved, the productions then allow a  to contain a recursive   (which implies data interpretation problems). To avoid the recursion, the specification can be interpreted as:  → {   extension.