Copyright © 2001-2019 MultiMedia Soft

Effects.CompressorApply method

Previous pageReturn to chapter overviewNext page

Remarks

 

Applies a compressor effect on the playing song. This effect can be reset through the Effects.CompressorReset method.

 

Compressors are commonly used in recording to control the level, by making loud passages quieter, and quiet passages louder. This is useful in allowing a vocalist to sing quiet and loud for different emphasis, and always be heard clearly in the mix. Compression is generally applied to guitar to give clean sustain, where the start of a note is "squashed" with the gain automatically increased as the not fades away. Compressors take a short time to react to a picked note, and it can be difficult to find settings that react quickly enough to the volume change without killing the natural attack sound of your guitar.

 

See the How to apply special effects to a playing sound section for further details.

 

 

Syntax

 

[Visual Basic]

control.Effects.CompressorApply (

nPlayer as Integer,

nAffectedChannel as enumChannelMasks,

fGain as Single,

fThreshold as Single,

fRatio as Single,

fAttack as Single,

fRelease as Single,

nPriority as Integer

) as enumErrorCodes


 

[C++]

short control.Effects.CompressorApply (

short nPlayer,

short nAffectedChannel,

float fGain,

float fThreshold,

float fRatio,

float fAttack,

float fRelease,

short nPriority

);


 

 

 

Parameter

Description

 

 

nPlayer

Number representing the zero-based index of the involved player

nAffectedChannel

Numeric value that determines the combination of affected channels.

Supported values are the following:

Mnemonic constant

Value

Meaning

CHANNEL_MASK_0

1 (0x01)

Channel 0 or left channel

CHANNEL_MASK_1

2 (0x02)

Channel 1 or right channel

CHANNEL_MASK_2

4 (0x04)

Channel 2

CHANNEL_MASK_3

8 (0x08)

Channel 3

CHANNEL_MASK_4

16 (0x10)

Channel 4

CHANNEL_MASK_5

32 (0x20)

Channel 5

CHANNEL_MASK_6

64 (0x40)

Channel 6

CHANNEL_MASK_7

128 (0x80)

Channel 7

CHANNEL_MASK_LEFTS

85 (0x55)

All left channels

CHANNEL_MASK_RIGHTS

170 (0xAA)

All right channels

CHANNEL_MASK_ALL

255 (0xFF)

All available channels

fGain

Numeric value representing the output gain of signal after compression expressed in dB.

Supported values are in the range from -60 to +60. The default value is 0 dB.

fThreshold

Numeric value representing the point at which compression begins expressed in dB.

Supported values are in the range from -60 to 0. The default value is -15 dB.

fRatio

Numeric value representing the compression ratio.

Supported values start from 1. The default value is 3, which means 3:1 compression.

fAttack

Numeric value representing the time before compression reaches its full value expressed in milliseconds.

Supported values are in the range from 0.01 to 1000. The default value is 10 ms.

fRelease

Numeric value representing the speed, expressed in milliseconds, at which compression is stopped after input drops below fThreshold.

Supported values are in the range from 0.01 to 5000. The default value is 200 ms.

nPriority

Effect's priority level inside the chain of DirectX effects, custom DSP effects and VST effects. Effects with higher priority are applied before effects with lower priority; in case more effects should have the same priority, they would be invoked in the same order that they were added.

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred (see the LastError property for further error details)

enumErrorCodes.ERR_NOERROR (0)

The call was successful.