Skip to content

DynamicsCompressor.reduction

rtoy edited this page Apr 19, 2016 · 3 revisions

In WebAudioAPI Issue 243, the reduction parameter for the DynamicsCompressor node changed from an AudioParam to a plain float. As this change gets implemented, developers will need to support both the AudioParam version and the float version.

Here's a simple example of how to support both:

var c = new AudioContext();
var dc = c.createDynamicsCompressor();
var reductionValue;
if (typeof dc.reduction === 'float') {
  reductionValue = dc.reduction;
} else {
  reductionValue = dc.reduction.value;
}