Gin
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SoftClipper Class Reference

Soft clipper with an adjustable knee, worked out in the dB domain. More...

#include <gin_softclipper.h>

Public Member Functions

 SoftClipper ()=default
 
 ~SoftClipper ()=default
 
void setDrive (float db)
 Gain applied before the curve, in dB.
 
void setKnee (float k)
 Knee width as a fraction of the drive, 0 to 1.
 
void setCeiling (float db)
 Output ceiling in dB - the level the curve flattens out at.
 
float processSample (float x) const
 
void process (juce::AudioSampleBuffer &buffer) const
 

Detailed Description

Soft clipper with an adjustable knee, worked out in the dB domain.

Below the knee nothing is touched at all. Through the knee the curve bends quadratically in dB, and above it the output is pinned to the ceiling. Doing the curve in dB rather than on the sample value is what makes it sound gradual: a waveshaper that looks smooth on a linear plot is still bending most sharply where the ear is most sensitive to it.

The knee is expressed as a fraction of the drive, so pushing the drive widens the region being softened instead of just hitting the ceiling harder and sooner.

Key Features:

Usage:

clipper.setDrive (6.0f); // 6 dB in
clipper.setKnee (0.5f); // knee spans +/-3 dB around the ceiling
clipper.setCeiling (-0.1f);
clipper.process (buffer);
A lightweight 2D point class for projects that don't use juce_graphics.
Definition gin_point.h:25
Soft clipper with an adjustable knee, worked out in the dB domain.
Definition gin_softclipper.h:52
See also
Distortion, Maximizer

Constructor & Destructor Documentation

◆ SoftClipper()

SoftClipper::SoftClipper ( )
default

◆ ~SoftClipper()

SoftClipper::~SoftClipper ( )
default

Member Function Documentation

◆ setDrive()

void SoftClipper::setDrive ( float  db)

Gain applied before the curve, in dB.

More drive means more of the signal ends up in the knee and above it.

◆ setKnee()

void SoftClipper::setKnee ( float  k)

Knee width as a fraction of the drive, 0 to 1.

At 0 this is a hard clip at the ceiling; at 1 the knee spans the whole drive range either side of it.

◆ setCeiling()

void SoftClipper::setCeiling ( float  db)

Output ceiling in dB - the level the curve flattens out at.

◆ processSample()

float SoftClipper::processSample ( float  x) const

Referenced by process().

◆ process()

void SoftClipper::process ( juce::AudioSampleBuffer &  buffer) const

References processSample().


The documentation for this class was generated from the following file: