Karplus Strong algorithm problem

Félix's icon

Hi!

First post on the forum!

Max Patch
Copy patch and select New From Clipboard in Max.

I'm trying to recreate the karplus strong algorithm and I have seen patches other people made on the subject but I can't seem to find what is wrong with mine.
My problem is that even though I send a different note value to be converted to milliseconds it always plays the same pitch.
Maybe one of you can redirect me to to some info could explain my error to me!
I have join a sceenshot of the patch and...
My patch:

Thanks !

karplus.png
png
Peter Castine's icon

The minimum delay time for tapin~/tapout~ is the vector size.

I can't know what your DSP settings are. But assuming a fairly typical configuration of SR=44,100 HZ and a vector size of 512 samples, that means the shortest delay is about 11 msec (about 90 Hz), allowing you to play around with the lowest half octave of your kslider. If you pull sample size down to 32 samples/vector, you can get much smaller delays (and higher frequencies).

brendan mccloskey's icon

Hi Felix
Peter concisely summarizes the math(s): tapin/out delay time minimum is restricted to the signal vector size in your audio settings. However, if you have Gen as part of your Max download you can bypass this restriction; see

Max/examples/gen/gen~ karplus strong

And remember, if you aim to 'recreate' a traditional acoustic instrument (violin, guitar etc), they will have their own unique pitch ranges and limitations anyway.

Max Patch
Copy patch and select New From Clipboard in Max.

If you don't have Gen, check your DSP CPU Monitor under 'Extras', and compare the hit on your CPU when sigVS (Options/Audio Status) is 2, and when it's 256.

Brendan

brendan mccloskey's icon

(ps, I have a really nice bowed violin KS string here, by Dave Mollen from a few years ago, if you'd like to have a poke around at it)

Harry Lodes's icon

Hi Brendan! I've been investing time into building a full-feature synthesized violin model recently; is there any chance you could share Dave Mollen's patch? Would be much appreciated!

brendan mccloskey's icon

PM me
brendanmac2017 [at] geemail dot etc

No longer on Max here, but I'll blow the cobwebs off my HDD and see what's in there. This is likely to be a patch I would keep

Brendan

brendan mccloskey's icon

(Don't ask me to discuss the maths underlying this physical model - or any, for that matter. But I do recall that 2 delay/filter loops are required: one for the string vibrations at bow/pick to BRIDGE, and another for the bow/pick to NUT string portion. If 8ms delay time = 125Hz, and the string is divided at 1/8th its length, then that millisecond value is 7/8 of 8ms for the long string section, 1/8 of 8ms for the short section. The noise impulse can be simply a white noise burst, or a more sophisticated filtered bowing (shaped) noise source. Bear in mind the sigvs limitation of tapin/out. But nowadays we all do gen~ don't we?

http://users.spa.aalto.fi/vpv/publications/cmj98.pdf, is a quite accessible source, amongst others).

HTH

brendan mccloskey's icon