AuxPort 0.2
Modules for Audio Software Development
Loading...
Searching...
No Matches
AuxPort::Audio::Distortion Class Reference

Consists of Static Functions with various Distortion Algorithms. More...

#include <AuxDistortion.h>

Static Public Member Functions

static void DC (AuxPort::Audio::Buffer< float > &buffer, const float &offset)
 This function adds a DC offset to your Audio.
 
static float DC (float &audio, const float &offset, const bool &preserve=true)
 This function adds a DC offset to your Audio.
 
static void zeroCrossing (AuxPort::Audio::Buffer< float > &buffer, const float &threshold)
 This function performs Zero Crossing on the AuxPort::Audio::Buffer.
 
static float zeroCrossing (float &audio, const float &threshold, const bool &preserve=true)
 This function performs Zero Crossing on the given sample.
 
static void arcTan (AuxPort::Audio::Buffer< float > &buffer, const float &drive)
 This function performs ArcTan Distortion on the AuxPort::Audio::Buffer.
 
static float arcTan (float &audio, const float &drive, const bool &preserve=true)
 This function performs ArcTan Distortion on the given sample.
 
static void arcTan2 (AuxPort::Audio::Buffer< float > &buffer, const float &drive)
 This function performs ArcTan2 Distortion on the AuxPort::Audio::Buffer.
 
static float arcTan2 (float &audio, const float &drive, const bool &preserve=true)
 This function performs ArcTan2 Distortion on the given sample.
 
static void hyperbolicTan (AuxPort::Audio::Buffer< float > &buffer, const float &drive)
 This function performs Tanh Distortion on the AuxPort::Audio::Buffer.
 
static float hyperbolicTan (float &audio, const float &drive, const bool &preserve)
 This function performs Tanh Distortion on the given sample.
 
static float schetzenOverdrive (float &audio, const bool &preserve=true)
 This function performs Overdrive using Schetzen Soft Clipping Formula.
 
static float exponential (float &audio, const bool &preserve=true)
 This functions Distorts the audio signal using an exponential function.
 
static float softClipper (float &audio, const bool &preserve=true)
 This functions performs soft clipping distortion on the audio signal.
 
static float crush (float &audio, const float &depth, const bool &preserve=true)
 This functions distorts the audio signal by altering the bit depth of the signal.
 
static float sinusoidalFold (float &audio, const bool &preserve=true)
 This functions distorts the audio signal by shaping the signal as a sinusoidal wave.
 
static float squareFold (float &audio, const bool &preserve=true)
 This functions distorts the audio signal by shaping the signal as a square wave.
 
static float levianTanh (float &audio, const bool &preserve=true)
 This functions distorts the audio signal by passing the signal through a polynomial approximation of a tanh function.
 

Detailed Description

Consists of Static Functions with various Distortion Algorithms.

Definition at line 51 of file AuxDistortion.h.

Member Function Documentation

◆ arcTan() [1/2]

void AuxPort::Audio::Distortion::arcTan ( AuxPort::Audio::Buffer< float > & buffer,
const float & drive )
static

This function performs ArcTan Distortion on the AuxPort::Audio::Buffer.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = atan(drive*x)

Definition at line 63 of file AuxDistortion.cpp.

◆ arcTan() [2/2]

float AuxPort::Audio::Distortion::arcTan ( float & audio,
const float & drive,
const bool & preserve = true )
static

This function performs ArcTan Distortion on the given sample.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = atan(drive*x)

Definition at line 69 of file AuxDistortion.cpp.

◆ arcTan2() [1/2]

void AuxPort::Audio::Distortion::arcTan2 ( AuxPort::Audio::Buffer< float > & buffer,
const float & drive )
static

This function performs ArcTan2 Distortion on the AuxPort::Audio::Buffer.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = (2/pi) * atan(drive*x)

Definition at line 75 of file AuxDistortion.cpp.

◆ arcTan2() [2/2]

float AuxPort::Audio::Distortion::arcTan2 ( float & audio,
const float & drive,
const bool & preserve = true )
static

This function performs ArcTan2 Distortion on the given sample.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = (2/pi) * atan(drive*x)

Definition at line 83 of file AuxDistortion.cpp.

◆ crush()

float AuxPort::Audio::Distortion::crush ( float & audio,
const float & depth,
const bool & preserve = true )
static

This functions distorts the audio signal by altering the bit depth of the signal.

[Mathematical Formula]
Let x = input sample
Let y = output sample
quantizationLevel = (2^depth) - 1

Definition at line 135 of file AuxDistortion.cpp.

◆ DC() [1/2]

void AuxPort::Audio::Distortion::DC ( AuxPort::Audio::Buffer< float > & buffer,
const float & offset )
static

This function adds a DC offset to your Audio.

Definition at line 39 of file AuxDistortion.cpp.

◆ DC() [2/2]

float AuxPort::Audio::Distortion::DC ( float & audio,
const float & offset,
const bool & preserve = true )
static

This function adds a DC offset to your Audio.

Definition at line 44 of file AuxDistortion.cpp.

◆ exponential()

float AuxPort::Audio::Distortion::exponential ( float & audio,
const bool & preserve = true )
static

This functions Distorts the audio signal using an exponential function.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = sgn(x) (1 - exp(-abs(x))

Great for Generating Odd Harmonics

Definition at line 124 of file AuxDistortion.cpp.

◆ hyperbolicTan() [1/2]

void AuxPort::Audio::Distortion::hyperbolicTan ( AuxPort::Audio::Buffer< float > & buffer,
const float & drive )
static

This function performs Tanh Distortion on the AuxPort::Audio::Buffer.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = tanh(drive*x)

Definition at line 88 of file AuxDistortion.cpp.

◆ hyperbolicTan() [2/2]

float AuxPort::Audio::Distortion::hyperbolicTan ( float & audio,
const float & drive,
const bool & preserve )
static

This function performs Tanh Distortion on the given sample.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = tanh(drive*x)

Definition at line 94 of file AuxDistortion.cpp.

◆ levianTanh()

float AuxPort::Audio::Distortion::levianTanh ( float & audio,
const bool & preserve = true )
static

This functions distorts the audio signal by passing the signal through a polynomial approximation of a tanh function.

[Mathematical Formula]
Let x = input sample
Let y = output sample
Let z be the intermediate term
z = x + (0.16489087x^3) + (0.00985468fx^5)
y = z / sqrt(1 + z^2)

Definition at line 152 of file AuxDistortion.cpp.

◆ schetzenOverdrive()

float AuxPort::Audio::Distortion::schetzenOverdrive ( float & audio,
const bool & preserve = true )
static

This function performs Overdrive using Schetzen Soft Clipping Formula.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = {
2x, 0 <= x < 0.34
(3 - (2-3x)^2)/3 , 0.34 < x <= 0.66
1, 0.66 <= x <= 1
}

Definition at line 99 of file AuxDistortion.cpp.

◆ sinusoidalFold()

float AuxPort::Audio::Distortion::sinusoidalFold ( float & audio,
const bool & preserve = true )
static

This functions distorts the audio signal by shaping the signal as a sinusoidal wave.

[Mathematical Formula]
Let x = input sample
Let y = output sample
y = sin(x);

Definition at line 142 of file AuxDistortion.cpp.

◆ softClipper()

float AuxPort::Audio::Distortion::softClipper ( float & audio,
const bool & preserve = true )
static

This functions performs soft clipping distortion on the audio signal.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = x - 0.34x^3

Definition at line 129 of file AuxDistortion.cpp.

◆ squareFold()

float AuxPort::Audio::Distortion::squareFold ( float & audio,
const bool & preserve = true )
static

This functions distorts the audio signal by shaping the signal as a square wave.

[Mathematical Formula]
Let x = input sample
Let y = output sample
y = {
x > 0 , 1
else , -1
}

Definition at line 147 of file AuxDistortion.cpp.

◆ zeroCrossing() [1/2]

void AuxPort::Audio::Distortion::zeroCrossing ( AuxPort::Audio::Buffer< float > & buffer,
const float & threshold )
static

This function performs Zero Crossing on the AuxPort::Audio::Buffer.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = {
0 , abs(x) < threshold
x , else
}

Definition at line 49 of file AuxDistortion.cpp.

◆ zeroCrossing() [2/2]

float AuxPort::Audio::Distortion::zeroCrossing ( float & audio,
const float & threshold,
const bool & preserve = true )
static

This function performs Zero Crossing on the given sample.

[Mathematical Formula]
Let x be the input sample
Let y be the output sample
y = {
0 , abs(x) < threshold
x , else
}

Definition at line 58 of file AuxDistortion.cpp.


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