good sources for gen dsp code online?

Apr 20, 2013 at 3:28pm

good sources for gen dsp code online?

I’ve looked at but there wasn’t much usable code – I’m guessing there are quite a few forums with useful stuff out there, I just don’t really know what to search for?

Apr 20, 2013 at 5:54pm

I don’t know of any good gen~repository, but nearly everytime i need something concrete i find a lot of papers discribing the math, and then the implementation is not very hard anymore. I guess that doesn’t help a lot..

Apr 20, 2013 at 6:23pm

I took a class on delay-based signal processing using Gen last fall and the way we got our feet in the door was to take a bunch of block diagrams of a range of filters and effects and just start recreating them in Gen.

Here’s a link to the PDF of block diagrams that we used for the course.

Apr 20, 2013 at 11:04pm

aw stringtapper, not only does that class sound absolutely flippin’ amazing (!!!), that doc is fantastic – got like a primer for which gen~ functions correspond to the blocks?

I’m particularly looking for the raw synthesis bits.

Apr 20, 2013 at 11:40pm

please excuse the noobness but what’s Z^-1 in those schematics. looks like fun…

Apr 21, 2013 at 12:03am

Here’s a little key I had in my notes for the class:

x(n) = input

y(n) = output

(n) = “sample of the moment”

(n-1) = delay of one sample

z-1 = single sample delay (history operator)

z-n = some variable sample delay (delay operator)

z-m = “moving” delay (delay operator w/modulation of delay time)

triangle = multiply (*~ or * in Gen)

small ‘-’ sign = invert a value (subtract instead of add)

circle with “+” = addition operator

black dot = branching point

Apr 21, 2013 at 12:09am

@dtr: Z^-1 (z-1 in my notes above) is a single sample delay. Use the history operator.

@Andreas: The class was amazing! I ended my graduate coursework on a (physically modeled) high note for sure. The way that Gen allows you to just piece these kinds of diagrams together still floors me.

Apr 21, 2013 at 12:34am

great informations, thank you very much.

Apr 21, 2013 at 12:43am

That is pretty cool!

Somewhat related for gen code, has anyone come across a codebox matrix~ equivalent?

Apr 21, 2013 at 1:18am


Apr 21, 2013 at 1:35am

here is a faust code for a matrix, if it can help…

Fader(in) = db2linear(vslider(“Input %in”, -10, -96, 4, 0.1));
Mixer(N,out) = hgroup(“Output %out”, par(in, N, *(Fader(in)) ) :> _ );
Matrix(N,M) = tgroup (“Matrix %N x %M”, par(in, N, _) <: par(out, M, Mixer(N, out)));

process = Matrix(8, 8);

to make a matrix~ equivalent, we would need to dynamically change the inlet numbers of a codebox or a gen patcher, I’m afraid you have to make it by hand.

Apr 21, 2013 at 4:04pm

@stringtapper: who/where this course? Curious… :-)

Apr 21, 2013 at 4:29pm

University of North Texas
Composition faculty Jon Christopher Nelson was the instructor.
“Delay Based Signal Processing”

It was a one-off graduate seminar for the “Topics in Electroacoustic Music” course offered here once a year. We focused mainly on using Gen with a little Csound thrown in. We went from building simple filters to physical modeling.

Apr 21, 2013 at 5:53pm

Got… got any patches to share? even, like, scraps?

Apr 21, 2013 at 7:58pm

Here are two biquads, one for each form, built in Gen.

Direct Form I Biquad

– Pasted Max Patch, click to expand. –

Direct Form II Biquad

– Pasted Max Patch, click to expand. –
Apr 21, 2013 at 9:44pm

nice set of diagrams in that pdf! If anyone is interested here’s an all-pass interpolated delay line, for comb filters and waveguides


– Pasted Max Patch, click to expand. –
Apr 21, 2013 at 10:05pm

hi Oli,

your patch doesn’t seem to work…

Apr 22, 2013 at 6:50am

needs to be pasted inside a gen~ object

Apr 22, 2013 at 7:01am

ah yes, forgot how that worked, sorry :)

May 20, 2013 at 12:27am

Late to the party, but I found a lot of useful things on KVRAudio.

@Stringtapper: Dr. Nelson taught a cool one-off class on granular synthesis in sampling when I was there. (almost a decade ago…)

May 21, 2013 at 10:16am

Hi Peter, do you have any direct links? KVR is kind of a huge place, hehe

May 21, 2013 at 10:46am

I don’t have the links archived on my new machine, unfortunately.

The ones I found most interesting were the threads on anti-aliasing and envelopes. Envelopes are a hard thing to figure out, especially with extra features.

I also found those discussions helpful as a way of finding out the pros and cons of particular methods. I’d often start at MusicDSP then move over to KVR to see what had happened to that idea. Sorry, this is all really vague.

Is there something particular you’re looking for?

May 21, 2013 at 1:05pm

This is a good way to learn gen! I would love to see more implementations of these block diagrams.

May 21, 2013 at 2:54pm

Peter: I’m looking to start building some “analogue delay emulation” things, so it’s saturation, compression, delays and filters that are on my radar (preferably simpler than the big ladder examples ;) ), as well as weird osc/envelope things.

Basically, I’ve found out that I can actually learn gen~ by taking things apart. It really works for me.

May 21, 2013 at 3:05pm

Some things that might be useful:

For saturation: the distortion algorithms patch posted in the projects section a year or two ago.
For delays: are you thinking bucket brigade or tape? (I’m guessing tape) I have a non-pitchchanging algorithm if you’re interested. You might also consider using an allpass delay to progressively smear the phase.
For filters: you probably just need something pretty simple, like a one pole lowpass, if it’s inside the feedback loop.
For compression: rebuild the compressor example in gen~…

(I’d also add that a lot of these things can be done just in MSP, but if you want some weirder behavior, then gen~ obliges…)

Also, something I’ve found really helpful in aggressive feedback loops that works way better than clipping:


– Pasted Max Patch, click to expand. –


It’s a tanh approximation for x close to 0, but it asymptotically approaches 0 (instead of ±1) as x approaches infinity, which makes it a fantastic feedback killer/compressor.

May 21, 2013 at 3:43pm

You and other heroes like stkr really are making me smile about max every damn day.

May 21, 2013 at 11:06pm

Glad to be helpful; many others have done the same for me. Here’s a fun one with the faux-tanh shaper:

If you turn the output gain up slowly, you can use it with a live mic with no problems for controlled feedback. I use this with my classes to demonstrate how powerful feedback can be when you can properly control it. (it’s also a quick demo of what Max can do that normal effects don’t)


– Pasted Max Patch, click to expand. –



You must be logged in to reply to this topic.