## Signal controlled ADSR~

Jul 29 2014 | 9:41 am
I need to control an ADSR~ with a signal. Basically I have a Groove~ playing a short sample of a Buffer~ inside a Poly~, I would like the ADSR~ to turn the Poly~ off when the sample has finished playing, the tricky thing is that I wish to implement a tape delay style repeat for the sample and want the ADSR~ to turn off when the whole sound (sample + tape delay decay) has completed. I've tried using a
Any ideas good people?

• Jul 29 2014 | 3:01 pm
do you need to modulate the envelope while playing? if not, i would use a buffer~ as envelope.
• Jul 29 2014 | 3:10 pm
Hey Roman, Thanks for your reply. The envelope does not need to modulate while playing but does need to be defined before the sound is played, each envelope would be a different size too so I'm not sure this would work, I'm using the Groove~ to play a snippet of sound (say 200ms) with a decaying tape delay to it, so if the tape delay repeats 5 times then the envelope would need to be 1000ms, I suppose I could do some maths to work out the length it would need to be but I'd just like to control the ADSR~ with the signal of the decaying sound somehow if this makes sense
• Jul 31 2014 | 2:31 pm
It sounds like your sample is a one-shot (plus effects). Assuming this is so, I would recommend messing with the maxsustain parameter for ADSR~. Normally, ADSR has an attack (triggered by non-zero) and a release (triggered by 0). If you set the max sustain time, you can treat the envelope as a oneshot and set the max sustain time accordingly.
If you convert your decay delay into decibels, you can measure the RT60. (how long it takes for the sound to decay 60 decibels) Since you know the delay loop time and how much it drops, you can figure out how long it will take for the tail to decay by 60 dB (or any other arbitrary amount). That gets added onto your envelope's sustain or release time.
target_decay_in_db / loop_decay_in_db = number_of_repeats number_of_repeats * loop_time = sustain_time (RT60)
• Aug 01 2014 | 9:46 am
Hey Peter, thanks for taking the time to reply, My sound is a one-shot thing but will be repeated a lot inside a Poly~. I think I've realised that I'm gonna have to do the maths on this one to make it viable, could you embellish a little on your equation to get the RT-60 value as this is exactly what I need; what do you mean exactly by the target decay and the loop decay? Could you provide a simple patch? Thanks again dude, really appreciate the help. :)
• Aug 01 2014 | 9:51 am
...by the way I'm using Tapin~ and Tapout~ for my tape delay so the values I use for the calculation will be the Tapout~ argument and the value of *~ which comes out of Tapout~ and back into Tapin~. Hope this helps?! :)
...also I believe this is the equation I need to solve: y(t) = a × ekt
Where y(t) = value at time "t" a = value at the start k = rate of growth (when >0) or decay (when t = time
I'm not entirely sure how to implement this into Max though?
• Aug 03 2014 | 5:26 am
It's essentially an exponential decay but when you express it in terms of logarithms (e.g. decibels), then it really just becomes a multiplication. Here's an example of how to calculate it. Note that the time estimate is approximate because there are opportunities for constructive and destructive interference in the feedback loop.
The usefulness of the RT measure depends on the context. RT60 is a reasonable measurement on its own, but in a more busy mix, you might be interested in how long it takes a sound to decay by some other amount, say 30 dB.
If I want it to decay by 30 dB and it gets softer by -3 dB each time through the loop, it's going to take 10 loops to decay 30 dB. If my delay time is 75 ms, then it's going to take 750 ms for the sound to decay by 30 dB. (75 ms * 10 loops)
HTH, PM
• Aug 03 2014 | 3:44 pm
That's exactly what I need thanks Peter, I had pseudo-fixed it by having a *~ object send its sum back into itself and getting an if/then object to bang when the number was lower than 0.01 but it was always a quick fix, this is precise and will give me exactly what I need to finish off my Poly~ Thanks for taking the time mate. :)