effects.h
Composite effects.
#include <sonore/effects.h>- 8types
- Guides: Getting started, MIDI and MPE
On this page
Design notes
The primitives in dsp.h are the parts; these are the finished machines a generated plugin reaches for by name: a reverb, a chorus, a limiter, a gate, a crossover. Each one is the standard published topology, implemented here, and each is allocation-free with its buffers sized at compile time.
Included by dsp.h, so #include <sonore/dsp.h> stays the single entry point.
Types 8
Schroeder/Moorer reverb: four damped feedback combs in parallel into two allpasses in series, per channel, with the right channel's delays offset so the two decorrelate into a stereo field.
The delay lengths are mutually prime primes at 44.1 kHz, the classic choice, because common factors make the comb resonances line up and the tail rings on a pitch instead of decaying evenly.
Chorus / flanger. The difference is only depth and delay range: a flanger modulates a very short delay (under ~10 ms) with feedback to make the comb notches audible; a chorus uses a longer one and no feedback so it thickens rather than whooshes. One implementation covers both.
Phaser: a chain of modulated allpass stages mixed with the dry signal. The notches come from cancellation between the two paths, so unlike a flanger the spacing is not harmonic, which is what makes it sound like sweeping rather than like a jet.
template <int MaxLookaheadSamples = 1024> class Limiter
The default look-ahead buffer holds 3 ms up to 340 kHz; the old 512 ran out just past 170 kHz and silently shortened the look-ahead.
Noise gate with hysteresis and a hold time.
One threshold chatters: a signal sitting exactly at it opens and closes every few samples. A separate (lower) close threshold plus a minimum hold is what makes a gate usable on a real drum track.
Linkwitz-Riley 4th-order crossover: two cascaded Butterworth sections per band. The defining property is that the low and high outputs sum FLAT, which is what makes it the right tool for multiband processing: a plain pair of filters leaves a peak or a dip at the crossover point.
Mid/side width control. Width 0 collapses to mono, 1 is untouched, >1 exaggerates the sides. Mono compatibility is why this works on M/S rather than by panning: the mid is preserved exactly.
Constant-power panner. pan is -1 (left) .. 0 (centre) .. +1 (right); the -3 dB centre law keeps perceived loudness constant across the sweep.