channelInterpretation 特性为 AudioNode interface represents an enumerated value describing the meaning of the channels. This interpretation will define how audio up-mixing and down-mixing will happen.

When the number of channels doesn't match between an input and an output, up- or down-mixing happens according the following rules. This can be somewhat controlled by setting the AudioNode.channelInterpretation 特性到 speakers or discrete :

Interpretation Input channels Output channels Mixing rules
speakers 1 (Mono) 2 (Stereo) Up-mix from mono to stereo .
M input channel is used for both output channels ( L and R ).
output.L = input.M
output.R = input.M
1 (Mono) 4 (Quad) Up-mix from mono to quad.
M input channel is used for non-surround output channels ( L and R ). Surround output channels ( SL and SR ) are silent.
output.L = input.M
output.R = input.M
output.SL = 0
output.SR = 0
1 (Mono) 6 (5.1) Up-mix from mono to 5.1.
M input channel is used for the center output channel ( C ). All the others ( L , R , LFE , SL ,和 SR ) are silent.
output.L = 0
output.R = 0

output.C = input.M
output.LFE = 0
output.SL = 0
output.SR = 0
2 (Stereo) 1 (Mono) Down-mix from stereo to mono .
Both input channels ( L and R ) are equally combined to produce the unique output channel ( M ).
output.M = 0.5 * (input.L + input.R)
2 (Stereo) 4 (Quad) Up-mix from stereo to quad.
L and R input channels are used for their non-surround respective output channels ( L and R ). Surround output channels ( SL and SR ) are silent.
output.L = input.L
output.R = input.R
output.SL = 0
output.SR = 0
2 (Stereo) 6 (5.1) Up-mix from stereo to 5.1.
L and R input channels are used for their non-surround respective output channels ( L and R ). Surround output channels ( SL and SR ), as well as the center ( C ) and subwoofer ( LFE ) channels, are left silent.
output.L = input.L
output.R = input.R
output.C = 0
output.LFE = 0
output.SL = 0
output.SR = 0
4 (Quad) 1 (Mono) Down-mix from quad to mono .
All four input channels ( L , R , SL ,和 SR ) are equally combined to produce the unique output channel ( M ).
output.M = 0.25 * (input.L + input.R + input.SL + input.SR )
4 (Quad) 2 (Stereo) Down-mix from quad to stereo .
Both left input channels ( L and SL ) are equally combined to produce the unique left output channel ( L ). And similarly, both right input channels ( R and SR ) are equally combined to produce the unique right output channel ( R ).
output.L = 0.5 * (input.L + input.SL )
output.R = 0.5 * (input.R + input.SR )
4 (Quad) 6 (5.1) Up-mix from quad to 5.1.
L , R , SL ,和 SR input channels are used for their respective output channels ( L and R ). Center ( C ) and subwoofer ( LFE ) channels are left silent.
output.L = input.L
output.R = input.R
output.C = 0
output.LFE = 0
output.SL = input.SL
output.SR = input.SR
6 (5.1) 1 (Mono) Down-mix from 5.1 to mono.
The left ( L and SL ), right ( R and SR ) and central channels are all mixed together. The surround channels are slightly attenuated and the regular lateral channels are power-compensated to make them count as a single channel by multiplying by √2/2 . The subwoofer ( LFE ) channel is lost.
output.M = 0.7071 * (input.L + input.R) + input.C + 0.5 * (input.SL + input.SR)
6 (5.1) 2 (Stereo) Down-mix from 5.1 to stereo.
The central channel ( C ) is summed with each lateral surround channel ( SL or SR ) and mixed to each lateral channel. As it is mixed down to two channels, it is mixed at a lower power: in each case it is multiplied by √2/2 . The subwoofer ( LFE ) channel is lost.
output.L = input.L + 0.7071 * (input.C + input.SL)
output.R = input.R
+ 0.7071 * (input.C + input.SR)
6 (5.1) 4 (Quad) Down-mix from 5.1 to quad.
The central ( C ) is mixed with the lateral non-surround channels ( L and R ). As it is mixed down to two channels, it is mixed at a lower power: in each case it is multiplied by √2/2 . The surround channels are passed unchanged. The subwoofer ( LFE ) channel is lost.
output.L = input.L + 0.7071 * input.C
output.R = input.R + 0.7071 * input.C
output.SL = input.SL
output.SR = input.SR
Other, non-standard layouts Non-standard channel layouts are handled as if channelInterpretation 被设为 discrete .
The specification explicitly allows the future definition of new speaker layouts. This fallback is therefore not future proof as the behavior of the browsers for a specific number of channels may change in the future.
discrete any ( x ) any ( y ) where x<y Up-mix discrete channels.
Fill each output channel with its input counterpart, that is the input channel with the same index. Channels with no corresponding input channels are left silent.
any ( x ) any ( y ) where x>y Down-mix discrete channels.
Fill each output channel with its input counterpart, that is the input channel with the same index. Input channels with no corresponding output channels are dropped.

句法

var oscillator = audioCtx.createOscillator();
oscillator.channelInterpretation = 'discrete';
					

An enumerated value representing a channelInterpretation .

范例

var AudioContext = window.AudioContext || window.webkitAudioContext;
var audioCtx = new AudioContext();
var oscillator = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();
oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);
oscillator.channelInterpretation = 'discrete';
					

规范

规范 状态 注释
Web 音频 API
The definition of 'channelInterpretation' in that specification.
工作草案

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
channelInterpretation Chrome 14 Edge 12 Firefox 25 IE 不支持 No Opera 15 Safari 6 WebView Android Yes Chrome Android 18 Firefox Android 26 Opera Android 14 Safari iOS Yes Samsung Internet Android 1.0

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: