⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wave file format.mht

📁 wave format document
💻 MHT
📖 第 1 页 / 共 4 页
字号:
looped section of a waveform.</P>
<P>The dwPurpose field specifies the type or purpose of the text. For =
example,=20
dwPurpose can contain an ID like "scrp" for script text or "capt" for=20
close-caption text. How is this related to waveform data? Well, it isn't =
really.=20
It's just that Associated Data Lists are used in other file formats, so =
they=20
contain generic fields that sometimes don't have much relevance to =
waveform=20
data.</P>
<P>The wCountry, wLanguage, and wCodePage fields specify the country =
code,=20
language/dialect, and code page for the text. An application typically =
queries=20
these values from the operating system.</P>
<HR>

<H3><FONT color=3D#ff8040>Sampler Chunk</FONT></H3>
<P>The Sampler (smpl) Chunk defines basic parameters that an instrument, =
such as=20
a MIDI sampler, could use to play the waveform data. Most importantly, =
it=20
includes information about looping the waveform (ie, during playback, to =

"sustain" the waveform). Of course, as you've come to expect from the =
WAVE file=20
format, it duplicates some of the information that can be found in the =
Cue and=20
Playlist chunks, but fortunately, in a more sensible, consistent,=20
better-documented way.</P><PRE><B><FONT size=3D3><FONT =
color=3Dgreen>#define</FONT> SamplerID 'smpl'  <FONT color=3Dbrown>/* =
chunk ID for Sampler Chunk */</FONT>

<FONT color=3Dgreen>typedef struct</FONT> {
  ID             chunkID;
  <FONT color=3Dgreen>long</FONT>           chunkSize;

  <FONT color=3Dgreen>long</FONT>           dwManufacturer;
  <FONT color=3Dgreen>long</FONT>           dwProduct;
  <FONT color=3Dgreen>long</FONT>           dwSamplePeriod;
  <FONT color=3Dgreen>long</FONT>           dwMIDIUnityNote;
  <FONT color=3Dgreen>long</FONT>           dwMIDIPitchFraction;
  <FONT color=3Dgreen>long</FONT>           dwSMPTEFormat;
  <FONT color=3Dgreen>long</FONT>           dwSMPTEOffset;
  <FONT color=3Dgreen>long</FONT>           cSampleLoops;
  <FONT color=3Dgreen>long</FONT>           cbSamplerData;
  <FONT color=3Dgreen>struct</FONT> SampleLoop Loops[];
} SamplerChunk;
</FONT></B></PRE>The ID is always <B>smpl</B>. chunkSize is the number =
of bytes=20
in the chunk, not counting the 8 bytes used by ID and Size fields nor =
any=20
possible pad byte needed to make the chunk an even size (ie, chunkSize =
is the=20
number of remaining bytes in the chunk after the chunkSize field, not =
counting=20
any trailing pad byte).=20
<P>The dwManufacturer field contains the MMA Manufacturer code for the =
intended=20
sampler. Each manufacturer of MIDI products has his own ID assigned to =
him by=20
the MIDI Manufacturer's Association. See the MIDI Specification (under =
<A=20
href=3D"http://www.borg.com/~jglatt/tech/midispec.htm#Common">System=20
Exclusive</A>) for a listing of current Manufacturer IDs. The high byte =
of=20
dwManufacturer indicates the number of low order bytes (1 or 3) that are =
valid=20
for the manufacturer code. For example, this value will be 0x01000013 =
for=20
Digidesign (the MMA Manufacturer code is one byte, 0x13); whereas =
0x03000041=20
identifies Microsoft (the MMA Manufacturer code is three bytes, 0x00 =
0x00 0x41).=20
If the WAVE is not intended for a specific manufacturer, then this field =
should=20
be set to 0.</P>
<P>The dwProduct field contains the Product code (ie, model ID) of the =
intended=20
sampler for the dwManufacturer. Contact the manufacturer of the sampler =
to=20
ascertain the sampler's model ID. If the WAVE is not intended for a =
specific=20
manufacturer's product, then this field should be set to 0.</P>
<P>The dwSamplePeriod field specifies the period of one sample in =
nanoseconds=20
(normally 1/nSamplesPerSec from the Format chunk. But note that this =
field=20
allows finer tuning than nSamplesPerSec). For example, 44.1 KHz would be =

specified as 22675 (0x00005893).</P>
<P>The dwMIDIUnityNote field is the MIDI note number at which the =
instrument=20
plays back the waveform data without pitch modification (ie, at the same =
sample=20
rate that was used when the waveform was created). This value ranges 0 =
through=20
127, inclusive. Middle C is 60.</P>
<P>The dwMIDIPitchFraction field specifies the fraction of a semitone up =
from=20
the specified dwMIDIUnityNote. A value of 0x80000000 is 1/2 semitone (50 =
cents);=20
a value of 0x00000000 represents no fine tuning between semitones.</P>
<P>The dwSMPTEFormat field specifies the SMPTE time format used in the=20
dwSMPTEOffset field. Possible values are:</P><PRE>0  =3D no SMPTE offset =
(dwSMPTEOffset should also be 0)
24 =3D 24 frames per second
25 =3D 25 frames per second
29 =3D 30 frames per second with frame dropping ('30 drop')
30 =3D 30 frames per second=09
</PRE>The dwSMPTEOffset field specifies a time offset for the sample if =
it is to=20
be syncronized or calibrated according to a start time other than 0. The =
format=20
of this value is 0xhhmmssff. hh is a signed Hours value [-23..23]. mm is =
an=20
unsigned Minutes value [0..59]. ss is unsigned Seconds value [0..59]. ff =
is an=20
unsigned value [0..(<DWSMPTEFORMAT> - 1)].=20
<P>The cSampleLoops field is the number (count) of SampleLoop structures =
that=20
are appended to this chunk. These structures immediately follow the=20
cbSamplerData field. This field will be 0 if there are no SampleLoop=20
structures.</P>
<P>The cbSamplerData field specifies the size (in bytes) of any optional =
fields=20
that an application wishes to append to this chunk. An application which =
needed=20
to save additional information (ie, beyond the above fields) may append=20
additional fields to the end of this chunk, after all of the SampleLoop=20
structures. These additional fields are also reflected in the ChunkSize, =
and=20
remember that the chunk should be padded out to an even number of bytes. =
The=20
cbSamplerData field will be 0 if no additional information is appended =
to the=20
chunk.</P>
<P>What follows the above fields are any SampleLoop structures. Each =
SampleLoop=20
structure defines one loop (ie, the start and end points of the loop, =
and how=20
many times it plays). What follows any SampleLoop structures are any =
additional,=20
proprietary sampler information that an application chooses to =
store.</P>
<H4>SampleLoop Structure</H4><PRE><B><FONT size=3D3><FONT =
color=3Dgreen>typedef struct</FONT> {
  <FONT color=3Dgreen>long</FONT>  dwIdentifier;
  <FONT color=3Dgreen>long</FONT>  dwType;
  <FONT color=3Dgreen>long</FONT>  dwStart;
  <FONT color=3Dgreen>long</FONT>  dwEnd;
  <FONT color=3Dgreen>long</FONT>  dwFraction;
  <FONT color=3Dgreen>long</FONT>  dwPlayCount;
} SampleLoop;
</FONT></B></PRE>
<P>The dwIdentifier field contains a unique number (ie, different than =
the ID=20
number of any other SampleLoop structure). This field may correspond =
with the=20
dwIdentifier field of some CuePoint stored in the Cue chunk. In other =
words, the=20
CuePoint structure which has the same ID number would be considered to =
be=20
describing the same loop as this SampleLoop structure. Furthermore, this =
field=20
corresponds to the dwIndentifier field of any label stored in the =
Associated=20
Data List. In other words, the text string (within some chunk in the =
Associated=20
Data List) which has the same ID number would be considered to be this =
loop's=20
"name" or "label".</P>
<P>The dwType field is the loop type (ie, how the loop plays back) as =
so:</P>
<P>
<TABLE NOBORDER>
  <TBODY>
  <TR>
    <TD vAlign=3Dtop>0</TD>
    <TD bgColor=3D#99cccc>Loop forward (normal)</TD></TR>
  <TR>
    <TD vAlign=3Dtop>1</TD>
    <TD bgColor=3D#99cccc>Alternating loop (forward/backward)</TD></TR>
  <TR>
    <TD vAlign=3Dtop>2</TD>
    <TD bgColor=3D#99cccc>Loop backward</TD></TR>
  <TR>
    <TD vAlign=3Dtop>3 - 31</TD>
    <TD bgColor=3D#99cccc>reserved for future standard types</TD></TR>
  <TR>
    <TD vAlign=3Dtop>32 - ?</TD>
    <TD bgColor=3D#99cccc>sampler specific types (manufacturer=20
  defined)</TD></TR></TBODY></TABLE></P>The dwStart field specifies the =
startpoint=20
of the loop. In other words, it's the byte offset from the start of=20
waveformData[], where an offset of 0 would be at the start of the =
waveformData[]=20
array (ie, the loop start is at the very first sample point).=20
<P>The dwEnd field specifies the endpoint of the loop (ie, a byte =
offset).</P>
<P>The dwFraction field allows fine-tuning for loop fractional areas =
between=20
samples. Values range from 0x00000000 to 0xFFFFFFFF. A value of =
0x80000000=20
represents 1/2 of a sample length.</P>
<P>The dwPlayCount field is the number of times to play the loop. A =
value of 0=20
specifies an infinite sustain loop (ie, the wave keeps looping until =
some=20
external force interrupts playback, such as the musician releasing the =
key that=20
triggered that wave's playback).</P>
<P>The Sampler Chunk is optional. I don't know as if there is any limit =
of one=20
per WAVE file. I don't see why there should be such a limit, since after =
all, an=20
application may need to deal with several MIDI samplers.</P>
<HR>

<P>
<H3><FONT color=3D#ff8040>Instrument chunk</FONT></H3>The Instrument =
Chunk=20
contains some of the same type of information as the Sampler chunk. So =
what else=20
is new? <PRE><B><FONT size=3D3><FONT color=3Dgreen>#define</FONT> =
InstrumentID 'inst'  <FONT color=3Dbrown>/* chunkID for Instruments =
Chunk */</FONT>

<FONT color=3Dgreen>typedef struct</FONT> {
  ID     chunkID;
  <FONT color=3Dgreen>long</FONT>   chunkSize;

  <FONT color=3Dgreen>unsigned char</FONT> UnshiftedNote;
  <FONT color=3Dgreen>char</FONT>          FineTune;
  <FONT color=3Dgreen>char</FONT>          Gain;
  <FONT color=3Dgreen>unsigned char</FONT> LowNote;
  <FONT color=3Dgreen>unsigned char</FONT> HighNote;
  <FONT color=3Dgreen>unsigned char</FONT> LowVelocity;
  <FONT color=3Dgreen>unsigned char</FONT> HighVelocity;
} InstrumentChunk;
</FONT></B></PRE>The ID is always <B>inst</B>. chunkSize should always =
be 7=20
since there are no fields of variable length.=20
<P>The UnshiftedNote field is the same as the Sampler chunk's =
dwMIDIUnityNote=20
field.</P>
<P>The FineTune field determines how much the instrument should alter =
the pitch=20
of the sound when it is played back. Units are in cents (1/100 of a =
semitone)=20
and range from -50 to +50. Negative numbers mean that the pitch of the =
sound=20
should be lowered, while positive numbers mean that it should be raised. =
While=20
not the same measurement is used, this field serves the same purpose as =
the=20
Sampler chunk's dwFraction field.</P>
<P>The Gain field is the amount by which to change the gain of the sound =
when it=20
is played. Units are decibels. For example, 0db means no change, 6db =
means=20
double the value of each sample point (ie, every additional 6db doubles =
the=20
gain), while -6db means halve the value of each sample point.</P>
<P>The LowNote and HighNote fields specify the suggested MIDI note range =
on a=20
keyboard for playback of the waveform data. The waveform data should be =
played=20
if the instrument is requested to play a note between the low and high =
note=20
numbers, inclusive. The UnshiftedNote does not have to be within this =
range.</P>
<P>The LowVelocity and HighVelocity fields specify the suggested range =
of MIDI=20
velocities for playback of the waveform data. The waveform data should =
be played=20
if the note-on velocity is between low and high velocity, inclusive. The =
range=20
is 1 (lowest velocity) through 127 (highest velocity), inclusive.</P>
<P>The Instrument Chunk is optional. No more than 1 Instrument Chunk can =
appear=20
in one WAVE.</P></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -