Forums > Gen

good sources for gen dsp code online?

April 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?

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

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

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

April 20, 2013 | 11:40 pm

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

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

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

April 21, 2013 | 12:34 am

great informations, thank you very much.

April 21, 2013 | 12:43 am

That is pretty cool!

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

April 21, 2013 | 1:18 am


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

April 21, 2013 | 4:04 pm

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

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

April 21, 2013 | 5:53 pm

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

April 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. —
April 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. —
April 21, 2013 | 10:05 pm

hi Oli,

your patch doesn’t seem to work…

April 22, 2013 | 6:50 am

needs to be pasted inside a gen~ object

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


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

Forums > Gen