## What are my options for curved envelopes

Nov 7, 2011 at 9:38pm

# What are my options for curved envelopes

Hi,

I am looking for an adsr~ but with a curved logarithmic response. Is there a way to do this with out resorting to externals? I have been trying to cobble something together with curve~ but my lack of Max-fu is seriously letting me down, any masters care to lend a hand?

#59870
Nov 7, 2011 at 10:04pm

use buffers for each of the segments, then you can do the math totally in max.

#215512
Nov 7, 2011 at 10:12pm

Hi withakay
oooh curved envelopes, hours of endless fun. I’m certainly no master of Max-fu (maybe white belt). If you want a dynamically variable envelope, then the [curve~] object is cool. There are several variants on the hanning window approach – filling a buffer with samples to generate a curved window, and you can even roll your own. I’ve attached a patch demonstrating these three approaches, with citations too natch.

– Pasted Max Patch, click to expand. –

No doubt there are numerous other methods, but option anxiety is the killer!

Brendan

#215513
Nov 7, 2011 at 10:48pm

thanks for your replies, I shall investigate…

#215514
Nov 7, 2011 at 11:14pm

Here’s a way to use [function] with [curve~] to set different curves for breakpoint transition, hopefully you’ll find it useful!

– Pasted Max Patch, click to expand. –
#215515
Nov 8, 2011 at 8:43am

@Luke

I think this is the closest to I want a want – or at least what I *think* I want ;)

Thanks

#215516
Nov 8, 2011 at 9:52am

hi withakay. problem is none of the examples above are signal rate. just stick a [pow~] after the [adsr~] and use the the [adsr~] data to shift between <1. and >1. values. although if all you want is a steep exp slope to segments, [*~] the [adsr~] output with itself. in Max6 you will want to look at the rather fantastic [gen~] example “gen~.7_segment_envelope.maxpat”. if signal rate does not matter, all the above are excellent examples. my fave for gui interface is to write the curve of [ej.function] to a [buffer~] and read through it with [index~] or whatever, or just a simple message to [curve~]. it is possible to build a very intricate adsr-like schedular driven system for use in midi-triggered poly~s etc with just [curve~].

#215517
Nov 9, 2011 at 8:20am

Hi pid,

I tried using [pow~] but tbh I don’t really get what you mean. I had considered [*~] the output of [adsr~] but that creates the oposite curve for the attack portion to one I want (exponential rather than logarithmic?).

To be clear, I am trying to achieve something like this:

[attachment=175739,2861]

###### Attachments:
#215518
Nov 9, 2011 at 10:30am

well you must use the distortion funcction always on the given range, for example for the range
between volume of hold and volume of release (1.1 to 0.0)

#215519
Nov 9, 2011 at 11:29am

it looks like Toshiro Yamada’s sa.function might be useful.

http://cycling74.com/toolbox/sa-function/

#215520
Nov 10, 2011 at 12:35am

starting points:

– Pasted Max Patch, click to expand. –

but you should really get gen~ – supersimple and awesome in gen~…

#215521
Nov 10, 2011 at 4:39am

also check out the techno~ helpfile. pretty sweet coupled with the ‘technoui.js’ interface in that helpfile(though it may be overkill, you might as well take a look at every option).

+1 on gen~, too. :)

#215522
Nov 10, 2011 at 8:30am

@pid

wow, very comprehensive! I actually discovered [change~] whilst I was trying to make a frequency divider and realised I could use that to simulate a signal rate ‘bang’ when the envelope move to a new stage I wasn’t sure about how to do it, but you have an example in your pow-by-sections!

I am a little baffled by the sqrt example (I know it is a bad example anyway but), I don’t see where you are getting a root from. Oh, I suppose selector input 1 is the root of input 2?

Anyway, I really appreciate the input (from everyone!) I have a lot to grok

just for laughs I present the naive solution I came up with before seeing the latest responses

– Pasted Max Patch, click to expand. –
#215523
Feb 5, 2012 at 3:17pm

here is one solution with curve~. you can easily modify the attack, decay and release slopes. they can be either logarithmic or exponential, so it is no problem to generate an envelope from your picture. and it also has a sustain mode:)

– Pasted Max Patch, click to expand. –
#215525
Feb 5, 2012 at 5:37pm

Hi,

I made an external some time ago called [sadam.envelopeGenerator] to create curved functions automatically for the [function] object, which can be connected to [line~] then. You have to enter your function in [expr]-style and then the external will update your [function] accordingly. You can access it as part of the sadam library here: http://www.sadam.hu/software

Hope that helps,
Ádám

#215526

You must be logged in to reply to this topic.