(8.D.2.7) SoftClip
Overview
Soft clip in float32
Discussion
The soft clipper uses a combination of piecewise linear and non-linear functions. Threshold sets the beginning of the knee. The maximum output is always 0dB. These threshold produce different a larger or smaller knee accordingly.
Type Definition
typedef struct _ModuleSoftClip
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 threshold; // Transition point between linear response and knee.
FLOAT32 th; // Threshold in linear scale
FLOAT32* lastIn; // Array of last input sample, one per channel.
FLOAT32* lastOut; // Array of last output sample, one per channel.
FLOAT32* currentGain; // Array of soft clipper gain, one per channel.
} ModuleSoftClipClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
threshold | float | parameter | 0 | -4 | -20:0 | dB |
th | float | derived | 1 | 0.631 | Unrestricted | Â |
lastIn | float* | state | 1 | [1 x 1] | -10:10 | linear |
lastOut | float* | state | 1 | [1 x 1] | -10:10 | linear |
currentGain | float* | state | 0 | [1 x 1] | -40:3 | linear |
Pins
Input Pins
Name: in
Description: audio input
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
MATLAB Usage
File Name: soft_clip_module.m
M=soft_clip_module(NAME)
Creates a soft clipper module for use in Audio Weaver. The soft clipper
is realized using a piecewise function.
Arguments: clipping threshold in dB. When input signal is below the
threshold, the gain of the soft clipper is 0 dB.
Then as the input signal increases, the output approaches max value of
1.0. The soft clipper maintains the continuity of the piecewise
compression function at the threshold point.
NAME - name of the module.
Â