📄 microsoft wave soundfile format.mht
字号:
From: <Saved by Microsoft Internet Explorer 5>
Subject: Microsoft WAVE soundfile format
Date: Mon, 5 Dec 2005 13:47:49 +0800
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="----=_NextPart_000_0000_01C5F9A2.7B5A97C0"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
This is a multi-part message in MIME format.
------=_NextPart_000_0000_01C5F9A2.7B5A97C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://ccrma.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-----------------------------------------------------------------------=
-----><HTML><HEAD><TITLE>Microsoft WAVE soundfile format</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"Craig Sapp (craig@ccrma.stanford.edu)" =
name=3DDocument-Owner>
<META content=3D"Craig Stuart Sapp (craig@ccrma.stanford.edu)" =
name=3DAuthor>
<META content=3D" Thu Dec 11 08:28:30 GMT-0800 1997 " =
name=3DCreation-Date>
<META content=3D" Thu Dec 11 08:28:37 GMT-0800 1997 " =
name=3DRevision-Date><!--------------------------------------------------=
-------------------------->
<META content=3D"MSHTML 6.00.2900.2769" name=3DGENERATOR></HEAD>
<BODY bgColor=3D#b7cbed>
<H1>WAVE PCM soundfile format=20
<HR noShade>
</H1>
<P>The WAVE file format is a subset of Microsoft's RIFF specification =
for the=20
storage of multimedia files. A RIFF file starts out with a file header =
followed=20
by a sequence of data chunks. A WAVE file is often just a RIFF file with =
a=20
single "WAVE" chunk which consists of two sub-chunks -- a "fmt " chunk=20
specifying the data format and a "data" chunk containing the actual =
sample data.=20
Call this form the "Canonical form". Who knows how it really all works. =
An=20
almost complete description which seems totally useless unless you want =
to spend=20
a week looking over it can be found at <A=20
href=3D"http://premium.microsoft.com/msdn/library/tools/dnmult/d1/nwvtype=
.htm"=20
target=3D_top>MSDN</A> (mostly describes the non-PCM, or registered =
proprietary=20
data formats).=20
<P>I use the standard WAVE format as created by the <A=20
href=3D"http://www.spies.com/Sox/" target=3D_top>sox</A> program:=20
<P>
<CENTER><IMG=20
src=3D"http://ccrma.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/wa=
v-sound-format.gif">=20
</CENTER><PRE>Offset Size Name Description
<HR noShade>
The canonical WAVE format starts with the RIFF header:
0 4 <B>ChunkID</B> Contains the letters "RIFF" in =
ASCII form
(0x52494646 big-endian form).
4 4 <B>ChunkSize</B> 36 + SubChunk2Size, or more =
precisely:
4 + (8 + SubChunk1Size) + (8 + =
SubChunk2Size)
This is the size of the rest of the chunk =
following this number. This is the size =
of the=20
entire file in bytes minus 8 bytes for =
the
two fields not included in this count:
ChunkID and ChunkSize.
8 4 <B>Format</B> Contains the letters "WAVE"
(0x57415645 big-endian form).
The "WAVE" format consists of two subchunks: "fmt " and "data":
The "fmt " subchunk describes the sound data's format:
12 4 <B>Subchunk1ID</B> Contains the letters "fmt "
(0x666d7420 big-endian form).
16 4 <B>Subchunk1Size</B> 16 for PCM. This is the size of =
the
rest of the Subchunk which follows this =
number.
20 2 <B>AudioFormat</B> PCM =3D 1 (i.e. Linear =
quantization)
Values other than 1 indicate some=20
form of compression.
22 2 <B>NumChannels</B> Mono =3D 1, Stereo =3D 2, etc.
24 4 <B>SampleRate</B> 8000, 44100, etc.
28 4 <B>ByteRate</B> =3D=3D SampleRate * NumChannels * =
BitsPerSample/8
32 2 <B>BlockAlign</B> =3D=3D NumChannels * =
BitsPerSample/8
The number of bytes for one sample =
including
all channels. I wonder what happens when
this number isn't an integer?
34 2 <B>BitsPerSample</B> 8 bits =3D 8, 16 bits =3D 16, etc.
<FONT color=3D#888888> 2 <B>ExtraParamSize</B> if PCM, then =
doesn't exist
X <B>ExtraParams</B> space for extra parameters</FONT>
The "data" subchunk contains the size of the data and the actual sound:
36 4 <B>Subchunk2ID</B> Contains the letters "data"
(0x64617461 big-endian form).
40 4 <B>Subchunk2Size</B> =3D=3D NumSamples * NumChannels * =
BitsPerSample/8
This is the number of bytes in the data.
You can also think of this as the size
of the read of the subchunk following =
this=20
number.
44 * <B>Data</B> The actual sound data.
<HR noShade>
</PRE><PRE>
</PRE><A name=3Dexample></A>
<P>As an example, here are the opening 72 bytes of a WAVE file with =
bytes shown=20
as hexadecimal numbers: <PRE><B>52 49 46 46 24 08 00 00 57 41 56 45 66 =
6d 74 20 10 00 00 00 01 00 02 00 </B>
<B>22 56 00 00 88 58 01 00 04 00 10 00 64 61 74 61 00 08 00 00 00 00 00 =
00 </B>
<B>24 17 1e f3 3c 13 3c 14 16 f9 18 f9 34 e7 23 a6 3c f2 24 f2 11 ce 1a =
0d </B>
</PRE>
<P>Here is the interpretation of these bytes as a WAVE soundfile: <IMG=20
src=3D"http://ccrma.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/wa=
ve-bytes.gif">=20
<HR noShade>
<H3>Notes: </H3>
<UL>
<LI>The default byte ordering assumed for WAVE data files is =
little-endian.=20
Files written using the big-endian byte ordering scheme have the =
identifier=20
RIFX instead of RIFF.=20
<LI>The sample data must end on an even byte boundary. Whatever that =
means.=20
<LI>8-bit samples are stored as unsigned bytes, ranging from 0 to 255. =
16-bit=20
samples are stored as 2's-complement signed integers, ranging from =
-32768 to=20
32767.=20
<LI>There may be additional subchunks in a Wave data stream. If so, =
each will=20
have a char[4] SubChunkID, and unsigned long SubChunkSize, and =
SubChunkSize=20
amount of data.=20
<LI>RIFF stands for <I>Resource Interchange File Format</I>. =
</LI></UL>
<H3>General discussion of RIFF files: </H3>Multimedia applications =
require the=20
storage and management of a wide variety of data, including bitmaps, =
audio data,=20
video data, and peripheral device control information. RIFF provides a =
way to=20
store all these varied types of data. The type of data a RIFF file =
contains is=20
indicated by the file extension. Examples of data that may be stored in =
RIFF=20
files are:=20
<UL>
<LI>Audio/visual interleaved data (.AVI)=20
<LI>Waveform data (.WAV)=20
<LI>Bitmapped data (.RDI)=20
<LI>MIDI information (.RMI)=20
<LI>Color palette (.PAL)=20
<LI>Multimedia movie (.RMN)=20
<LI>Animated cursor (.ANI)=20
<LI>A bundle of other RIFF files (.BND) </LI></UL>NOTE: At this point, =
AVI files=20
are the only type of RIFF files that have been fully implemented using =
the=20
current RIFF specification. Although WAV files have been implemented, =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -