Forums > MaxMSP

What are my options for curved envelopes

Nov 07 2011 | 9:38 pm


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?

Nov 07 2011 | 10:04 pm

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

Nov 07 2011 | 10:12 pm

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!


Nov 07 2011 | 10:48 pm

thanks for your replies, I shall investigate…

Nov 07 2011 | 11:14 pm

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. --

Nov 08 2011 | 8:43 am


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


Nov 08 2011 | 9:52 am

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~].

Nov 09 2011 | 8:20 am

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:


  1. adsr.png


Nov 09 2011 | 10:30 am

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)

Nov 09 2011 | 11:29 am

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

Nov 10 2011 | 12:35 am

starting points:

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

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

Nov 10 2011 | 4:39 am

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. :)

Nov 10 2011 | 8:30 am


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. --

Nov 10 2011 | 5:39 pm

in case you don’t already have enough options, you should also check out the new jit.path object, which allows you define a series of points and will automatically calculate a spline path through those points.
you can also edit and visualize the path with the corresponding object.

the help file should be enough to get you started.
let me know if you have any questions.

Feb 05 2012 | 3:17 pm

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. --

Feb 05 2012 | 5:37 pm


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:

Hope that helps,

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

Forums > MaxMSP