Gen~ Envelope creation/usage

Hi there, newbie here to Gen~, Daisy, and Oopsy :slight_smile: I used to play with Max before and using buffers for envelope creation and usage, I’m hitting the wall now without being able to use buffers :smiley: I’m a bit lost on documentation, a simple test/learning that I would like to achieve would be a simple gen~ patch playing any sound and amplitude being modulated by a given envelope which is activated by some trigger, all inside gen~.

Again, sorry if it’s a super newbie question, but finding it hard for me to find some examples and documentation on this specifically, if anyone can point me to some good docs that would also be great.

Maybe it’s more of a Max Gen~ question than a Daisy one?

Just got my Daisy Patch for my Eurorack system, love the possibilites!
Thanks in advance!

You can use the [data] object in place of [buffer] for just about any task.
The only current way, in my understanding, to fill a [data] is by using the dev fork version to load a .wav file into it, as if for sample playback.
There are also zany calculations you can do with multiple [counter] objects to give you ADSR times which is a good deal more processor intensive but there’s plenty of cycles to handle it.
Switch to the dev branch and look at the sample playback example.
You could “easily” load a custom envelope into a [data] disguised as a wav and use [sample] to interpret position/value

I do a lot of data initialization for fixed envelope shapes using a little codebox. E.g. if you have [data foo 1024] then in a codebox:

// makes sure this only happens when the patcher loads:
if (elapsed == 0) {
   // for each sample frame of the [data] object
   for (i=0; i<dim(foo); i+=1) {
     p = i/dim; // phase of envelope from 0 to 1
     // insert your envelope algorithm here
     // e.g. a half-sine:
     v = sin(pi * p);
     // write the value `v` into data `foo` at position `i` and channel `0`
     poke(foo, v, i, 0);

If you are worried about performance, bear in mind that this only runs when the patcher first loads, and will produce much smaller code than anything loading a WAV file. :slight_smile:

1 Like

Max msp does a good job of hiding it’s examples for gen. Go to “help → examples → gen”

Usually help just has text manuals so for me it wasn’t the intuitive place to look. Theres a lot there/

Just FYI, .wav file loading is out of dev version. Its in normal now.

1 Like

Also in Max you can search using Max’s “File Browser” window.

Yes there’s a lot of gen~ examples – I’ve been adding more and more every year :slight_smile:

1 Like