Reverse Engineering Pluck + aesthetic question


First :
I would like to get the 1:1 replica of Pluck, by deconstructing its principle step by step. But I didn’t nail it. This is the comparison between the original and my two attempts:

// original 

SynthDef(\KARPLUS0, {
	var freq, sig;
	freq = 50;
	sig =,, freq.reciprocal, freq.reciprocal, 22, 0.1);, sig * 0.1 !2 )


// attempt 1

SynthDef(\KARPLUS1,  { |  amp = 0.005|

var time, ex, freq, delay, filter, local;	
freq = 50;
time = freq.reciprocal;
ex =[1.0,1.0,0.0,0.0], [0.04, 0,100])));
local =;
filter =, 0.1); //apply filter
delay =, time, time -; * 0.999);, delay * 0.1 ! 2);


// attempt 2

SynthDef(\KARPLUS2, {

	var burst, env, sig, delayTime, freq;
	freq = 50;
	delayTime = freq.reciprocal;
	env =, 0.12));
	burst =;
	sig =, delayTime, delayTime, 12, add: burst );, doneAction:2);, sig * 0.1 !2 )

	} ).play;)

Is someone would be able to make the 1:1 just using the basic Ugens ? It could be really helpfull.

It’s not about a technical issue but more about an aesthetic advice : I feel stuck on the tone question with this Karplus-Strong algo. I would like to know if there would be an oblique strategy to get others varieties of tone (less metallic) still using the basic principle of KS (not using the DWG Ugens…). So far my only way is to change the nature of the noise burst, or to add effects to the signal. But I would really like to know if it’s possible to imagine a “core” version to change the tone of the KS algo.

Thanks a lot

1 Like

I think it’s basically this if you break it down… Look at the documentation for Pluck, under the trig argument.

upon a negative to positive transition, n samples of the excitation signal will be fed into the delay line, where n = delaytime * sample_rate / 2, using a rectangular envelope (no fading).

So what you have is pretty close, you just didn’t account for that in the envelope.

SynthDef(\KARPLUS1, {
	|freq = 50, decay = 22, coef = 0.1|
	var sig, exc, trig;
	trig =;
	//"upon a negative to positive transition, n samples of the excitation signal will be fed into the delay line"
	exc =;
	//", where n = delaytime * sample_rate / 2 using a rectangular envelope (no fading)"
	exc = exc *, freq.reciprocal * 0.5); //sampledur * samplerate = 1
	sig =, freq.reciprocal, freq.reciprocal, decay); //CombN since the frequency is not modulating
	sig =, coef);, sig * 0.1 !2 )


Probably someone has a better answer about metallic tone than I do, but changing the filter coefficient will help some. I think if you cascade delay lines and filters (like in a Dattorro reverb) it might help as well.
You can also add filters (to cut or boost frequencies) or change the input source to get a tone closer to what you’re after. Keep in mind comb filtering by itself is probably going to give you a metallic stringy sound if you’re feeding it a short burst of noise, hence the built in one pole filter.
You might also layer more sounds in after the filtering to color it a certain way.

*edit: I was right, you can cascade the delay line and you can also modulate the delay time very slightly to recude the metallic artifacts. You might also consider using AllPass instead of Comb.

	|freq = 261.63, dec = 1.0| 
	var exc = *, freq.reciprocal * 0.5);
	var n = 10;
	var sig = exc;{sig =, freq.reciprocal, freq.reciprocal *, 1.0), dec)};

Try using excitation signals that aren’t just noise bursts. Here’s what you can get using a sine wave chirp:

EDIT: Also, be aware that LocalIn/LocalOut incur a delay of one block size, which is by default 64 samples.


wow @nathan that is sick yikes

Killer guitar emulation!