The wave file format is a widely supported format for storing digital audio. A wave file uses the Resource Interchange File Format (RIFF) file structure and hence data is organized in chunks as described below. Each chunk contains information about its type and size and can easily be skipped by software that does not understand the specific chunk type.
A wave file is organized as follows.
|Byte sequence description
|Length in bytes
|Starts at byte
|The ASCII character string "RIFF"
|The size of the wave file (number of bytes) less 8 (less the size of the "chunk ID" and the "size")
|RIFF type ID
|The ASCII character string "WAVE"
|Various chunks in the wave file as described below
All information is stored with the least significant byte first (little-endian). For example, if the 4-byte value for the average bytes per second in the format chunk is 88,200 = 0x00015888, this information will be stored with the following byte sequence.
0x88 0x58 0x01 0x00
All information in a wave file must be word aligned (i.e., aligned at every two bytes). If a chunk has an odd number of bytes, then it will be padded with a zero byte, although this byte will not be counted in the size of the chunk.
A wave file would include at least the following chunks.
Other chunks that may exist in a wave file include the following.
Other RIFF chunks
Since the RIFF format is used for other types of files, such as AVI files, a RIFF file can contain types of chunks that are not relevant to the wave file format. For example, the junk and pad chunks are used to add random data to the file to, perhaps, align the file chunks on a 2K boundary. A software application does not have to recognize or use all chunk types and may ignore certain chunks.