DynamicsCompressorNode
Web Audio API
Web Audio API
The `DynamicsCompressorNode` interface provides a compression effect, which lowers the volume of the loudest parts of a signal.
Compression can help prevent clipping and distortion when multiple sounds are combined, and it is also used in music production and game audio for dynamic control, tone shaping, and creative effects.
`DynamicsCompressorNode` is an AudioNode that has exactly one input and one output.
<table class="properties">
<tbody>
<tr>
<th scope="row">Number of inputs</th>
<td><code>1</code></td>
</tr>
<tr>
<th scope="row">Number of outputs</th>
<td><code>1</code></td>
</tr>
<tr>
<th scope="row">Channel count mode</th>
<td><code>"clamped-max"</code></td>
</tr>
<tr>
<th scope="row">Channel count</th>
<td><code>2</code></td>
</tr>
<tr>
<th scope="row">Channel interpretation</th>
<td><code>"speakers"</code></td>
</tr>
</tbody>
</table>
## Constructor
- DynamicsCompressorNode()
- : Creates a new instance of a `DynamicsCompressorNode` object.
## Instance properties
_Inherits properties from its parent, AudioNode_.
- DynamicsCompressorNode.threshold
- : A [k-rate](/docs/Web/API/AudioParam#k-rate) AudioParam representing the decibel value above which the compression will start taking effect.
- DynamicsCompressorNode.knee
- : A [k-rate](/docs/Web/API/AudioParam#k-rate) AudioParam containing a decibel value representing the range above the threshold where the curve smoothly transitions to the compressed portion.
- DynamicsCompressorNode.ratio
- : A [k-rate](/docs/Web/API/AudioParam#k-rate) AudioParam representing the amount of change, in dB, needed in the input for a 1 dB change in the output.
- DynamicsCompressorNode.reduction
- : A `float` representing the amount of gain reduction currently applied by the compressor to the signal.
- DynamicsCompressorNode.attack
- : A [k-rate](/docs/Web/API/AudioParam#k-rate) AudioParam representing the amount of time, in seconds, required to reduce the gain by 10 dB.
- DynamicsCompressorNode.release
- : A [k-rate](/docs/Web/API/AudioParam#k-rate) AudioParam representing the amount of time, in seconds, required to increase the gain by 10 dB.
## Instance methods
_No specific methods; inherits methods from its parent, AudioNode_.
## Example
See [`BaseAudioContext.createDynamicsCompressor()`](/docs/Web/API/BaseAudioContext/createDynamicsCompressor#examples) example code.
## Specifications
## Browser compatibility
## See also
- [Using the Web Audio API](/docs/Web/API/Web_Audio_API/Using_Web_Audio_API)
Cite this
"DynamicsCompressorNode". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/DynamicsCompressorNode