API Docs for: 2.7.1
Show:

Compressor Class

Extends BaseEffect
Module: Effects

An effect changes the amplitude or volume of the audio that this effect is connected to.

Constructor

Compressor

(
  • [context]
)

Parameters:

  • [context] AudioContext optional

    AudioContext to be used.

Methods

connect

(
  • destination
  • [output]
  • [input]
)

Inherited from BaseEffect:

If the parameter output is an AudioNode, it connects to the outputNode. If the output is a BaseEffect, it will connect BaseEffect's outputNode to the output's inputNode.

Parameters:

  • destination AudioNode

    AudioNode to connect to.

  • [output] Number optional

    Index describing which output of the AudioNode from which to connect.

  • [input] Number optional

    Index describing which input of the destination AudioNode to connect to.

disconnect

(
  • [outputIndex]
)

Inherited from BaseEffect:

Disconnects the Sound from the AudioNode Chain.

Parameters:

  • [outputIndex] Number optional

    Index describing which output of the AudioNode to disconnect.

listParams

(
  • [paramArray]
)

Inherited from BaseEffect:

List all SPAudioParams this Sound exposes

Parameters:

  • [paramArray] Array optional

    Array of all the SPAudioParams this Sound exposes.

Properties

attack

SPAudioParam

The amount of time (in seconds) to reduce the gain by 10dB.

Default: 0.003

audioContext

AudioContext

Inherited from BaseEffect:

Web Audio API's AudioContext. If the context passed to the constructor is an AudioContext, a new one is created here.

destinations

Array

Inherited from BaseEffect:

Set of nodes the output of this effect is currently connected to.

inputNode

AudioNode final

Inherited from BaseEffect:

The output node of this effect. This node will be connected to the next Effect or destination

isInitialized

Boolean

Inherited from BaseEffect:

If Sound is currently initialized.

Default: false

isPlaying

Boolean

Inherited from BaseEffect:

If Sound is currently playing.

Default: false

knee

SPAudioParam

A decibel value representing the range above the threshold where the curve * smoothly transitions to the "ratio" portion.

Default: 30

modelName

String

Inherited from BaseEffect:

String name of the effect.

Default: "Model"

numberOfInputs

Number

Inherited from BaseEffect:

Number of inputs

Default: 0

numberOfOutputs

Number

Inherited from BaseEffect:

Number of outputs

Default: 0

outputNode

AudioNode final

Inherited from BaseEffect:

The output node of this effect. This node will be connected to the next Effect or destination

ratio

SPAudioParam

The amount of dB change in input for a 1 dB change in output.

Default: 12

release

SPAudioParam

The amount of time (in seconds) to increase the gain by 10dB.

Default: 0.250

threshold

SPAudioParam

The decibel value above which the compression will start taking effect.

Default: -24