Back to Content

DynamicsCompressorNode: attack property

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

latest1.0 KB
Original Source

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

The attack property of the {{ domxref("DynamicsCompressorNode") }} interface is a k-rate {{domxref("AudioParam")}} representing the amount of time, in seconds, required to reduce the gain by 10 dB. It defines how quickly the signal is adapted when its volume is increased.

The attack property's default value is 0.003 and it can be set between 0 and 1.

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.attack.value = 0;

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also