SynthMaker

Envelope Stage (mono) - beta version.

Archive · 2005 9 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

whyterabbyt ·

This is my first attempt to build a new module for SM. Its been implemented for mono signals until I'm sure it works, at which point I'll probably convert it to a poly module.

The module is an envelope stage which stays at its low level while its trigger input is low, but changes to a given end level over N samples when its trigger input is high.

When it reaches its end level, it does two things; it outputs a high value on its own trigger output, and maintains its end level as long as its trigger input stays high.

This module can be easily daisy-chained for multi-stage envelopes, et.c.

The download contains an example .osm illustrating how two instances can be chained together to make a two-stage envelope....

Test it

feedback et.c. appreciated....

infuzion ·

Works as advertised, well save a bug that doesn't seem to be your fault.

BTW, this has been done as modules & primitve (do a search for counter), though it is interesting to see it as Code (& good for learning!). I wonder which is more CPU efficent?...

A few minor notes for the future: * Please keep the layout towards the upper-right as possible. I can go rather hi-res on my 21" monitor, though not everyone has that luxery (even me on my laptop) * Please keep it more organized/grouped together. Takes more time, but makes the layout much easier to read. * Give a trigger or any inputs to the user. In your example, I had no idea how to get it to work (start) untill I studdied it. My suggestion file below should work, but for some reason doesn't... but atleast it gives you an idea. Even clearly labeling the TrigIn Int would have helped.

my minor revision/suggestions

good luck; you're on your way on becomming a SM master coder! 🙂

whyterabbyt ·

infuzion quoth Works as advertised, well save a bug that doesn't seem to be your fault.

Actually, I realised (while I was asleep?) that it doesnt... it doesnt, quite, work properly; it wont generate falling values properly... I'll try and sort that out.

And yeah, I dont know why that recalculation is being triggered when you change any value.

BTW, this has been done as modules & primitve (do a search for counter), though it is interesting to see it as Code (& good for learning!). I wonder which is more CPU efficent?...

Didnt realise that it had already been done. I looked but didnt see anything. I actually started off trying to do it with 'normal' (non-code) modules, but wasnt getting anywhere...

A few minor notes for the future: * Please keep the layout towards the upper-right as possible. I can go rather hi-res on my 21" monitor, though not everyone has that luxery (even me on my laptop)

Do you mean upper-left? Yeah that makes sense.

* Please keep it more organized/grouped together. Takes more time, but makes the layout much easier to read.

Point taken.

* Give a trigger or any inputs to the user. In your example, I had no idea how to get it to work (start) untill I studdied it. My suggestion file below should work, but for some reason doesn't... but atleast it gives you an idea. Even clearly labeling the TrigIn Int would have helped.

Hmmm, I see there's actually a slight error in the Tooltip; maybe thats why you couldnt udnerstand it. It should have said that a high input on TrigIn (not 'Active') activated the envelope. It doesnt need to be an Int, though; In my example changing the float connected to TrigIn to a non-zero value works fine.

my minor revision/suggestions

Ta, a much cleaner layout. Although Im not sure how your trigger works; I still have to manually change a value to reset it, is that right?

good luck; you're on your way on becomming a SM master coder!

I wish. Trying to think around not having 'proper' conditional execution was doing my head in. And now Ive got to figure out how to make it count down as well without breaking it. Sigh. 🙂

whyterabbyt ·

Okay, Ive updated it now to handle downwards counting as well, and tidied up the layout considerably. The example still relies on my original method of manually changing the float input to trigIn to a non-zero value, but Ive now annotated all the visible floats, and added some 'String' boxes as comments.

I'd be interested in knowing how this does compare to a counter module, since the compensation for upwards/downwards counting adds some new overhead (ie extracting the sign of the overall change in level, then using it to calculate intermediate absolute values so certain comparisons work properly, then restoring the sign again)

Anyways, its tidier and clearer, hopefully, and now properly handles upwards and downwards envelope stages....

Updated version

Again, feedback is appreciated...

infuzion ·

whyterabbyt wrote: BTW, this has been done as modules & primitve (do a search for counter), though it is interesting to see it as Code (& good for learning!). I wonder which is more CPU efficent?...

Didnt realise that it had already been done. I looked but didnt see anything. I actually started off trying to do it with 'normal' (non-code) modules, but wasnt getting anywhere...

There's 2 "counter" in SM's toolbox now, but Jorge made some modules before (search is our friend 😉 ) I made an impoved version of his with floats & error-proofing, which should end up in skOre's collection sometime soon.

my minor revision/suggestions ...Although Im not sure how your trigger works; I still have to manually change a value to reset it, is that right?

The red round-square sends a trigger... you can see the Int flip, but for some buggy reason it does nothing.

whyterabbyt ·

Hmmm, looking at that thread, I guess the difference between 'counters' and my envelope stage is that the counter relies on pulses to send out an incrementing-1-per-tick Integer over a specific number of pulses. I'd assume those pulses neednt be provided at a consistent clock-rate.

Mine is incrementing a Float between a start and end level, at sample rate, over a specific number of samples, with a cumulative output across multiple stages when they're daisy-chained.

I guess the counter module could be turned into a similar envelope stage with some more logic (ie calculate the increment per counter step, sum outputs across multiple stages et.c.) but I think mine's a bit more all-in-one for its intended purpose; flexible N-stage modulators (ie envelopes and complex LFO's).

BTW Do you know where the WTimer that jorge's counter uses actually is? I cant find it in the Toolbox...

malc ·

WTimer got renamed to Ticker 25 (sorry 🙂)

infuzion ·

v3 is a good example of making good examples! Now anyone can see at a glance what's going on. whyterabbyt wrote: Okay, Ive updated it now to handle downwards counting as well

All you need to do is restart the count (provide looping) & you have yourself an OSC!

whyterabbyt ·

Hmmmm, I need a slight rethink to get a chain of modules to self-retrigger, but I think I can probably manage it. I think actually I need to split things up into a couple of code modules for it to work properly, because I need to keep track of more than one 'state'. Lemme work on it.

Working on copying the Nord G2's 'rectifier' module first...

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.