Clipper

ATMOSYNTH built-in module

A ceiling the sound is not let past. Drive is how hard it is pushed into it, in decibels: at nothing only what already reaches the ceiling is cut, and turned up the quieter parts rise under it while the peaks stay where it is, so a drum gets louder without getting taller and a held note turns square. Ceiling is where it is, in decibels of full scale, and so also how loud the module is once it is clipping. Knee is the corner: at nothing the sound runs straight up to the ceiling and flat along it, the hard, bright clip; turned up it bends over before the ceiling and meets it gently, which takes the edge off and makes fewer of the high harmonics a corner makes. Cutting a peak off makes harmonics without end, and every one above half the sample rate would fold back down under the note at a pitch that has nothing to do with it, so the clip is worked out at four times the rate and filtered back down. The filters are flat to 20 kHz and look at nothing ahead: what comes out is about three samples behind what went in, under a tenth of a millisecond, where a waveshaper oversampling four times is four milliseconds behind. Bringing a clipped sound back down smooths its corners, and a smoothed corner overshoots. Ceiling mode chooses what happens to that: exact clamps what comes down to the ceiling, so nothing leaves above it, which is what a clipper in front of the speakers is for, but cutting those peaks at the ordinary rate folds again, and on a sound driven lightly it undoes most of what the oversampling cleaned; clean leaves the overshoot in, up to three decibels over on a sine and more on a drum driven hard, and keeps all of it. Dry/wet keeps the sound that went in, at the level it came in, beside the clipped one, and the two are blended before the way down so they stay together sample for sample; under exact the ceiling holds over the blend as well. Each side is clipped on its own. Drive is an input as well, with a depth in decibels for how far a signal there moves it: an envelope into it pushes the start of a note harder than its tail. This module carries code: the vocabulary's one way to clip at a higher rate is a waveshaper's oversampling, whose filters are the browser's and four milliseconds long, and nothing else in it runs at any rate but the context's.

Four notes played on Keys, passing through it on their way out.

What it is made of

Ports: audio input ‘In’, audio input ‘Drive’, audio output ‘Out’.

  • ‘in’: audio input · port in · into ‘gen’
  • ‘gen’: DSP JS (your own code) · runs its author’s code · into ‘out’ · drive turned by ‘Drive (dB)’ · ceiling turned by ‘Ceiling (dB)’ · knee turned by ‘Knee’ · mode turned by ‘Ceiling mode’ · mix turned by ‘Dry/wet’
  • ‘out’: audio output · port out
  • ‘drivein’: audio input · port drive · into ‘drivedepth’
  • ‘drivedepth’: Gain · modulates the drive of ‘gen’ · level turned by ‘Drive depth (dB)’
  • ‘Drive (dB)’: knob, 0 to 24
  • ‘Ceiling (dB)’: knob, -24 to 0
  • ‘Knee’: knob, 0 to 1
  • ‘Ceiling mode’: knob, exact / clean
  • ‘Dry/wet’: knob, 0 to 1
  • ‘Drive depth (dB)’: knob, -24 to 24

Patches built on it

2 published patches