Forums > Gen

Gen: Slope Detector


Jun 22 2016 | 3:05 am

Hello!

i’m trying to make something like the Serge slope detector for a project (http://www.cgs.synth.net/modules/cgs62_sd.html) and have gotten caught up on the implementation of the sensitivity parameter. This should "allow the slope detector to work with either relatively fast events, like the edges of a square wave pulse train, or very slow events, such as the sine output of an LFO being used to drive filter/phaser sweep", which to me souds like a downsampling of the input signal which could be done with a sample and hold. However, i can’t get delta to respond to sah very well in the gen domain. Anyone have an idea of how to go about this? Here’s the patch at the moment


-- Pasted Max Patch, click to expand. --

Cheers, Camilo.

Jun 22 2016 | 7:03 pm

The slope detector works using a capacitor which charges and discharges.
I think you could emulate its behavior using something like rampsmooth~, the ramp inputs corresponding to the sensitivity knob.

Here’s my version written in a codebox in gen~, it’s stripped down version of my try on emulating the serge slope generator.
It seems the sensitivity has to carefully be tuned to the input… in other words, it doesn’t work very well…

— Pasted Max Patch, click to expand. —
Jun 22 2016 | 7:18 pm

separating the rising and falling parameters allows to generate some nice rhythmic pulse. the good thing is it is always rhythmically related to the input.

— Pasted Max Patch, click to expand. —
Jun 23 2016 | 2:30 am

cheers, Bertrandfraysse! I’m really impressed by the musicality of the example with individual rise and fall slew. Rhythms galore! I’m pretty new to gen, so i can’t quite make out what is going on in the codebox, but will be looking into it. Is the algorithm based on Ken Stone’s op amp implementation?

Jun 23 2016 | 4:43 am

nice to hear that you like it.
it’s not an analog imitation, but an algorithmic imitation of the serge slope generator.

here is a patch using the slope generator as a triggered envelope generator.

— Pasted Max Patch, click to expand. —
Jun 23 2016 | 4:54 am

another version with two generators

— Pasted Max Patch, click to expand. —
Jun 23 2016 | 7:19 am

I think this one is better as a slope detector.
The previous one were especially made to be triggered and of constant amplitude.

You can use the following one as the smoothed section of the serge smooth/stepped generator.

— Pasted Max Patch, click to expand. —
Jun 25 2016 | 9:12 am

Thanks again for these examples, Bertrandfraysse. Would you mind commenting on what each section is doing in the patch or describing the algorithm? I would have thought all one needs is a simple lowpass filter and a derivative, but i’m very curious about your implementation.

Jun 26 2016 | 1:51 pm

Yes, you are right a lowpass filter and a derivative will do what you want.
Actually, this slope generator is kind of a lowpass filter.

The last patch is the simpler, It’s really like rampsmooth~
The second input, named rate is the increment to add or remove from the current output value (output).
If the input > output, it adds the increment to the current output, and tells it’s rising.
If the input < output, it removes the increment to the current value, and tells it’s falling.
That’s it.

I hope it helps.

Jun 27 2016 | 10:30 am

Thanks again! while i also believe(d) that the idea with slew + derivative should work, i’m finding the response a bit limited (patch is at the end). As for the gen code (first example : slew for rise and fall separate), i did want to ask: what is the basic principle of using the History type throughout? is it a buffer that can be rewritten only when conditions are met or is it always the previous sample/ condition which is getting compared to the current?


-- Pasted Max Patch, click to expand. --

Jun 27 2016 | 2:07 pm

History can be used for two things, the first and most common one is to allow feedback.

yes, it isa buffer that can be rewritten only when conditions are met. The if statements use independent values than the outside of the if, so history is a buffer allowing to store the value even if the condition is not met anymore. It’s kind of a sample and hold.

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

Forums > Gen