Search guides and the APICtrl K
  1. API reference
  2. DSP

delay.h

The delay as a finished machine.

#include <sonore/delay.h>
On this page

Design notes

DelayLine in dsp.h is the primitive: a ring you write and read. Every "delay plugin" a user asks for is the same machine on top of it -- two lines, feedback with a filter in the loop, ping-pong routing, a little modulation, tempo sync -- and every one of them has been rebuilt from the primitive by hand, which is where the time knob comes out with a zipper and the feedback runs away. This is that machine, once.

The one decision that separates a good delay from a bad one is what happens when the TIME changes while audio is running:

CROSSFADE
the old delay keeps reading while a second read head opens at the new time, and the two are faded over ~50 ms with equal-power gains. No pitch shift, no click. What a digital delay does, and the default. A change that arrives while a fade is still running is QUEUED and starts when the fade lands: restarting a fade from a blend of two delay times would jump the old head, which is the click this mode exists to avoid, and a dragged knob arrives as dozens of changes.
GLIDE
the read point slides from the old time to the new, so the audio in flight is pitched down or up while it slides -- the tape-echo "spin", which some people turn the knob for. The slide is a one-pole with a 100 ms time constant AT ANY RATE (the coefficient is derived in prepare, not a constant), and its speed is CAPPED at half a sample per sample: a one-pole alone moves a 100 ms change at one sample per sample for its first moments, which is not a spin, it is the audio stopping dead. Capped, a large change pitches down by an octave (or up by a fifth) and eases into the new time.

Both are here because both are real, and a delay that only does one is missing half the users. Every read is the cubic tap: a static delay at a fractional time through the linear tap is a lowpass, and switching taps at the end of a fade is a step the ear can hear.

Included by dsp.h.

Types 1

template <int MaxSamples = 192000> class StereoDelay

SIZE: MaxSamples floats per channel -- the default holds four seconds at 48 kHz in 1.5 MB for stereo. A member of the plugin, never a local.

↑↓ to move↵ to openEvery public name in the headers, and every guide