Exponential envelopes

Potentially quite basic question here, but I can’t find my answer in the SC documentation.

I want to create a simple attack/decay envelope going from 1 to 0 to 1. My aim is the have the lines of the envelope go from being completely linear to a very steep exponential curve (a bit like the letter U). I’ve not yet found a way to achieve this.

Any guidance gratefully received!

Not at the computer right now… But I think …

   [1, 0, 1],
   4 * [-1, 1]

edit: changed sign - @semiquaver

Signs backwards but @jordan otherwise right!

   [1, 0, 1],
   4 * [-1, 1]

note its not a exponential curve as exponential curves can’t reach 0 but…

That’s precisely it! Thank you Jordan, thank you semiquaver, that was exactly what I was looking for!

Impressed with getting the code almost exactly right without the aide of the program :slight_smile:

One way to get close to exponential between 1 and 0 is using tiny offsets:

   [1.00001, 0.00001, 1.00001],
	offset: -0.00001

A trick I learned to make from that excellent 808 implementation made during lockdown is to make a longer curve than you need with a sharper slope:

Env.perc(0.01, 5, 1, -40).plot

to get that really snappy percussive curve.

Turning into a U is a bit of a nightmare:

Env(Env.perc(0.01, 4, 1, -80).asSignal.copyRange(0,99).dup.collect{|sig, i| if(i.odd){sig=sig.reverse}; sig}.flatten, 1/200!200).plot

but you get a great sounding curve. Maybe there is a better way to transform the original into a U.

OT - I forgot the .flatten when I was making that and got this (not useful…but it looks good):

Env(Env.perc(0.01, 4, 1, -80).asSignal.copyRange(0,99).dup.collect{|sig, i| if(i.odd){sig=sig.reverse}; sig}, 1/200!200).plot


1 Like

Thanks TXMod and Sam, very interesting additional approaches. As often seems to be the case on this forum, a relatively simple question leads to all sorts of interesting things I would never else have thought of!

If anyone has a moment I’d be interested to know more about the “808 implementation” in lockdown. A little ‘before my time’ in terms of SC! :slight_smile:

sc808 i guess.

really solid work on the sound design in there

Ah yes, very nice. Thanks for sharing. Will take a deeper look.

Love the look of the last one! Maybe discretize is cleaner?

z = Env.perc(0.01, 5, 1, -40).discretize;
Env(z ++ z.copy.reverse).plot