DynamicsCompressorNode

The DynamicsCompressorNode interface provides a compression effect, which lowers the volume of the loudest parts of the signal in order to help prevent clipping and distortion that can occur when multiple sounds are played and multiplexed together at once. This is often used in musical production and game audio. DynamicsCompressorNode is an AudioNode that has exactly one input and one output.

Number of inputs 1
Number of outputs 1
Channel count mode "clamped-max"
Channel count 2
Channel interpretation "speakers"

Constructor

DynamicsCompressorNode()

Creates a new instance of an DynamicsCompressorNode object.

Properties

Inherits properties from its parent, AudioNode.

DynamicsCompressorNode.threshold Read only

Is a k-rate AudioParam representing the decibel value above which the compression will start taking effect.

DynamicsCompressorNode.knee Read only

Is a k-rate AudioParam containing a decibel value representing the range above the threshold where the curve smoothly transitions to the compressed portion.

DynamicsCompressorNode.ratio Read only

Is a k-rate AudioParam representing the amount of change, in dB, needed in the input for a 1 dB change in the output.

DynamicsCompressorNode.reduction Read only

Is a float representing the amount of gain reduction currently applied by the compressor to the signal.

DynamicsCompressorNode.attack Read only

Is a k-rate AudioParam representing the amount of time, in seconds, required to reduce the gain by 10 dB.

DynamicsCompressorNode.release Read only

Is a k-rate AudioParam representing the amount of time, in seconds, required to increase the gain by 10 dB.

Methods

No specific methods; inherits methods from its parent, AudioNode.

Example

See BaseAudioContext.createDynamicsCompressor() example code.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
DynamicsCompressorNode
14
12
25
No
15
6
≤37
18
25
14
Yes
1.0
DynamicsCompressorNode
55
Before Chrome 59, the default values were not supported.
79
53
No
42
14.1
55
Before version 59, the default values were not supported.
55
Before Chrome 59, the default values were not supported.
53
42
14.5
6.0
Before Samsung Internet 7.0, the default values were not supported.
attack
14
12
25
No
15
6
≤37
18
25
14
Yes
1.0
knee
14
12
25
No
15
6
≤37
18
25
14
Yes
1.0
ratio
14
12
25
No
15
6
≤37
18
25
14
Yes
1.0
reduction
14
Before version 52, this was an AudioParam..
12
25
No
15
6
≤37
Before version 52, this was an AudioParam..
18
Before version 52, this was an AudioParam..
25
14
Yes
1.0
Before Samsung Internet 6.0, this was an AudioParam..
release
14
12
25
No
15
6
≤37
18
25
14
Yes
1.0
threshold
14
12
25
No
15
6
≤37
18
25
14
Yes
1.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DynamicsCompressorNode