audioJS

@audio/effect-distortion

Status calibrated

npm1.1.5licenseMIT

Distortion / saturation — non-linear waveshaping

Overview

Install
Updated
Family
effect, 26 packages under it
Tags
shape
import distortion from '@audio/effect-distortion'

Four waveshaping types: cubic soft clip, hard clip, tanh saturation, and wavefolding.

drive distortion amount 0–1 (default 0.5, maps to 1–10× input gain) · type 'soft' | 'hard' | 'tanh' | 'foldback' (default 'soft') · mix wet/dry 0–1 (default 1) · fs sample rate

import distortion from '@audio/effect-distortion'

// Soft saturation
let p = { drive: 0.6, type: 'soft', fs: 44100 }
for (let buf of stream) distortion(buf, p)

// Hard clip
distortion(buf, { drive: 0.8, type: 'hard' })

// Tanh (asymptotically smooth, never clips hard)
distortion(buf, { drive: 0.5, type: 'tanh' })

// Wavefolding (metallic/harsh)
distortion(buf, { drive: 0.7, type: 'foldback' })
type character clamps at ±1
soft cubic saturation, smooth knee yes
hard brickwall clip, harsh yes
tanh asymptotically smooth approaches 1
foldback metallic, complex harmonics yes

Use when: guitar overdrive, tube saturation, lo-fi crunch, harmonic enrichment
Not for: transparent limiting (use limiter)


Part of @audio/effect — the effect family umbrella. This README is generated from the umbrella docs.

MIT © audiojs