Distortion Suite

19 Distortion Types

effects.distortion

Comprehensive distortion library from subtle saturation to extreme wavefolds.

Common Parameters (All Distortions)

Parameter Type Default Description
signal np.array required Input audio signal
gain float varies Drive/gain amount
mix float 1.0 Dry/wet mix (0=dry, 1=wet)
Classic Distortions
fuzz_distortion(signal, gain=10.0, threshold=0.3, mix=1.0)

Extreme fuzz with hard clipping. High gain, low threshold for aggressive sound.

overdrive_distortion(signal, gain=2.0, threshold=0.5, mix=1.0)

Soft tube-style overdrive. Moderate gain for warm crunch.

saturation_distortion(signal, gain=1.5, threshold=0.7, mix=1.0)

Subtle tape-style saturation. Low gain for gentle warmth.

hard_clip_distortion(signal, gain=5.0, threshold=0.5, mix=1.0)

Digital hard clipping at threshold level.

Wavefold Distortions
wavefold_distortion(signal, gain=5.0, mix=1.0)

Classic wavefolder. Folds signal back on itself for harmonic richness.

triangle_fold_distortion(signal, gain=5.0, mix=1.0)

Triangle wave shaping fold.

sawtooth_fold_distortion(signal, gain=5.0, mix=1.0)

Sawtooth wave shaping fold.

parabolic_fold_distortion(signal, gain=5.0, mix=1.0)

Parabolic curve folding for smooth harmonics.

exp_fold_distortion(signal, gain=5.0, mix=1.0)

Exponential curve folding.

fractal_fold_distortion(signal, gain=5.0, mix=1.0)

Self-similar fractal folding pattern.

mirror_fold_distortion(signal, gain=5.0, mix=1.0)

Symmetric mirror folding.

dynamic_triangle_fold_distortion(signal, gain=5.0, mix=1.0)

Envelope-following triangle fold.

Mathematical Distortions
cubic_distortion(signal, gain=1.0, k=0.1, mix=1.0)

Cubic polynomial waveshaping. k controls curve shape.

logistic_distortion(signal, gain=5.0, mix=1.0)

Logistic function (S-curve) waveshaping.

poly_distortion(signal, gain=2.0, k1=0.2, k2=0.1, mix=1.0)

Polynomial waveshaping with k1, k2 coefficients.

chebyshev_fold_distortion(signal, gain=2.0, n=2, mix=1.0)

Chebyshev polynomial of order n for precise harmonic generation.

frequency_lock_distortion(signal, gain=5.0, mix=1.0)

Frequency-locked distortion effect.

Digital/Lo-Fi Distortions
bitcrush_distortion(signal, gain=1.0, bits=8, mix=1.0)

Reduce bit depth. bits=8 for 8-bit sound, lower for more crunch.

asymmetric_distortion(signal, gain=3.0, threshold_pos=0.6, threshold_neg=0.4, mix=1.0)

Different clipping for positive/negative peaks. Creates even harmonics.

Example Usage

from audio_dsp.effects import (
    fuzz_distortion,
    wavefold_distortion,
    bitcrush_distortion,
    chebyshev_fold_distortion
)
import soundfile as sf

# Load audio
audio, sr = sf.read("input.wav")

# Heavy fuzz
fuzzed = fuzz_distortion(audio, gain=15.0, threshold=0.2, mix=0.9)

# Wavefold for synth-like harmonics
folded = wavefold_distortion(audio, gain=8.0, mix=0.7)

# 8-bit retro
crushed = bitcrush_distortion(audio, bits=6, mix=1.0)

# Precise 3rd harmonic
chebyshev = chebyshev_fold_distortion(audio, gain=2.0, n=3, mix=0.5)

sf.write("distorted.wav", fuzzed, sr)

Resonant Filter

filter_effect

effects.LP_BP_filter

4-pole resonant ladder filter with tanh saturation for analog-style filtering.

Parameters

Parameter Type Default Description
input_signal np.array required Input audio signal
sample_rate int 44100 Sample rate in Hz
cutoff float 1500 Cutoff frequency in Hz (50-5000)
resonance float 0.7 Resonance/feedback amount (0-5)
q float 1.0 Q factor / bandwidth (0.1-10)
filter_type str "lowpass" "lowpass" or "bandpass"

Example Usage

from audio_dsp.effects import filter_effect
import soundfile as sf

audio, sr = sf.read("input.wav")

# Low-pass with resonance
filtered = filter_effect(
    audio,
    sample_rate=sr,
    cutoff=800,
    resonance=2.5,
    filter_type="lowpass"
)

# Bandpass for wah-style
bandpass = filter_effect(
    audio,
    sample_rate=sr,
    cutoff=1200,
    resonance=4.0,
    q=5.0,
    filter_type="bandpass"
)

sf.write("filtered.wav", filtered, sr)

Vocoder

vocoder

effects.vocoder requires librosa

Classic vocoder with spectral envelope modulation and configurable filter banks.

Parameters

Parameter Type Default Description
modulator_file str required Path to voice/control WAV file
carrier_file str None Path to carrier WAV (optional)
output_file str "vocoded.wav" Output file path
n_filters int 32 Number of filter bands
freq_range tuple (20, 20000) Frequency range (low_hz, high_hz)
carrier_type str "noise" "noise" or "sawtooth"
carrier_freq float 100 Sawtooth frequency if no carrier file

Example Usage

from audio_dsp.effects.vocoder import vocoder

# Voice through synth carrier
vocoder(
    modulator_file="voice.wav",
    carrier_file="synth_pad.wav",
    output_file="robot_voice.wav",
    n_filters=64
)

# Classic Daft Punk style (sawtooth carrier)
vocoder(
    modulator_file="speech.wav",
    carrier_type="sawtooth",
    carrier_freq=110,
    n_filters=48,
    freq_range=(80, 8000)
)

# Whisper effect (noise carrier)
vocoder(
    modulator_file="speech.wav",
    carrier_type="noise",
    n_filters=32
)

Phaser/Flanger

phaser_flanger_effect

effects.phaser requires librosa

Combined phaser and flanger effect with independent controls.

Parameters

Parameter Type Default Description
input_signal np.array required Input audio signal
sample_rate int 44100 Sample rate in Hz
phaser_rate float 0.5 Phaser LFO rate in Hz
phaser_depth float 0.8 Phaser notch depth (0-1)
phaser_stages int 4 Number of all-pass stages
flanger_delay_base float 0.005 Base delay time in seconds
flanger_delay_depth float 0.005 Delay modulation depth
flanger_rate float 0.25 Flanger LFO rate in Hz
phaser_mix float 0.7 Phaser wet/dry (0-1)
flanger_mix float 0.7 Flanger wet/dry (0-1)
wet_mix float 0.7 Overall wet/dry (0-1)

Example Usage

from audio_dsp.effects.phaser import phaser_flanger_effect
import soundfile as sf

audio, sr = sf.read("guitar.wav")

# Classic phaser
phased = phaser_flanger_effect(
    audio,
    sample_rate=sr,
    phaser_rate=0.8,
    phaser_depth=0.9,
    phaser_stages=6,
    phaser_mix=0.8,
    flanger_mix=0.0  # Disable flanger
)

# Jet flanger
flanged = phaser_flanger_effect(
    audio,
    sample_rate=sr,
    phaser_mix=0.0,  # Disable phaser
    flanger_delay_base=0.003,
    flanger_delay_depth=0.007,
    flanger_rate=0.1,
    flanger_mix=0.9
)

sf.write("phased.wav", phased, sr)

Super Delay

SuperDelay

effects.super_delay requires librosa

Feature-rich delay with pitch drift, flutter, saturation, and compression.

delay() Parameters

Parameter Type Default Description
input_file str required Input WAV path
output_file str required Output WAV path
delay_time float 0.25 Delay time in seconds
feedback float 0.7 Feedback amount (0-1)
mix float 0.5 Wet/dry mix (0-1)
lp_cutoff float 3000 Low-pass filter cutoff Hz
flutter_base_rate float 5.0 Flutter LFO rate Hz
flutter_depth float 0.005 Flutter modulation depth
pitch_drift_depth float 0.1 Pitch drift amount
drive float 2.0 Saturation drive
threshold float 0.7 Compressor threshold
ratio float 4.0 Compression ratio

Example Usage

from audio_dsp.effects.super_delay import SuperDelay

delay = SuperDelay()

# Tape-style delay with wow/flutter
delay.delay(
    input_file="vocals.wav",
    output_file="tape_delay.wav",
    delay_time=0.375,  # dotted eighth
    feedback=0.6,
    lp_cutoff=2500,
    flutter_depth=0.01,
    pitch_drift_depth=0.15,
    drive=3.0
)

# Clean digital delay
delay.delay(
    input_file="guitar.wav",
    output_file="clean_delay.wav",
    delay_time=0.5,
    feedback=0.5,
    flutter_depth=0.0,
    pitch_drift_depth=0.0,
    drive=1.0
)

Glitch Machine

glitch_machine

effects.glitch requires librosa

Segment-based glitch processor with multiple random effects.

Parameters

Parameter Type Default Description
input_file str required Input WAV path
output_file str required Output WAV path
n_segments int 32 Number of slices (16, 32, 64, 128)
intensity float 0.5 Fraction of segments to glitch (0-1)
loop_length float 2.0 Output duration in seconds

Applied Effects (Randomized)

Retrigger

Segment repetition / stutter

Pitch Shift

Random pitch transposition

Reverse

Play segment backwards

Quantize

Bit depth reduction

Sample Rate Reduce

Downsample for aliasing

Comb Delay

Short metallic delay

Time Stretch

Speed up / slow down

Ring Modulation

Metallic frequency multiplication

Example Usage

from audio_dsp.effects.glitch import glitch_machine

# Subtle glitching
glitch_machine(
    input_file="drums.wav",
    output_file="glitched_subtle.wav",
    n_segments=32,
    intensity=0.3,
    loop_length=4.0
)

# Extreme destruction
glitch_machine(
    input_file="vocals.wav",
    output_file="destroyed.wav",
    n_segments=128,
    intensity=0.9,
    loop_length=2.0
)

Multi-Band Saturation

process_multi_band

effects.multi_band_saturation

Split signal into frequency bands with independent saturation drive per band.

Parameters

Parameter Type Default Description
input_signal np.array required Input audio signal
fs int required Sample rate in Hz
crossovers list[float] required Crossover frequencies in Hz
drives list[float] required Drive amount per band (len = crossovers + 1)

Example Usage

from audio_dsp.effects.multi_band_saturation import process_multi_band
import soundfile as sf

audio, sr = sf.read("master.wav")

# 3-band saturation: warm lows, crunchy mids, clean highs
saturated = process_multi_band(
    audio,
    fs=sr,
    crossovers=[200, 2000],      # Split at 200Hz and 2kHz
    drives=[2.0, 5.0, 1.0]        # Low, Mid, High drive
)

# 4-band with surgical control
saturated = process_multi_band(
    audio,
    fs=sr,
    crossovers=[100, 500, 4000],
    drives=[1.5, 3.0, 4.0, 1.0]
)

sf.write("multiband_sat.wav", saturated, sr)

Negative Audio / Sidechain

Negative Audio

effects.negative_audio

Waveform inversion and sidechain compression for pumping effects.

create_negative_waveform()
Parameter Type Description
input_signal np.array Input audio signal

Returns: 1 - x(t) mapped waveform

sidechain_compressor()
Parameter Type Default Description
input_signal np.array required Signal to compress
control_signal np.array required Sidechain trigger (e.g., kick)
fs int required Sample rate
threshold float 0.2 Threshold (0-1)
ratio float 10.0 Compression ratio
attack_ms float 5 Attack time in ms
release_ms float 50 Release time in ms

Example Usage

from audio_dsp.effects.negative_audio import (
    create_negative_waveform,
    sidechain_compressor
)
import soundfile as sf

# Invert waveform
audio, sr = sf.read("input.wav")
negative = create_negative_waveform(audio)

# EDM-style pumping sidechain
bass, sr = sf.read("bass.wav")
kick, _ = sf.read("kick.wav")

pumped = sidechain_compressor(
    bass,
    kick,
    fs=sr,
    threshold=0.1,
    ratio=20.0,
    attack_ms=1,
    release_ms=100
)

sf.write("pumping_bass.wav", pumped, sr)

Advanced Compressors

Specialized Compressors

effects

Advanced compression algorithms for creative dynamics processing.

spectral_flow_compressor

Spectral domain compression operating on frequency bins.

topological_dynamics_compressor

Advanced adaptive compression with topological analysis.

super_clean_compressor

Transparent dynamics control for mastering.

fractional_calculus_compressor

Fractional-order compression for unique dynamics curves.