Forums > Gen

good sources for gen dsp code online?

Apr 20 2013 | 3:28 pm

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 | 5:54 pm

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 | 6:23 pm

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 | 11:04 pm

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 | 11:40 pm

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

Apr 21 2013 | 12:03 am

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 | 12:09 am

@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 | 12:34 am

great informations, thank you very much.

Apr 21 2013 | 12:43 am

That is pretty cool!

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

Apr 21 2013 | 1:18 am


Apr 21 2013 | 1:35 am

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 | 4:04 pm

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

Apr 21 2013 | 4:29 pm

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 | 5:53 pm

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

Apr 21 2013 | 7:58 pm

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 | 9:44 pm

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 | 10:05 pm

hi Oli,

your patch doesn’t seem to work…

Apr 22 2013 | 6:50 am

needs to be pasted inside a gen~ object

Apr 22 2013 | 7:01 am

ah yes, forgot how that worked, sorry :)

May 20 2013 | 12:27 am

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 | 10:16 am

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

May 21 2013 | 10:46 am

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 | 1:05 pm

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

May 21 2013 | 2:54 pm

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 | 3:05 pm

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 | 3:43 pm

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

May 21 2013 | 11:06 pm

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. --


Apr 02 2016 | 11:31 pm


Task One – if you’re brave enough to take it.

1) implement the First filter in the attached PDF and create a gen~ version. Annotate with comments to make the process clear.

2) the source document:…/ClassBlockDiagrams.pdf" Block Diagrams

3) extra notes from max/msp forum user stringtapper (source of document):

April 21, 2013 | 12:03 am

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
note: Z^-1 (z-1 in my notes above) is a single sample delay. Use the history

Full thread at:

screenshots ok, but please use code to Submit final ideas and work in progress.

all videos welcome, TY, Vimeo, whatever.

this is not a one on one, collaborations are encouraged. As are discussions when people get stuck. This is the point, to encourage discussion and learning. Anyone want to do a tutorial, feel welcome, especially from established YTbrrs Max etc.
got an idea, upload your code, see what feedback you get, perhaps join a crew!

there are no winners except those who complete the challenge successfully in one way or another. A post will be made for these discussions. Bon chance meine leibling patchers.

Please make use of the discussions there to ispire and collaborate! :-)

Apr 16 2016 | 10:58 am

Was working on other projects a while, thinking of doing some more gen~ work. A small gathering of patches here:


Hope you enjoy my mild site redesign.

Apr 16 2016 | 11:35 am

your url begins with "localhost" !…

Apr 17 2016 | 7:11 am

I’m so sorry, I copied if from my dev server by mistake. Maybe I am too old to do any more work in gen~, I make alot of silly mistakes like that these days. Here is the correct url:

I had to remove my Mac build of Godel from my server, as it was >64MB. Has Cycling74 done anything to improve the size of standalones yet? I have been waiting since Max 6, if it hasnt maybe I should file a request.

May 08 2016 | 6:27 pm

Hi Boys and Girls,

Trying to complete Task Three on the Facebook Gen~ group:

Where the triangles are *~ in gen so all the a’s are just multiplication coefficients, what does the "-" on the b coefficients imply? That they should be multiplying below 0 (i.e. division)? or does the "-" mean subtract? If "-" means subtract, why would it be on a triangle (which is multiplication)?


May 08 2016 | 6:39 pm

Hi Boys and Girls,

Got it I think coefficients b must always be below 1 for stability. I hope. Please correct me if I am wrong.

Thanks people,


May 08 2016 | 7:36 pm

Triangle = multiply (I’m guessing this is historically related to the use of op-amps). The negative sign indicates inversion.

The coefficients don’t necessarily have to be less than one–that depends on the design of the filter. In a onepole, yes, but not in some biquad implementations. (the so-called "triangle of stability") For example in the highpass coefficients on the page below, there are some coefficients that could individually exceed +/-1.

May 08 2016 | 8:39 pm

Hi Peter,

When you say inversion you mean phase right (180° kinda)? Would this need specifically implementing with [-] operators or just as a result of the multiplication being below 0?

I get nothing out of the patch. Zip. It may just be settings of the coefficients, don’t know.

I’ve tried to paste the patch as text but I can’t seem to get it to work. Where I’m at so far is attached if you have time to have a look and tell me the obvious errors I’ve made.

Thanks. :-)

Viewing 35 posts - 1 through 35 (of 35 total)

Forums > Gen