disconnect() method of the
AudioNode interface lets you disconnect one or more nodes from the node on which the method is called.
There are several versions of the
disconnect() method, which accept different combinations of parameters to control which nodes to disconnect from. If no parameters are provided, all outgoing connections are disconnected.
AudioParamspecifying the node or nodes to disconnect from. If this value is an
AudioNode, a single node is disconnected from, with any other, optional, parameters (
input) further limiting which inputs and/or outputs should be disconnected. If this value is an
AudioParam, then the connection to that
AudioParamis terminated, and the node's contributions to that computed parameter become 0 going forward once the change takes effect.
An index describing which output from the current
AudioNodeis to be disconnected. The index numbers are defined according to the number of output channels (see Audio channels).
An index describing which input into the specified destination
AudioNodeis to be disconnected. The index numbers are defined according to the number of input channels (see Audio channels).
const AudioContext = window.AudioContext || window.webkitAudioContext; const audioCtx = new AudioContext(); const oscillator = audioCtx.createOscillator(); const gainNode = audioCtx.createGain(); oscillator.connect(gainNode); gainNode.connect(audioCtx.destination); gainNode.disconnect();
|Web Audio API |
BCD tables only load in the browser