Compressor
class Component ↳ extends ToneAudioNode<CompressorOptions>
Compressor is a thin wrapper around the Web Audio DynamicsCompressorNode. Compression reduces the volume of loud sounds or amplifies quiet sounds by narrowing or “compressing” an audio signal’s dynamic range. Read more on Wikipedia.
const comp = new Tone.Compressor(-30, 3);
Constructor
Section titled “Constructor”new Compressor(threshold?: number, ratio?: number)Parameters
-
threshold
numberoptionalThe value above which the compression starts to be applied.
-
ratio
numberoptionalThe gain reduction ratio.
new Compressor(options?: Partial<CompressorOptions>)Parameters
- options
Partial<CompressorOptions>optional
Properties
Section titled “Properties”attack
Section titled “attack”read-only
attack: Param<"time">The amount of time (in seconds) to reduce the gain by 10dB.
Range: 0 to 1
read-only
input: DynamicsCompressorNodeThe input node or nodes. If the object is a source, it does not have any input and this.input is undefined.
read-only
knee: Param<"decibels">A decibel value representing the range above the threshold where the curve smoothly transitions to the “ratio” portion.
Range: 0 to 40
output
Section titled “output”read-only
output: DynamicsCompressorNodeThe output nodes. If the object is a sink, it does not have any output and this.output is undefined.
read-only
ratio: Param<"positive">The amount of dB change in input for a 1 dB change in output.
Range: 1 to 20
release
Section titled “release”read-only
release: Param<"time">The amount of time (in seconds) to increase the gain by 10dB.
Range: 0 to 1
threshold
Section titled “threshold”read-only
threshold: Param<"decibels">The decibel value above which the compression will start taking effect.
Range: -100 to 0
reduction
Section titled “reduction”read-only
reduction: numberA read-only decibel value for metering purposes, representing the current amount of gain reduction that the compressor is applying to the signal. If fed no signal the value will be 0 (no gain reduction).
Methods
Section titled “Methods”getDefaults()
Section titled “getDefaults()”static
getDefaults(): CompressorOptionsReturns all of the default options belonging to the class.
Returns CompressorOptions
Inherited members
Section titled “Inherited members”- From
ToneWithContext: context, blockTime, sampleTime, get(), immediate(), now(), set(), toFrequency(), toSeconds(), toTicks() - From
Tone: debug, version, disposed, toString() - From
ToneAudioNode: channelCount, channelCountMode, channelInterpretation, numberOfInputs, numberOfOutputs, chain(), connect(), disconnect(), fan(), toDestination(), toMaster()