signal to gate or envelope
I have had a nosey around the forum and also through the Max examples, trying to find some pointers on envelope following. If there’s one lurking in the Max folder and I missed it – sorry!
I recall PM answering a similar or related topic here, but cannot find it either, despite searching, so again, apologies for not finding a pre-existent solution, as I know this type of question has appeared numerous times before.
I am trying to generate a simple attack-sustain-release envelope from signal input, that is, a monophonic guitar line, such that I can impose a variable envelope on each new note. You may have seen this on the MFOS youtube channel. I’ve had a stab at it myself, based on the Max simple-compressor example and it’s almost working, but it occasionally misses the onset of new notes very close to the end of a previous one; perhaps you can have a look and suggest a better way:
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1181.3oc2YtzqhaCEGeMiz7cvJcQkpXnw4EPG0WKmMcQqT2zoZjI4.3aSrib LvkYzb+rW+fvqKDLbGx.ylDgic7w+N+OG6S3Su9Uc7FweDp7P+D5ePc57IUK cLsoaoScCc7JHOllSpLczKkWT.LoW2UOTBOJMOnhW.xoT1DTAmwKmxYzTTo. FCBxn7kqGPNkAo7YLynBpasjHS0C9CBHUZsnfjnd9cQwCzWwwI5agpqn+sdP iESFo6qu5QqZhlYLF9nGdCFGrdRYyJnrbPZVC30imyjUzOBlFC17RT8lOSV2 c+s6NiTX5t2eChLBi3Yd1me8qz2U259xA4hoDI5ceeAhPKz3bLWfnUHBCQxd XVkTQS.86+0eh.1bHmWBnESooS08Q.RAcxDP.YnQKQxo.hyp.IhOFADUeXvB DiKg2hTuTXNvP52HhnFYN07hGQVMk6ze6qoqxHxPuCkprkQyn4YnhkH9B1FK YrfWnmVAz6vN7AM3vShh093nj98hUd7AFONNH7bb436RW9u9yn26QjRR5+8i JOAPpf2640.p5GqA.JHLxFbX+E9LHke+6WRImJfpo77LmfDNd3ECojaYHolj QfvEYRrIv5P.XmUazIVskDgx3kf3C.SmrXm0lZ.zhYElr5qazBA4xRvZPdTs SE4oyx3skavILtdyBEE1LUWI3NNmqlcWjWC7cBtAegf6VR0mQWkQS9xxW+dC uN7sJUsewSMw2ng1sCBM2vg9qusYgkRxSWu2RXvAAu+gAevQhUu7vQXgZBed JqRUVczXk.owEahYUFZ2BLIoQwzvjSrjdlv3r0B3qTJqivH8YDdxE9z2pIBZ lOwmKepnSXj7WdjS6PKUZBAWk5C8ajTIcNfvMgtXajSPe+shiNN6vmK6tHh0 x5Kx7INIuvNIu7OQp7ijW9FmQ+xSpr8N.oUBonlyQM3RiAuwozO3hNJHxfnv .cgLGGQgeqhHTfCPBuZ+8lyGMv+9FRGsRlbNuTUV8a3iG2DrRrojr66cA0vz O5ltDlKKJKvdjaaYMmHJKp+8s.RxmLQUMPSavOXKIhEMA9GgFAgujxPNX4ba lm83wUr1fUUzFD7xpM.2RkFT.UUjIvy04MdvsnAC50W+kv72RmiGdrSkbuVS .7wLRpKw6I91CdDWe8fbneK4SOcbYs+aiA2fYGeGDWdTYrJbk4fCr+Va3eTc b32Z01VMtLmrzEA9p.83lOYM9lp315GVQlWOee2enmq0KakGRszzeIe+gIpE lusEu2prj8fs0zLeMf8+aoLTS+f8bAU7Yhz5Yt9T0nsHWFTIoLhjxYa2q3c6 0TZVFv1InJiVoCzxNQZB2MrXWLLcwksrgY91jNhLb6hLemLrvaYCqk8kNYWe MzXQNo9SZcW4PmBKMeF4VlYtYY55aZajk3jur8SwNz2YQVKaX3a0b+NKwZW6 Z+o7vFV6K8c2tZWdE3zodF157xI8EF29AjtXWweUBGwt3EaWyxIwU66Diu9l 0pJRHkkyAQ0p2r0hTU+8.Wn+cRW6uoL6usEX5If4z5gXKhxiHTk9IU08MSXK i5wjHcEmlITc4+cmQKy. -----------end_max5_patcher-----------
I found an envelope follower abstraction lurking in the m4l-patches folder; it seems to centre on the use of [slide~]. I’ll see if I can get this working better than my attempt. Next stage in my "digital subcommander" is a frequency-divider, for a big fat sub-octave and some RM/FM and LFOs.
Wow! Had a poke around the wiki too:
"does exactly what it says on the tin"
I like this one:
Average~ 100 rms
Slide~ 80-200 2000-4000
With gain, conversion to db as needed.
Works great on percussive attacks.
Peter, thank you. I did fall foul of the difference in behaviours between [avg~] and [average~]. But [slide~] is pretty much the solution to this question. The [omx.peaklim~] advanced help tab is also invaluable. Tinkering with the slide values is where the craft lies!
(if there is any further interest, I’m cooking up a funky recreation of Ray Wilson’s MFOS subcommander in Max . . . )
Totally, and please consider contributing it to BEAP! There’s a style guide in the misc > Development folder.
BTW, regarding slide: the ms values are not how long it takes you to get there! (even though that’s what the documentation says)
Slide~ is a really efficient object, but the timing is a little trickier. It approaches the value in an asymptotic fashion. Chamberlin published a rule of thumb for it several decades ago; it’s more practical in envelopes where you have a target, but it’s basically: overshoot by 5% (not advisable here), and divide your time value by 3. (it gets something like 61% of the way to the destination in a given time interval)
(You can see this in my AnalogKick device)
So, I spent an afternoon or two applying new objects, skills etc and have a pre-alpha to share; it’s a short demo of a Max patch for envelope following, auto-filtering and pitch shifting, in the style of the MFOS subcommander guitar synth. I’m placing it here because it’s not a strictly share-ready or project page viable system yet.
add a VCA-like module;
fix sub/super octave settings;
add a live audio input module.
Feel free to share, like, twoot or whatever it is you kids do on the interweb these days.
>n00b_meister; re-inventing wheels whenever unnecessary<
if anyone wishes to see/hear stage 2 of this little project, I have added 2 further modules: a "freeze frame" section and a "drawbar" section. These allow the user to capture and freeze live input, and to blend in 8ves, 4ths and 5ths from the original source; in conjunction with the existing auto-wah and re-pitch modules, one can generate quite rich or dense textures from monophonic input. There are no show-stopping algorithms here, this has merely been a weekend project. And my GUI design is a yawn-fest :( Any tips?
I don’t want to clog up the forum with video again, so you can find it on youtube under "mfos homage" or "brendan mccloskey" if curious.
Forums > MaxMSP