BASS.NET API for the Un4seen BASS Audio Library

BASS_BFX_COMPRESSOR2 Class

BASS.NET API for the Un4seen BASS Audio Library
Used with BASS_ChannelSetFX(Int32, BASSFXType, Int32), BASS_FXSetParameters(Int32, IntPtr) and BASS_FXGetParameters(Int32, IntPtr) to retrieve and set the parameters of the DSP effect Dynamic Range Compressor.
Inheritance Hierarchy

SystemObject
  Un4seen.Bass.AddOn.FxBASS_BFX_COMPRESSOR2

Namespace:  Un4seen.Bass.AddOn.Fx
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

[SerializableAttribute]
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class BASS_BFX_COMPRESSOR2

The BASS_BFX_COMPRESSOR2 type exposes the following members.

Constructors

  NameDescription
Public methodBASS_BFX_COMPRESSOR2
Default constructor
Public methodBASS_BFX_COMPRESSOR2(Single, Single, Single, Single, Single, BASSFXChan)
Constructor already setting the members.
Top
Methods

  NameDescription
Public methodCalculate0dBGain
Calculates for the current threshold/ratio combination a gain value to roughly achieve a 0 dB peak line.
Public methodPreset_Default
Sets the instance members to a preset.
Public methodPreset_Hard
Sets the instance members to a preset.
Public methodPreset_Hard2
Sets the instance members to a preset.
Public methodPreset_HardCommercial
Sets the instance members to a preset.
Public methodPreset_Medium
Sets the instance members to a preset.
Public methodPreset_Soft
Sets the instance members to a preset.
Public methodPreset_Soft2
Sets the instance members to a preset.
Top
Fields

  NameDescription
Public fieldfAttack
Time in ms before compression reaches its full value, in the range from 0.01 to 500. The default value is 20 ms.
Public fieldfGain
Output gain in dB of signal after compression, in the range from -60 to 60. The default value is 5 dB.
Public fieldfRatio
Compression ratio, in the range from 1 to 100. The default value is 3, which means 3:1 compression.
Public fieldfRelease
Time (speed) in ms at which compression is stopped after input drops below fThreshold, in the range from 50 to 3000. The default value is 200 ms.
Public fieldfThreshold
Point in dB at which compression begins, in decibels, in the range from -60 to 0. The default value is -15 dB.
Public fieldlChannel
A BASSFXChan flag to define on which channels to apply the effect.

Default: -1 (BASS_BFX_CHANALL) - all channels.

Top
Remarks

Dynamic range compression also called DRC, or simply compression, is a process that reduces the dynamic range of an audio signal. Compression is used during sound recording, live sound reinforcement, and broadcasting to control the level of audio. A compressor is the device used to apply compression.

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.

The fThreshold sets the level above which volume is reduced in level while quiet sound are untreated (downward compression). The fAttack controls how fast the unit responds to volume increases. The fRelease controls how slowly the unit responds to decreasing volume.

The compressor reduces the gain (level) of an audio signal if its amplitude exceeds a threshold (using RMS sensing with a hard knee). The amount of gain reduction is determined by a ratio. For example, with a ratio of 4:1, when the (time averaged) input level is 4 dB over the threshold, the output signal level will be 1 dB over the threshold. The gain (level) has been reduced by 3 dB. When the input level is 8 dB above the threshold, the output level will be 2 dB; a 6 dB gain reduction. A more specific example for a 4:1 ratio: Threshold = −10 dB; Input = −6 dB (4 dB above the threshold); Output = −9 dB (1 dB above the threshold)

With any threshold/ratio combination, you could calculate the gain for a 0dB peak like this: fGain=fThreshold*(1/fRatio-1)

See Also

Reference