Back to Content

DynamicsCompressorNode: ratio property

files/en-us/web/api/dynamicscompressornode/ratio/index.md

latest1.0 KB
Original Source

{{ APIRef("Web Audio API") }}

The ratio property of the {{ domxref("DynamicsCompressorNode") }} interface Is a k-rate {{domxref("AudioParam")}} representing the amount of change, in dB, needed in the input for a 1 dB change in the output.

The ratio property's default value is 12 and it can be set between 1 and 20.

Value

An {{domxref("AudioParam")}}.

[!NOTE] Though the {{domxref("AudioParam")}} returned is read-only, the value it represents is not.

Examples

js
const audioCtx = new AudioContext();
const compressor = audioCtx.createDynamicsCompressor();
compressor.ratio.value = 12;

See BaseAudioContext.createDynamicsCompressor() for more complete example code.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also