Forums > MaxMSP

adsr~ questions including example patch

March 12, 2008 | 1:51 pm

Hi again.

I’m having a coupe of amplitude change issues with the adsr~ unit now, i.e. the familiar clicking noises.

Firstly, when holding down a note and adjusting the sustain level in [adsr~] there are a sereis of distorted clicks as the amplitude changes. I know why this is happening, but I can’t figure out a way to smooth the changes. Everything I’ve tried ([poly~, rampsmooth~, line etc)results in a signal that [adsr~] can’t understand.

Secondly there is another audible click (more of a thump in this instance) when I start a second envelope. As an example (and remember it’s a monosynth!) when I play a note with an amplitude envelope with a long attack, and I press another note interrupting this first envelope the new note thumps loudly first before followiong the envelope set by [adsr~]. Again, I’ve tried everything I can think of to combat this but to no avail.

I’ve included a sine wave monosynth patch which I’ve been using to try and understand adsr~ – It requires Darwin Grosse’s ddg.mono external object.

Hopefully someone has some ideas!

Thanks in advance
Mike

max v2;
#N vpatcher 216 67 909 496;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 60 235 27 196617 *~;
#P newex 309 120 41 196617 * 0.01;
#P flonum 309 148 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user dial 308 77 40 40 101 1 0 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P user dial 191 77 40 40 101 10 1 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P flonum 366 148 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user dial 366 77 40 40 101 10 0 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P flonum 249 148 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user dial 249 77 40 40 101 10 0 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P flonum 191 148 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 166 198 117 196617 adsr~ 10. 100. 0.5 100;
#P user gain~ 108 316 38 42 158 0 1.071519 7.94321 10.;
#P newex 60 199 61 196617 cycle~ 440;
#P user ezdac~ 60 347 104 380 0;
#P newex 60 154 31 196617 mtof;
#P newex 60 51 51 196617 notein a 1;
#P newex 60 84 51 196617 ddg.mono;
#P window linecount 18;
#P comment 424 60 173 196617 These are the problems I’m having… If you hold down a note and move the sustain knob there are audible clicks due to instant amplitude changes. Is there any way of sorting this? Also , if you set attack up high and then move from one note to another try moving a couple of octaves) you will hear the new note thump loudly before following the envelope. Anyone have any ideas to stop this? Thanks for trying! Mike;
#P connect 2 0 1 0;
#P connect 1 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 17 0;
#P fasten 6 0 4 0 113 384 54 384 54 338 65 338;
#P fasten 7 0 17 1 171 226 82 226;
#P fasten 6 0 4 1 113 384 54 384 54 338 99 338;
#P connect 2 1 1 1;
#P fasten 17 0 6 0 65 297 113 297;
#P fasten 1 1 7 0 106 186 171 186;
#P connect 13 0 8 0;
#P connect 8 0 7 1;
#P connect 10 0 7 2;
#P connect 15 0 7 3;
#P connect 9 0 10 0;
#P connect 12 0 7 4;
#P connect 14 0 16 0;
#P connect 16 0 15 0;
#P connect 11 0 12 0;
#P pop;


March 12, 2008 | 2:24 pm

Hey Mike.

Not too sure about the thumb thing, don’t have any prior experience with
that ddg.mono external either..

Your sustain problem is easily fixed though.
In fact, as you see in the tutorials, in all cases with such an amplitude
changing problem, you can use [line~], not line…
Example, output your sustain number into a message box containg [$1 50] and
send that to [line~].
Now simple output that into the sustain inlet of [adsr~].
That’s one problem down… ;)

Cheers,
Lasse

On Wed, Mar 12, 2008 at 2:51 PM, Michael Field
wrote:

>
> Hi again.
>
> I’m having a coupe of amplitude change issues with the adsr~ unit now, i.e.
> the familiar clicking noises.
>
> Firstly, when holding down a note and adjusting the sustain level in
> [adsr~] there are a sereis of distorted clicks as the amplitude changes. I
> know why this is happening, but I can’t figure out a way to smooth the
> changes. Everything I’ve tried ([poly~, rampsmooth~, line etc)results in a
> signal that [adsr~] can’t understand.
>
> Secondly there is another audible click (more of a thump in this instance)
> when I start a second envelope. As an example (and remember it’s a
> monosynth!) when I play a note with an amplitude envelope with a long
> attack, and I press another note interrupting this first envelope the new
> note thumps loudly first before followiong the envelope set by [adsr~].
> Again, I’ve tried everything I can think of to combat this but to no avail.
>
> I’ve included a sine wave monosynth patch which I’ve been using to try and
> understand adsr~ – It requires Darwin Grosse’s ddg.mono external object.
>
> Hopefully someone has some ideas!
>
> Thanks in advance
> Mike
>
> max v2;
> #N vpatcher 216 67 909 496;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 60 235 27 196617 *~;
> #P newex 309 120 41 196617 * 0.01;
> #P flonum 309 148 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P user dial 308 77 40 40 101 1 0 0 223 270 1 1. 170 170 170 221 221 221
> 120 120 120 225 225 225 0 0 0 0 0 0;
> #P user dial 191 77 40 40 101 10 1 0 223 270 1 1. 170 170 170 221 221 221
> 120 120 120 225 225 225 0 0 0 0 0 0;
> #P flonum 366 148 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P user dial 366 77 40 40 101 10 0 0 223 270 1 1. 170 170 170 221 221 221
> 120 120 120 225 225 225 0 0 0 0 0 0;
> #P flonum 249 148 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P user dial 249 77 40 40 101 10 0 0 223 270 1 1. 170 170 170 221 221 221
> 120 120 120 225 225 225 0 0 0 0 0 0;
> #P flonum 191 148 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 166 198 117 196617 adsr~ 10. 100. 0.5 100;
> #P user gain~ 108 316 38 42 158 0 1.071519 7.94321 10.;
> #P newex 60 199 61 196617 cycle~ 440;
> #P user ezdac~ 60 347 104 380 0;
> #P newex 60 154 31 196617 mtof;
> #P newex 60 51 51 196617 notein a 1;
> #P newex 60 84 51 196617 ddg.mono;
> #P window linecount 18;
> #P comment 424 60 173 196617 These are the problems I’m having… If you
> hold down a note and move the sustain knob there are audible clicks due to
> instant amplitude changes. Is there any way of sorting this? Also , if you
> set attack up high and then move from one note to another try moving a
> couple of octaves) you will hear the new note thump loudly before following
> the envelope. Anyone have any ideas to stop this? Thanks for trying! Mike;
> #P connect 2 0 1 0;
> #P connect 1 0 3 0;
> #P connect 3 0 5 0;
> #P connect 5 0 17 0;
> #P fasten 6 0 4 0 113 384 54 384 54 338 65 338;
> #P fasten 7 0 17 1 171 226 82 226;
> #P fasten 6 0 4 1 113 384 54 384 54 338 99 338;
> #P connect 2 1 1 1;
> #P fasten 17 0 6 0 65 297 113 297;
> #P fasten 1 1 7 0 106 186 171 186;
> #P connect 13 0 8 0;
> #P connect 8 0 7 1;
> #P connect 10 0 7 2;
> #P connect 15 0 7 3;
> #P connect 9 0 10 0;
> #P connect 12 0 7 4;
> #P connect 14 0 16 0;
> #P connect 16 0 15 0;
> #P connect 11 0 12 0;
> #P pop;
>
> –
> Mike Field
> 4th year BA hons Popular Music
> Napier University
> Edinburgh
> Scotland
>


March 12, 2008 | 2:28 pm

Mike,
Here’s a modified version of your patch that addresses your questions. First, I scaled the input to adsr~ from 0-127 to the more MSP-friendly 0.-1. Then using line~ smooths the sustain values. Finally sending the "legato 1" message to adsr~ prevents thumping during retriggers. Hope this helps.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 335 63 60 196617 loadmess 1;
#P newex 354 143 66 196617 loadmess 50;
#P window linecount 9;
#P comment 397 281 82 196617 line~ smoothes sustain values to avoid clicks ; should be initialized with a value other than 0 or else you won’t hear anything;
#P window linecount 1;
#P newex 174 208 40 196617 / 127.;
#P flonum 175 237 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 229 71 31 196617 60 0;
#P user scope~ 233 403 363 533 256 3 128 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0;
#P window linecount 2;
#P comment 398 92 403 196617 if enabled , envelope will not drop to zero in the event of a retrigger while the envelope is active. instead the envelope ramps to the new amplitude over the attack period.;
#P comment 405 25 368 196617 sets the amount of time taken to ramp down to zero in the event of a retrigger while the envelope is active. this ramping prevents clicking. default 10 ms.;
#P toggle 335 87 15 0;
#P window linecount 1;
#P message 335 105 58 196617 legato $1;
#P flonum 334 21 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 334 38 68 196617 retrigger $1;
#P message 360 259 37 196617 $1 20;
#P newex 355 281 32 196617 line~;
#P message 197 109 43 196617 60 127;
#P newex 202 131 40 196617 unpack;
#P newex 108 320 27 196617 *~;
#P newex 357 205 41 196617 * 0.01;
#P flonum 357 233 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user dial 356 162 40 40 101 1 0 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P user dial 239 162 40 40 101 10 1 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P flonum 414 233 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user dial 414 162 40 40 101 10 0 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P flonum 297 233 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user dial 297 162 40 40 101 10 0 0 223 270 1 1. 170 170 170 221 221 221 120 120 120 225 225 225 0 0 0 0 0 0;
#P flonum 239 233 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 214 283 117 196617 adsr~ 10. 100. 0.5 100;
#P user gain~ 156 401 38 42 158 0 1.071519 7.94321 10.;
#P newex 108 284 61 196617 cycle~ 440;
#P user ezdac~ 108 432 152 465 0;
#P newex 108 239 31 196617 mtof;
#P newex 108 136 51 196617 notein a 1;
#P newex 108 169 51 196617 ddg.mono;
#P window linecount 28;
#P comment 577 144 122 196617 These are the problems I’m having… If you hold down a note and move the sustain knob there are audible clicks due to instant amplitude changes. Is there any way of sorting this? [one approach is to use line~] Also , if you set attack up high and then move from one note to another try moving a couple of octaves) you will hear the new note thump loudly before following the envelope. Anyone have any ideas to stop this? [this thump is likely caused by the envelope retriggering. Try using the legato 1 message as above to retrigger notes more gracefully. You may also want to experiment with the retrigger message.] Thanks for trying! Mike;
#P window linecount 1;
#P comment -5 210 176 196617 scales output of ddg.mono to 0.-1. ->;
#P connect 35 0 26 0;
#P connect 34 0 15 0;
#P fasten 8 0 18 1 219 311 130 311;
#P connect 8 0 29 0;
#P connect 32 0 31 0;
#P connect 32 0 8 0;
#P connect 2 1 32 0;
#P connect 30 0 19 0;
#P connect 25 0 8 0;
#P connect 23 0 8 0;
#P connect 24 0 23 0;
#P connect 26 0 25 0;
#P connect 16 0 22 0;
#P connect 21 0 8 3;
#P connect 22 0 21 0;
#P connect 19 1 2 1;
#P connect 19 0 2 0;
#P connect 20 0 19 0;
#P connect 12 0 13 0;
#P connect 17 0 16 0;
#P connect 15 0 17 0;
#P connect 13 0 8 4;
#P connect 10 0 11 0;
#P connect 11 0 8 2;
#P connect 9 0 8 1;
#P connect 14 0 9 0;
#P fasten 18 0 7 0 113 382 161 382;
#P connect 3 1 2 1;
#P fasten 7 0 5 0 161 469 102 469 102 423 113 423;
#P fasten 7 0 5 1 161 469 102 469 102 423 147 423;
#P connect 6 0 18 0;
#P connect 4 0 6 0;
#P connect 2 0 4 0;
#P connect 3 0 2 0;
#P window clipboard copycount 36;


March 12, 2008 | 3:50 pm

Thats brilliant – Thanks for that!

There’s one bit I don’t understand though – the unpack stuff going into ddg.mono. What’s that all about?

Thanks
Mike


March 13, 2008 | 11:12 am

The unpack into ddg.mono was there for me to test the patch without a keyboard. It just allowed me to send messages such as ’60 127′ and ’60 0′ to simulate MIDI input.


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