Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

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

Code Block
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

...

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

...