Plucked string waveguide Karlpus-Strong model

DC-omix's icon

Does anyone have a patch with the basic form of the Karplus-Strong algorithm or some other similar implementation for a waveguide physical model of a plucked string?

Cheers,

D

Michael Gary Dean's icon

Here's a Max for Live synth I made....

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

A basic maxpatch just to demonstrate the algorithm:

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

And.... one more for good measure:

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

Hope that helps...

Michael Gary Dean's icon
DC-omix's icon

Thanks, that is very helpful.
Do you know if there's any way around the 1.5 ms limit? Basically I've created a graphic scoring/live performance system in Max/MSP, that allows the user to write a score in graphic (XY) form and then to perform live interacting with the score itself. To replay the scored material in performance mode I have included a number of synths in the patch (additive, FM , and so on) and I wanted to include a waveguide string synth too, however the interface allows the user to score tones across the entire audible range so I need a synth that can go up to 20kHz (or there about), so basically i was wondering whether anyone had found a way around the 1.5 ms limit (but i guess not because of the limitations in MSP's signal rate).

D

Emmanuel Jourdan's icon

the 1.5ms limitation actually comes from the vector size. If you set the signal vector size to something less than 64 samples you'll have the possibility to make shorter delays (which will give you the higher frequencies).

DC-omix's icon

yeh but to get to 20kHz with a Karplus-Strong algorithm I'd have to sacrifice the audio quality of the entire patch (including the quality of all the other synths in it, some of which are fairly realistic)

brendan mccloskey's icon

see the end of this thread re [tapin~] v [delay~]:

and my contribution to the string model examples:

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

Brendan

Brad Garton's icon

csound [csound~], RTcmix [rtcmix~] and ChucK [chuck~] all have good implementations of the K-S algorithm plus other fun physical models with no restrictions on vector size. The RTcmix version also has the snazzy Charles Sullivan enhancements allowing feedback/distortion.

pid's icon

@DC-omix:
you need to look into [poly~] more. with poly~ you can stick just your K-S in it, set its own samplerate and vector and get higher freqs, without sacrificing your other synths. poly~ is the coolest object in max. in fact not an object but a whole world in itself. however, 20kHz karplus-strong is gonna sound like shite whichever way you do it...

@brad +
yes brad is correct. for physical modelling use [csound~] and/or brad's AWESOME externals [chuck~] and [rtcmix~]

@everyone
does anyone know whatever happened to the 'percolate' project? it is SUCH a shame this never saw any light since max5. anyone know if anyone is actively thinking of working on this? it would be amazing to have updated percolate library.
the coolest PM max stuff i ever saw was manuel poletti's patches around the ircam 'modallys' library. however, last i looked, this was lingering in the same crap state as so much other COOL ircam software - max4 and no news of an update.

sorry for slight thread hijack.

Brad Garton's icon

Ah -- forgot to mention the PeRColate objects, too. They're still there, just checked and they seem to work fine w/ Max 5.1.7:

DC-omix's icon

@pid

yeah i realise a K-S model synth isn't going to sound great at the higher end of the frequency range, but the option to use it at those frequencies has to be there since the program is being made for use in experimental composition. It may not be desirable to use the synth for such high pitches, but there may be a few people who wish to do so, so the option has to be there.

anyway, thanks for the advice, i'll look into re-patching the K-S with [poly~].

pid's icon

@DC-omix, i was just being a twat. i'd actually be one of those people "...who wish to do so..." myself afterall. saw some of your vids lately btw... awesome!

DC-omix's icon

@pid

Thanks. glad you enjoyed them, I was thinking of doing some videos where I explain how some of the software I have created works and also making the software available. I've just never been really sure there would be many people interested in the kind of crazy stuff I do, I guess it's just a case of making the stuff available and people who are interested in that sort of thing will eventually come across it.

Anyway, I'm still debating whether to include the K-S synth in my new system. Basically it's tetraphonic with four different types of sound being controlled to produce four independent frequencies at any one time, the first is an additive organ/violin-type synth, the second is an FM tuned percussion (bell-type) synth, the third has a wind instrument-type sound and for the fourth I was thinking of including a plucked string sound, but there are other possible candidates such as a granular synth. does anyone have any suggestions as to what type of sound would be a good candidate to interact with other three?
(sorry for hijacking the thread)

saulpimpson's icon

@Brad I cannot figure out what needs to be done to install PeRcolate. I keep getting Object missing and I know that it is in the search path. I followed the instructions.

brendan mccloskey's icon

@saulpimson

what OS you on? I have v0.9b5 for winVista here working fine, I could zip the lot for you if you want

Brendan

Brad Garton's icon

brendan brings up a good point -- windows or mac? Olaf Matthes did the windows port. We have it linked from Columbia, but we only have the mac version on our site.

All I did was drag the PeRColate-UB and PeRColate-support folders into my Applications/Max5/Cycling '74/ folder and they worked fine.

saulpimpson's icon

I'm using Mac osx 10.6.6

I misread the instructions and put the PeRColate-UB and PeRColate-support folders in the Support folder (Applications/Max5/Cycling '74/Support)

They are working now.

Michael Gary Dean's icon

I'm a student in computer music and after discovering the Karplus-Strong algorithm, I've been really intrigued to find and build some more physical modeling patches. Can anyone recommend any other algorithms that would be fun and interesting to build a .maxpat synth from?

brendan mccloskey's icon

Hi Mike
if you're thinking of DIY patches, I had great fun recreating instrument models using the soundonsound synthesis tutorials here:

if you're after more 'mathematical' models, I've no doubt a quick google of 'physical modelling' would give you an endless supply....

and hacking existing examples, such as Dave Bessell's excellent synths,
http://madwiki.beds.ac.uk/madwiki/index.php/User:Dave
is also fun!

Brendan

chapelier fou's icon

Hi there.
How comes that the more I filter the feedback signal, the lower are pitches in the high range ?

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

Thanks for your lights !

volker böhm's icon

because an ordinary filter is a frequency dependent delay.

Roman Thilenius's icon

you are supposed filter the impuls(es) instead!

volker böhm's icon

you are supposed filter the impuls(es) instead!

no, this is something else.
the question was about a (lowpass-) filter in the feedback path - this models the natural damping of high frequency content over time.

chapelier fou's icon

Thanks for the answer. I'm not sure I really understand, but I'll think about it !

Roman Thilenius's icon

and what is a solution, volker?
i wouldnt dare to do that inside the feedback loop already.
the freqency is known, so you could just use an envelope for the post filter, no?

volker böhm's icon

a lowpass filter inside the feedback loop is an important building block of many physical models. Depending on the other (possibly non-linear) ingredients in the feedback path, you can't get the same results by filtering the output (+envelope).
One solution is to use a linear-phase filter (which might or might not be overkill), where the introduced delay is know (and equal for all frequencies!).
a simple recursive filter, like onepole~, has a non-linear phase response (check the onepole~ help patch!), i.e. frequency components entering the filter, will be delayed by differing amounts. That leads to the resulting spectrum being slightly inharmonic (the degree depends on the cutoff frequency). This sounds quite nice, imho, and can appear to be more "natural" than a "mathematical correct" harmonic spectrum.
But it also affects pitch perception :)
You could try to calculate the time delay (correspoding to the actual cutoff freq) of the fundamental frequency and use that value to correct the delay time of your karplus-strong thing (see sketch below). Of course this will not undo the inharmonicity of the onepole~.
Or you might get fancy and try to "correct" the phase-nonlinearity of the filter by cascading an allpass filter, that has an opposite phase response...
But things are worse even, as the delay line uses interpolation to allow for sub-sample delay times. This is a kind of lowpass filtering, too and you get more inconsistencies of the resulting spectrum - it's as always, if you dig deeper and deeper, it get's more and more complicated...

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


Roman Thilenius's icon

hm, i already ran into this too often; when you use a symetrical tranfer function you dont really know how long it is and then i end up introducing 500 ms of latency which fucks up the application. (latency in a generator, haha)

why it wont work with other filter types i clear to me - but i dont grasp how a frequency filter could be of any use inside the feed back loop, i.e. i would be interested what the idea CF´s attempt was.

i assume it performs job like ... making the damping depending on the gain of the exiter and things like that? until now i only controlled the spectrum of the exciter or put a post filter. maybe it is time for a change.