📄 multiple channel audio data and wave files.htm
字号:
files. It was deemed impossible to define a default multi-channel speaker
configuration for <B>WAVE_FORMAT_PCM</B> without causing functionality to
break in one of these file types. Therefore, a channel-to-speaker
specification for <B>WAVE_FORMAT_PCM</B> will continue to be undocumented
for the case of <B>nChannels</B> > 2.</P>
<H3>Default Channel Ordering</H3>
<P>The way to deterministically link channel numbers to speaker locations,
thus providing consistency among multiple channel audio files, is to
define the order in which the channels are laid out in the audio file.
Several external standards define parts of the following master channel
layout:</P>
<TABLE class=numberedList cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>1.</P></TD>
<TD>
<P>Front Left - FL</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>2.</P></TD>
<TD>
<P>Front Right - FR</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>3.</P></TD>
<TD>
<P>Front Center - FC</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>4.</P></TD>
<TD>
<P>Low Frequency - LF</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>5.</P></TD>
<TD>
<P>Back Left - BL</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>6.</P></TD>
<TD>
<P>Back Right - BR</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>7.</P></TD>
<TD>
<P>Front Left of Center - FLC</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>8.</P></TD>
<TD>
<P>Front Right of Center - FRC</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>9.</P></TD>
<TD>
<P>Back Center - BC</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>10.</P></TD>
<TD>
<P>Side Left - SL</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>11.</P></TD>
<TD>
<P>Side Right - SR</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>12.</P></TD>
<TD>
<P>Top Center - TC</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>13.</P></TD>
<TD>
<P>Top Front Left - TFL</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>14.</P></TD>
<TD>
<P>Top Front Center - TFC</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>15.</P></TD>
<TD>
<P>Top Front Right - TFR</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>16.</P></TD>
<TD>
<P>Top Back Left - TBL</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>17.</P></TD>
<TD>
<P>Top Back Center - TBC</P></TD></TR>
<TR vAlign=top>
<TD class=listNumber noWrap align=right>
<P>18.</P></TD>
<TD>
<P>Top Back Right - TBR</P></TD></TR></TBODY></TABLE>
<P>The channels in the interleaved stream corresponding to these spatial
positions must appear in the order specified above. This holds true even
in the case of a non-contiguous subset of channels. For example, if a
stream contains left, bass enhance and right, then channel 1 is left,
channel 2 is right, and channel 3 is bass enhance. This enables the
linkage of multi-channel streams to well-defined multi-speaker
configurations.</P>
<P><B>Warning:</B> Content intended for the Low Frequency channel may not
be rendered on the speaker that the data is sent to. This is because there
is no way to guarantee the frequency range of the low frequency speaker in
a user's system. For this reason, a speaker that is receiving low
frequency audio might filter the frequencies that it cannot handle.</P>
<DIV style="MARGIN-TOP: 3px; MARGIN-BOTTOM: 10px"><A
href="http://www.microsoft.com/whdc/hwdev/tech/audio/multichaud.mspx#top"><IMG
height=9 alt="Top of page"
src="Multiple Channel Audio Data and WAVE Files.files/arrow_px_up.gif"
width=7 border=0></A><A class=topOfPage
href="http://www.microsoft.com/whdc/hwdev/tech/audio/multichaud.mspx#top">Top
of page</A></DIV><A name=#XSLTsection125121120120></A>
<H2>Representing High-Resolution Audio </H2>
<H3>Ambiguity within WAVE_FORMAT_PCM</H3>
<P>It is important to enumerate the assumptions made by
<B>WAVE_FORMAT_PCM</B>. One assumption is that the <B>nBlockAlign</B>
field contains exactly one set of samples (one block). Also, each sample
must be byte-aligned within the block. The byte-aligned space that each
sample consumes is called the sample's "container." Additionally, there
cannot be any extra space between the end of the last sample container and
the actual end of the block. In other words, <B>nBlockAlign</B> must be an
integer multiple of <B>nChannels</B>, and that multiple is considered the
"container size" for the sample.</P>
<P>Although it was not necessarily the original intent, some entities
treat <B>wBitsPerSample</B> as equivalent to the container size. In other
words, the number of bits of valid data was assumed equal to the size of
the container. This assumption held well for 8-bit and 16-bit audio. With
the coming of high fidelity audio equipment for render and capture, 20-bit
and 24-bit streams emerged. Specifying the actual bit resolution of the
samples in a byte-aligned stream became important; the accepted
interpretation of <B>wBitsPerSample</B> started to unravel, because its
value is not rigidly enforced by all software. In many cases, it continued
to be the container size. In other cases, however, the field was used to
indicate the bits of actual valid data, while the container size was
inferred from <B>nBlockAlign</B> and <B>nChannels</B> (an example would be
<B>wBitsPerSample</B> = 20, <B>nBlockAlign</B> = 8, <B>nChannels</B> =
2).</P>
<P>It was not considered feasible to resolve this issue either way without
causing many legacy problems for <B>WAVE_FORMAT_PCM</B>, so the new
formats include an additional field that clarifies this ambiguity. The new
formats are intended to handle those cases in which the actual bits of
precision are not equal to the container size, as well as all cases in
which the container size is greater than sixteen bits.</P>
<P>It is not the purpose of this article to resolve the ambiguity of
<B>wBitsPerSample</B> for <B>WAVE_FORMAT_PCM</B>. However, this same field
will be used unambiguously in the new formats.</P>
<H3>Specifying the Actual Bit Depth</H3>
<P>In the new formats, <B>wBitsPerSample</B> is strictly defined as the
container size. Containers must be byte-aligned, so <B>wBitsPerSample</B>
must be a multiple of 8. A new field conveys exactly how many of those
bits contain actual data, regardless of the size of the container. As
audio goes through a processing system, the number of valid data bits per
sample can change. Each sample is justified to the most significant bit,
so it is easy to add additional precision on the bottom of a sample, or
dither to a lower precision. The container size can be manipulated
independently without implying any change in the data precision. A 24-bit
stream in 32-bit containers (for efficient processing) can safely be
transferred into 24-bit containers (for efficient storage space) without
any data loss.</P>
<DIV style="MARGIN-TOP: 3px; MARGIN-BOTTOM: 10px"><A
href="http://www.microsoft.com/whdc/hwdev/tech/audio/multichaud.mspx#top"><IMG
height=9 alt="Top of page"
src="Multiple Channel Audio Data and WAVE Files.files/arrow_px_up.gif"
width=7 border=0></A><A class=topOfPage
href="http://www.microsoft.com/whdc/hwdev/tech/audio/multichaud.mspx#top">Top
of page</A></DIV><A name=#XSLTsection126121120120></A>
<H2>Using WAVE_FORMAT_EXTENSIBLE </H2>
<P>To solve the problem of multiple channel ordering and high precision
data, Microsoft has defined the new structure
<B>WAVE_FORMAT_EXTENSIBLE</B>. This new structure not only has the benefit
of solving these problems, it also provides a mechanism for
self-registering new data formats. The <B>SubFormat</B> field is set to
the GUID that specifies the type of data described by the
<B>WAVE_FORMAT_EXTENSIBLE</B> structure.</P>
<DIV style="MARGIN-TOP: 3px; MARGIN-BOTTOM: 10px"><A
href="http://www.microsoft.com/whdc/hwdev/tech/audio/multichaud.mspx#top"><IMG
height=9 alt="Top of page"
src="Multiple Channel Audio Data and WAVE Files.files/arrow_px_up.gif"
width=7 border=0></A><A class=topOfPage
href="http://www.microsoft.com/whdc/hwdev/tech/audio/multichaud.mspx#top">Top
of page</A></DIV><A name=#XSLTsection127121120120></A>
<H2>Definition of WAVE_FORMAT_EXTENSIBLE </H2>
<P>The definition (in MMREG.H and KSMEDIA.H) of
<B>WAVE_FORMAT_EXTENSIBLE</B> is included below:</P><PRE class=codeSample>typedef struct {
WAVEFORMATEX Format;
union {
WORD wValidBitsPerSample; /* bits of precision */
WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */
WORD wReserved; /* If neither applies, set to zero. */
} Samples;
DWORD dwChannelMask; /* which channels are present in stream */
GUID SubFormat;
} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
</PRE>
<P><BR><B>Definition of WAVEFORMATPCMEX</B><BR>The wave format
<B>WAVEFORMATEX</B> is too under-specified to be used for high bit-depth
samples or multiple channel streams. For cases in which the spatial
locations of the channels are linked to the standard speaker locations,
<B>WAVEFORMATPCMEX</B> is appropriate. For the <B>WAVEFORMATEXTENSIBLE</B>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -