ramps smooth vs slide

chachaching's icon

and was curious...I have been using line~ with after a sample to get rid of clicks when turning on and off audio from a buffer. How would I use rampsmooth or slide to do this...?

Roman Thilenius's icon

just do it after using sig~ when you come from control rate numbers.

"number"
sig~
slide~ 882 882

creates logarithmic curves of 20 milliseconds length at every change.

works likewise with rampsmooth. both have the advantage that you can easily control up and down times individually, which is a bit more work when using only line~.

but most of the case you want to stay with line~ i think.

p.s. well ... this is for "mouse", and not for every possible situation.
using line means you still have a more or less big kinks in the resulting control signal. you can smooth that further in a second step.

onepole or biquad will exceed the limits of the input range (and is frequency dependent), but it is still easier to build than bezier curves and similar crap. (plus its latency free)


#P user scope~ 475 376 575 567 16 3 64 0. 1. 0 0. 0 0. 102 255 51 135 135 135 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 462 331 101 9109513 onepole~ 20 Hz;
#B color 5;
#P newex 112 263 101 9109513 sig~;
#B color 5;
#P user scope~ 83 376 183 567 16 3 64 0. 1. 0 0. 0 0. 102 255 51 135 135 135 0;
#P user multiSlider 66 31 60 212 0. 1. 1 2937 47 0 0 2 0 0 0;
#M frgb 181 181 181;
#M brgb 42 42 42;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P user scope~ 345 376 445 567 16 3 64 0. 1. 0 0. 0 0. 102 255 51 135 135 135 0;
#P newex 326 336 101 9109513 slide~ 4410 44100;
#B color 5;
#P toggle 29 246 23 0;
#P newex 29 297 50 9109513 dac~;
#P user scope~ 213 376 313 567 16 3 64 0. 1. 0 0. 0 0. 102 255 51 135 135 135 0;
#P newex 343 119 122 9109513 expr (random(0\\\,101.))/100.;
#P toggle 343 56 23 0;
#P flonum 258 186 56 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P noclick;
#P newex 289 262 101 9109513 pack 0. 100.;
#P newex 343 91 108 9109513 metro 500;
#P newex 112 294 146 9109513 rampsmooth~ 4410 4410;
#B color 5;
#P newex 289 292 101 9109513 line~;
#B color 5;
#P connect 15 0 16 0;
#P connect 0 0 7 0;
#P connect 0 0 10 0;
#P connect 0 0 15 0;
#P connect 9 0 8 0;
#P connect 1 0 13 0;
#P connect 4 0 14 0;
#P connect 14 0 1 0;
#P connect 12 0 4 0;
#P connect 6 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 0 0;
#P connect 5 0 2 0;
#P connect 2 0 6 0;
#P connect 10 0 11 0;
#P window clipboard copycount 17;

chachaching's icon

ahh very cool thanks!

I still seam to get a click when I go back 2 zero....any professional thoughts..?
But only on loud audio.
thanks again

Max Patch
Copy patch and select New From Clipboard in Max.

Jean-Francois Charles's icon

Roman, this is a cool patch. Also, so vintage #P newex... Is it Max 5 or Max 4 code?

Roman Thilenius's icon

vintage is cool. wasn´t is ever, even in the past?

demonstrating here why the anonymous ircam guy is right that you can replace line with rampsmooth.
(despite my opposite favorite practice of using mostly line - rampsmooth sucks when it requries a message to change time)

Jean-Francois Charles's icon

Also, use [curve~] with a curve parameterof 0 if you are bored with [line~].
Vintage has been the future for a while.

Roman Thilenius's icon

in your second patcher the problem is the groove object, which turns off before the interpolated envelope even begins.

pipe 100 the 0 for the groove object, according to the 4410 samples of the rampsmooth (give that you are using 44100 Hz samplingfrequency.

eventually make the time frame a bit bigger if you think you still hear something.

there are two things which come to play:
the frequency of the interpolation filter itself: if you you would use only 1 ms you could as well not interpolate.
the other thing is explained on that ircam page: _any click, no matter how "flat" it is (and you currently still have clicks in your control signal) is a full spectrum sound (and as opposed to "pop" sound, "click" sounds will often be audible even if very quiet.)

but be careful, if the time is too long, you might end up with with a triangle wave click (some 5 times loader) because the control signal will go bvack to 0 before it reached 1. :)

while you test, maybe use a time of 1000 ms, then you see the graph better.

Roman Thilenius's icon

and if you are paranoid, put a defer after the 0 and 1 buttons and change the order of the t i i when the input is 1

Roman Thilenius's icon

right jfc, an s-curve can be very useful to cover cases where fast movements mix with slow ones. protools, toast & ddp offer it as an option for gain for a reason. ;)