audio interchange file format
wave file format
wave file format is a file format for storing digital audio (waveform) data. it supports a variety of bit resolutions, sample rates, and
channels of audio. this format is very popular upon ibm pc (clone) platforms, and is widely used in professional programs that process
digital audio waveforms. it takes into account some pecularities of the intel cpu such as little endian byte order.
this format uses microsoft's version of the electronic arts interchange file format method for storing data in "chunks".
data types
a c-like language will be used to describe the data structures in the file. a few extra data types that are not part of standard c, but which
will be used in this document, are:
pstring
pascal-style string, a one-byte count followed by that many text bytes. the total number of bytes in this data type should be
even. a pad byte can be added to the end of the text to accomplish this. this pad byte is not reflected in the count.
id a chunk id (ie, 4 ascii bytes).
also note that when you see an array with no size specification (e.g., char ckdata[];), this indicates a variable-sized array in our c-like
language. this differs from standard c arrays.
constants
decimal values are referred to as a string of digits, for example 123, 0, 100 are all decimal numbers. hexadecimal values are preceded by
a 0x - e.g., 0x0a, 0x1, 0x64.
data organization
all data is stored in 8-bit bytes, arranged in intel 80x86 (ie, little endian) format. the bytes of multiple-byte values are stored with the
low-order (ie, least significant) bytes first. data bits are as follows (ie, shown with bit numbers on top):
7 6 5 4 3 2 1 0
+-----------------------+
char: | lsb msb |
+-----------------------+
7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8
+-----------------------+-----------------------+
short: | lsb byte 0 | byte 1 msb |
+-----------------------+-----------------------+
7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 23 22 21 20 19 18 17 16 31 30 29
28 27 26 25 24
+-----------------------+-----------------------+-----------------------
+-----------------------+
long: | lsb byte 0 | byte 1 | byte 2 |
byte 3 msb |
+-----------------------+-----------------------+-----------------------
+-----------------------+
file structure
a wave file is a collection of a number of different types of chunks. there is a required
format ("fmt ") chunk
which contains important
parameters describing the waveform, such as its sample rate. the data chunk, which contains the actual waveform data, is also required.
file:////E|/=Study/audio标准/wav格式/微软wav file format.htm (1 of 34)2006-5-29 10:34:25