Effects
Audio processing effects including distortion, filters, vocoders, delays, and spectral processors.
Distortion Suite
19 Distortion Types
effects.distortionComprehensive 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
Extreme fuzz with hard clipping. High gain, low threshold for aggressive sound.
Soft tube-style overdrive. Moderate gain for warm crunch.
Subtle tape-style saturation. Low gain for gentle warmth.
Digital hard clipping at threshold level.
Wavefold Distortions
Classic wavefolder. Folds signal back on itself for harmonic richness.
Triangle wave shaping fold.
Sawtooth wave shaping fold.
Parabolic curve folding for smooth harmonics.
Exponential curve folding.
Self-similar fractal folding pattern.
Symmetric mirror folding.
Envelope-following triangle fold.
Mathematical Distortions
Cubic polynomial waveshaping. k controls curve shape.
Logistic function (S-curve) waveshaping.
Polynomial waveshaping with k1, k2 coefficients.
Chebyshev polynomial of order n for precise harmonic generation.
Frequency-locked distortion effect.
Digital/Lo-Fi Distortions
Reduce bit depth. bits=8 for 8-bit sound, lower for more crunch.
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
effects.LP_BP_filter4-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
import soundfile as sf
audio, sr = sf.read("input.wav")
# Low-pass with resonance
filtered = filter(
audio,
sample_rate=sr,
cutoff=800,
resonance=2.5,
filter_type="lowpass"
)
# Bandpass for wah-style
bandpass = filter(
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 no librosa neededClassic vocoder with spectral envelope modulation and configurable filter banks. Accepts file paths or numpy arrays.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| carrier | str | np.array | None | required | Carrier signal (file path, array, or None to generate) |
| modulator | str | np.array | required | Modulator signal (file path or array) |
| sr | int | None | Sample rate (required if inputs are arrays) |
| output_file | str | None | Output file path (optional) |
| 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
from audio_dsp.utils import load_audio, save_audio
# Load audio files
sr, carrier = load_audio("synth_pad.wav")
sr, modulator = load_audio("voice.wav")
# Voice through synth carrier
output, sr = vocoder(carrier, modulator, sr=sr, n_filters=64)
save_audio("robot_voice.wav", output, sr)
# Classic Daft Punk style (sawtooth carrier)
output, sr = vocoder(
carrier=None,
modulator="speech.wav",
carrier_type="sawtooth",
carrier_freq=110,
n_filters=48,
freq_range=(80, 8000)
)
# Whisper effect (noise carrier)
output, sr = vocoder(
carrier=None,
modulator="speech.wav",
carrier_type="noise",
n_filters=32
)
Phaser/Flanger
phaser_flanger
effects.phaserCombined 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 import phaser_flanger
import soundfile as sf
audio, sr = sf.read("guitar.wav")
# Classic phaser
phased = phaser_flanger(
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(
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)
Chorus
chorus
effects.random_chorusRandom chorus effect with multiple detuned voices for rich, spacious sound.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| input_signal | np.array | required | Input audio signal |
| sample_rate | int | 44100 | Sample rate in Hz |
| mix | float | 0.5 | Wet/dry mix (0-1) |
| amount | float | 1.0 | Pitch modulation amount |
| speed | float | 0.1 | Modulation speed |
| n_clones | int | 3 | Number of chorus voices |
| delay | float | 0 | Base delay in seconds |
Example Usage
from audio_dsp.effects import chorus
import soundfile as sf
audio, sr = sf.read("guitar.wav")
# Subtle chorus for warmth
warm = chorus(audio, sr, mix=0.4, amount=1.0, speed=0.1, n_clones=2)
# Lush 80s-style chorus
lush = chorus(
audio, sr,
mix=0.7,
amount=3.0,
speed=0.05,
n_clones=4,
delay=0.02
)
sf.write("chorus.wav", lush, sr)
Delay
delay
effects.super_delayFeature-rich delay with digital and analog modes. Analog mode includes pitch drift, flutter, saturation, and compression.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| input_signal | np.array | required | Input audio signal |
| sample_rate | int | 44100 | Sample rate in Hz |
| 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) |
| mode | str | "digital" | "digital" (clean) or "analog" (tape-style) |
| lp_cutoff | float | 3000 | Low-pass cutoff Hz (analog mode) |
| flutter_depth | float | 0.005 | Flutter modulation depth (analog mode) |
| pitch_drift_depth | float | 0.1 | Pitch drift amount (analog mode) |
| drive | float | 2.0 | Saturation drive (analog mode) |
Example Usage
from audio_dsp.effects import delay
import soundfile as sf
audio, sr = sf.read("vocals.wav")
# Clean digital delay
digital = delay(audio, sr, delay_time=0.5, feedback=0.5, mode="digital")
# Tape-style delay with wow/flutter
analog = delay(
audio, sr,
delay_time=0.375, # dotted eighth
feedback=0.6,
mix=0.7,
mode="analog",
lp_cutoff=2500,
flutter_depth=0.01,
pitch_drift_depth=0.15,
drive=3.0
)
sf.write("tape_delay.wav", analog, sr)
Glitch
glitch
effects.glitchSegment-based glitch processor with multiple random effects.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| input_signal | np.array | required | Input audio signal |
| sample_rate | int | 44100 | Sample rate in Hz |
| 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)
Segment repetition / stutter
Random pitch transposition
Play segment backwards
Bit depth reduction
Downsample for aliasing
Short metallic delay
Speed up / slow down
Metallic frequency multiplication
Example Usage
from audio_dsp.effects import glitch
import soundfile as sf
audio, sr = sf.read("drums.wav")
# Subtle glitching
glitched = glitch(audio, sr, n_segments=32, intensity=0.3, loop_length=4.0)
# Extreme destruction
destroyed = glitch(audio, sr, n_segments=128, intensity=0.9, loop_length=2.0)
sf.write("glitched.wav", glitched, sr)
Multi-Band Saturation
process_multi_band
effects.multi_band_saturationSplit 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_audioWaveform 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)
Compressors
compress
effects.super_clean_compressorHigh-quality compressor with transparent and vintage modes.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| input_signal | np.array | required | Input audio signal |
| sample_rate | int | 44100 | Sample rate in Hz |
| mode | str | "transparent" | "transparent" or "vintage" |
| threshold | float | -20.0 | Threshold in dB |
| ratio | float | 4.0 | Compression ratio (4.0 = 4:1) |
| attack | float | 0.01 | Attack time in seconds |
| release | float | 0.1 | Release time in seconds |
| knee_width | float | 6.0 | Soft knee width in dB |
| input_gain | float | 0.0 | Input gain in dB |
| output_gain | float | 0.0 | Output/makeup gain in dB |
| limit | bool | False | Hard limit at 0 dBFS |
Example Usage
from audio_dsp.effects import compress
import soundfile as sf
audio, sr = sf.read("drums.wav")
# Transparent mastering compression
compressed = compress(
audio, sr,
mode="transparent",
threshold=-18.0,
ratio=3.0,
attack=0.01,
release=0.1,
output_gain=3.0
)
# Vintage-style with saturation
vintage = compress(
audio, sr,
mode="vintage",
threshold=-24.0,
ratio=6.0,
attack=0.005,
release=0.05,
output_gain=6.0
)
sf.write("compressed.wav", compressed, sr)
Other Specialized Compressors
Spectral domain compression operating on frequency bins.
Advanced adaptive compression with topological analysis.
Fractional-order compression for unique dynamics curves.