Template: Infobox file format / Maintenance / Magic number is missing template: Infobox file format / Maintenance / default missing template: Infobox file format / Maintenance / missing site

The WAVE file format is a container format for digital storage of audio data that is based on the Resource Interchange File Format ( RIFF ) defined by Microsoft for Windows. A WAVE file contains at least information about the format of the audio data.

Included are mostly so-called PCM raw data, ie, a time and value discrete representation of the time course of a signal. The quality of the recorded sound then depends on two values ​​, the sampling rate (number of samples per unit of time ) and the resolution ( bit depth ); in the case of compressed data and the process, such as ADPCM or MP3.

In contrast to similar AIFF format can be in WAV ID3 tags store.

File structure

The RIFF format consists of several sections (English chunks ), which are constructed as the IFF, except for the byte sequence: forward significant byte (LSB ). The WAVE specification defines three sections as mandatory: The RIFF section identifies the file as a wav file and contains as a container the other sections. . The FORMAT section contains parameters such as the sampling rate. The DATA section contains the waveform.

Over the uncoordinated development of a vast number of other types of sections created with partly redundant content. One example is the "Label" section and " Note" section, which provided both Cuepoint entries in the "Cue " section with a caption. It refers to a "label" the title of a Cue point, "note " comments. They are stored as subsections (English subchunks ) in the parent Associated Data List section. Furthermore, there are a variety of compressed formats for which a " Fact" section with the decompressed size is authentic, but otherwise define a wide variety of parameters, which makes a complete support the WAV format for developers even more difficult.

RIFF section (also " RIFF WAVE " section )

It contains, as the other portions of the container, its header consisting only of

  • ChunkID (char, " RIFF " )
  • ChunkSize ( uint32_t = file length in bytes - 8)
  • RiffType (char, "WAVE " )

"Format" section

It begins with the identification " fmt " and must be exactly in the file be included once - and be the first subsection, what you can but neither leave like that the data chunk is the last. On his ChunkSize follows the content that consists of a set of general parameters and a subsequent format-specific part. The general part:

  • WFormatTag identification of the format used, for example, is 0x0001 for PCM, the canonical, uncompressed format
  • WChannels ( uint16_t )
  • DwSamplesPerSec ( uint32_t, sample rate in Hz, for example, stands for 0x0000AC44 44100 )
  • DwAvgBytesPerSec ( uint32_t, necessary transmission bandwidth )
  • WBlockAlign ( uint16_t, size of the frame in bytes)

For PCM data format of the section has only this one box:

  • WBitsPerSample ( uint16_t, quantization resolution, the same for all channels)

If no compression used dwAvgBytesPerSec is the product of the sampling rate and frame size. The frame size is determined by the requirement that all values ​​in the data section as an integer ( "integer" ) to encode are with just sufficient size in bytes ( any necessary padding bits are at the low- end with the value 0 ). For PCM format

So that the frame size for 12-bit stereo not be three, but four bytes.

"Data" section

He has the identifier "data". His chunkSize contains (as with all sections ) neither the 8 bytes of code size and even possibly at the end of specified alignment on word boundaries Needful zero byte. Its content is a sequence of frames.

In the case of PCM data, each frame containing a " sample " of samples, one per channel. With two channels (stereo ) is first the left, then stored the right channel. Samples are to 8 encoding bit depths as unsigned char, or signed int Bit - depths that are not divisible by 8, the least significant byte (LSB ) ( zero-padding ) is right-padded with zeros. This results, for example, the largest positive 12 -bit value " 0x7FF " byte sequence " 0xF0 0x7F ".

This format, stored without header usually has the extension *. Raw and skips when the knowledge of sampling rate, bit depth and byte order ahead (the latter is defined only by RIFF, not for raw PCM).

The size of the "Data" section in the data format PCM is calculated as follows: drop per second dwSamplesPerSec frames each wChannels samples, each one or two bytes. For CD quality ( 16 bit stereo = 4 bytes per sample ( 2 bytes per channel ), 44,100 Hertz), for example, or about 10 megabytes per minute (60 s × 44,100 Hz · 4 byte).

Example of a well -read WAVE PCM format

RIFF header ( 12 bytes ):

The fmt section ( 24 bytes ) describes the format of the individual samples:

The data section contains the samples:

Data formats ( format tag )


Due to the file format used in 32 -bit fields results in a size limit of 4 GiB, which corresponds to a playing time of about 6.75 hours with two channels of 16 bit and 44100 samples per second ( CD quality). At higher amplitude or time resolution or more channels, the achievable cycle duration decreases respectively. To circumvent this limitation, Sonic Foundry has presented an extension of the format, which bypasses the file size limit. Since the field of desktop software from Sonic Foundry went over to Sony Pictures Digital is the format of Sony Pictures Digital Wave 64, shortly Wave64 called; it is made available without licensing costs. As a file name extension. W64 proposed. The internal structure is consciously modeled on the conventional WAVE to simplify the software implementation. By using 64 -bit fields would result under the assumptions made above a limit of a maximum playing time of more than 3 million years ago.