std1.0.0-beta-7 SafeC docs

std :: dsp::comb

Struct std::KarplusStrong

#include <std/dsp/comb.h> source

struct KarplusStrong {
    &double buffer;
    unsigned long length;
    unsigned long pos;
    double damping;
}

Fields

§&double buffersource

ring buffer, length 'length' — doubles as the delay line and the pitch period

§unsigned long lengthsource
§unsigned long possource
§double dampingsource

0..1; closer to 1 = slower decay (typical: 0.99-0.999)

Methods

§double next()source · definition

The next output sample.

§void pluck([]const double excitation)source · definition

Refill the delay line with a new excitation (n samples copied in; if n < length the remainder is left at its previous contents — callers doing a fresh pluck should size the excitation to 'length').

§static struct KarplusStrong new([]double buffer, double damping)source · definition

'buffer' is the caller's delay line of 'length' samples; seed it (or call pluck) with an excitation before next().

length = buffer.len