[sdiy] karplus-strong drum synthesis
Olivier Gillet
ol.gillet at gmail.com
Sat Aug 20 22:43:13 CEST 2011
On which page is the equation you are trying to implement? I can't
find anything in the paper resembling the equation you give.
Karplus strong synthesis is always done in a circular buffer, so when
looking at the past samples you "wrap around" the buffer. One way to
look at it is to say you're doing wavetable synthesis while constantly
filtering the wavetable as it is being played.
A practical implementation of the algorithm on page 46 would be:
allocate a 2 * p array A and fill it with random numbers.
ptr = 0
for each sample:
if rnd > blend:
A[ptr] = 0.5 * (A[(ptr + p) % (2 * p)] + A[(ptr + p - 1) % (2 * p)]
else:
A[ptr] = -0.5 * (A[(ptr + p) % (2 * p)] + A[(ptr + p - 1) % (2 * p)]
output = A[ptr]
ptr = (ptr + 1) % (2 * p)
More information about the Synth-diy
mailing list