AudioNode: channelCount property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
The channelCount
property of the AudioNode
interface represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node.
channelCount
's usage and precise definition depend on the value of AudioNode.channelCountMode
:
- It is ignored if the
channelCountMode
value ismax
. - It is used as a maximum value if the
channelCountMode
value isclamped-max
. - It is used as the exact value if the
channelCountMode
value isexplicit
.
Value
An integer.
Examples
js
const audioCtx = new AudioContext();
const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);
oscillator.channelCount;
Specifications
Specification |
---|
Web Audio API # dom-audionode-channelcount |
Browser compatibility
BCD tables only load in the browser