Envelopes for use in mono streams

DSP related issues, mathematics, processing and techniques
Post Reply
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Envelopes for use in mono streams

Post by Drnkhobo »

Im trying to get the stock ADSR module modulating a simple mono stream.

I read up on posts in the SM forums but some of the files have been removed. . .

It seems whenever I connect a stream to the GATE input on the ADSR, it resets the env.
I have tried to use a multiplexer to switch it on/off but to no avail!

Checking the "Gate" tickbox in properties registers the env void. . ?

My premise is to have a user selectable threshold in which the envelope will trigger once input is above.
How can I use the trigger from the thresh to reset the envelope???

Thanks!! :lol:
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Envelopes for use in mono streams

Post by trogluddite »

Hi There,
This is something that has caught out many people in the past - me included!

Ticking the 'gate' prpperty - yes, that is right - mono streams never have the 'auto-gate' thing that you can have with poly streams.
The tricky bit is that the gate input uses a 'Stream Bool' input - and booleans in streams are a bit wierd!...

In green it's easy: False = 0 and True = 1 - well, in fact, if you try putting a float value in, you'll find that any value other than zero is true in green.
For a stream bool, false is also zero, but true is represented by a load of binary bits that don't even make a real number - it's a special value all to itself that only a true stream bool output is able to provide.

To demonstrate, here's a quick schematic that uses the genuine stream boolean from a stream compare....
Mono Envelope.fsm
(137.03 KiB) Downloaded 1651 times

When you send any other value than zero or the "special true value", what you get is very unpredictable.

If you have ever used the DSP code box, you might actually have seen this before without realising it. e.g.

Code: Select all

x = x & (y > 0)

The (y > 0) comparison here also produces the same zero/"special true" values - and it is a bitmask where every bit in the value is off, or every bit is on (true) - the '&' then uses this to either let the value of x pass through, or 'mask it out' to zero.
And you can access these tru/false values directly from a code box too - here's the same 'greater than' from the example, but written as DSP code...

Code: Select all

streamin x;
streamin y;
streamboolout out;   //true/false boolean output

out = (x > y);

There's also a 'streamboolin' in code, so you can pass booleans around between code blocks, envelopes etc. just like regular streams - you just can't 'mix and match' with normal values like you can in 'green'.
One very useful little code is this little one...

Code: Select all

streamin in;
streamboolout out;

out = (in != 0);

This takes any old number as an input, and output false if it is zero, true for any other value - so it makes a 'green bool' to 'stream bool' convertor. Useful for gating the ADSR from a regular green on/off signal.

ARRGH EDIT EDIT EDIT - too much Ruby,, you wouldn't believe how many times I just had to edit those code examples before I got them right - I've nearly forgotten DSP code!!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Envelopes for use in mono streams

Post by Drnkhobo »

Nice one Trog! :D

You really know your stuff! You were right, its the "stream bool" I have never used before!
Thanks a million for your help!

You seem quite involved with Ruby, maybe you two need a break??? :lol:
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Envelopes for use in mono streams

Post by trogluddite »

You're welcome. :D
Maybe DSPr should set up an addicts helpline! ;)
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Envelopes for use in mono streams

Post by Drnkhobo »

So thanks to Trog, the triggering of envelopes are easy!

Now the next part is some better stock ENV modules. . . .
Dont get me wrong the FS ones are ok but I noticed that attack times of 1-10ms are VERY buggy!
(As well as other "short" times/settings)

I tried the Multi-stage ENV which works GREAT but I want ADSR "knobs" instead of a graph GUI. . .

Looked inside & have NO IDEA on how to control the MS ENV via knobs. This calls for a super advanced FS user . .
not slipping any names here Trog ;)

LOL
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Envelopes for use in mono streams

Post by Drnkhobo »

Anyone have any stock envelope modules that sound ok?

I have tried some & the standard ones don't sound good at all!

The best ones i have heard are the multi stages FS ones but I dont want a draw-able env. Just good ol regular knobs :lol:
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Envelopes for use in mono streams

Post by nix »

You could ask infuzion if u can license his ASM one?
He built it for me years ago as paid work.
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Envelopes for use in mono streams

Post by Drnkhobo »

Thanks Nix, will ask him :lol:
Post Reply