Copyright © 2008-2018 MultiMedia Soft

Effects.CompressorApply method

Previous pageReturn to chapter overviewNext page

Remarks

 

Applies a compressor effect to the given portion of sound under editing.

 

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.

 

A successful call to this method will fire the SoundEditStarted event followed by a number of SoundEditPerc events and finally by the SoundEditDone event.

 

For further details about methods related to the use of special effects refer to the EffectsMan class.

 

 

Syntax

 

[Visual Basic]

Public Function CompressorApply (

nStartPosition as Int32,

nEndPosition as Int32,

nAffectedChannel as enumChannelMasks,

fGain as Single,

fThreshold as Single,

fRatio as Single,

fAttack as Single,

fRelease as Single

) as enumErrorCodes


 

[C#]

public enumErrorCodes CompressorApply (

Int32 nStartPosition,

Int32 nEndPosition,

enumChannelMasks nAffectedChannel,

float fGain,

float fThreshold,

float fRatio,

float fAttack,

float fRelease

);


 

[C++]

public: enumErrorCodes CompressorApply (

Int32 nStartPosition,

Int32 nEndPosition,

enumChannelMasks nAffectedChannel,

float fGain,

float fThreshold,

float fRatio,

float fAttack,

float fRelease

);


 

 

Parameter

Description

 

 

nStartPosition

Start position, expressed in milliseconds, of the affected sound range.

nEndPosition

End position, expressed in milliseconds, of the affected sound range.. If set to -1 the end position will be set to the end of the sound.

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.

 

 

Return value

 

Value

Meaning

 

 

Negative value

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

enumErrorCodes.NOERROR (0)

The method call was successful.