#N canvas 263 25 614 747 12;
#X obj 132 608 snapshot~;
#X floatatom 132 636 8 0 0 0 - - - 0;
#X msg 161 480 stop;
#X msg 107 367 0;
#X text 16 716 see also:;
#X obj 92 717 line;
#X obj 138 717 line~;
#X obj 27 12 vline~;
#X text 84 12 - high-precision audio ramp generator;
#X obj 132 573 vline~;
#X text 120 317 ramp up;
#X msg 89 341 0 1000;
#X text 142 342 ramp down;
#X text 140 366 jump down;
#X floatatom 171 546 5 0 0 0 - - - 0;
#X floatatom 167 512 5 0 0 0 - - - 0;
#X text 213 542 right inlet sets next delay time (cleared when ramp starts!), f 32;
#X obj 11 41 cnv 1 600 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X text 526 11 <= click;
#N canvas 708 145 583 306 reference 0;
#X obj 9 42 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 9 205 cnv 2 550 2 empty empty OUTLET: 8 12 0 13 #202020 #000000 0;
#X obj 9 239 cnv 2 550 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X obj 8 276 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 9 75 cnv 1 550 1 empty empty 1st: 8 12 0 13 #9f9f9f #000000 0;
#X text 133 80 float - set target value and start ramp.;
#X obj 9 127 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #9f9f9f #000000 0;
#X text 133 136 float - set next ramp time (cleared when ramp starts).;
#X text 126 214 signal - ramp values.;
#X text 189 249 NONE;
#X obj 27 15 vline~;
#X text 91 15 - high-precision audio ramp generator;
#X obj 9 164 cnv 1 550 1 empty empty 3rd: 8 12 0 13 #9f9f9f #000000 0;
#X text 141 99 stop - stops the ramp.;
#X text 133 173 float - sets delay time.;
#X restore 432 11 pd reference;
#X obj 9 703 cnv 1 600 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X text 202 479 "stop" message freezes [vline~] at its current value;
#X msg 442 348 \; pd dsp \$1;
#X obj 442 314 set-dsp-tgl;
#X text 473 318 DSP on/off;
#X obj 189 717 sig~;
#X text 35 158 Like [line~] \, note that the middle and right inlet (that sets the time and delay) get cleared after the ramp starts (this is unlike other inlets in Pd). Thus \, if you resend [vline~] a float without priorly resetting a ramp time and delay \, it jumps immediately to the target value. A list up to three floats distributes the values over the inlets \, as usual in Pd., f 78;
#X text 35 237 Any number of future ramps may be scheduled and [vline~] will remember them and execute them in order. You can do that by sending different lists in single messagebox. They must be specified in increasing order of initial delay however \, since a segment cancels all planned segments at any future time., f 78;
#X text 210 504 middle inlet sets next ramp time (cleared when ramp starts!), f 32;
#N canvas 376 37 833 711 details 0;
#X text 20 143 !!! BUG: [vline~] objects inside reblocked subpatches can have slightly incorrect timing !!!;
#N canvas 644 207 469 412 conversion 0;
#X obj 142 302 vline~;
#X obj 132 229 bng 20 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 239 241 random 100;
#X obj 239 297 sig~;
#X floatatom 239 269 5 0 0 0 - - - 0;
#X obj 239 335 print~ SIG;
#X obj 132 333 print~ VLINE;
#X obj 239 211 metro 1 1 samps;
#X obj 239 175 tgl 19 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000 0 1;
#X text 266 173 <-- start metronome, f 9;
#X text 60 230 click -->;
#X text 54 24 With immediate jumps (0 length lines) you can use [vline~] to sort of convert floats to signals with more precision than [sig~] \, by making transitions in the middle of a block \, and you can also convert more than one float to a signal within a block. In the example below we convert floats to signals for every sample. Note that [sig~] will only catch the value of the last received float and keep it., f 50;
#X connect 0 0 6 0;
#X connect 1 0 5 0;
#X connect 1 0 6 0;
#X connect 2 0 4 0;
#X connect 3 0 5 0;
#X connect 4 0 0 0;
#X connect 4 0 3 0;
#X connect 7 0 2 0;
#X connect 8 0 7 0;
#X restore 278 90 pd conversion;
#N canvas 728 131 507 450 impulse 0;
#X obj 308 337 vline~;
#X msg 340 229 1;
#X obj 341 274 delay 1 1 samp;
#X msg 341 302 0;
#X obj 290 374 print~;
#X obj 290 151 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X obj 308 194 t b b;
#X obj 164 184 samplerate~;
#X floatatom 164 243 12 0 0 0 - - - 0;
#X obj 164 214 expr 1000/$f1;
#X obj 116 222 f;
#X obj 97 180 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X msg 117 292 1 \, 0 0 \$1;
#X obj 117 327 vline~;
#X obj 99 364 print~;
#X obj 164 157 loadbang;
#X text 50 16 The example below uses [vline~] to generate an impulse \, which is a single sample with a value of '1' followed by zeros again. We do this by having an immediate jump and then having another immediate jump back to zero delayed by a sample. On the left we use the delay schedule and calculate the delay of one sample in ms. On the right we use [delay] to delay the message by a sample externally., f 56;
#X connect 0 0 4 0;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 3 0 0 0;
#X connect 5 0 4 0;
#X connect 5 0 6 0;
#X connect 6 0 2 0;
#X connect 6 1 1 0;
#X connect 7 0 9 0;
#X connect 9 0 8 0;
#X connect 9 0 10 1;
#X connect 10 0 12 0;
#X connect 11 0 10 0;
#X connect 11 0 14 0;
#X connect 12 0 13 0;
#X connect 13 0 14 0;
#X connect 15 0 7 0;
#X restore 278 30 pd impulse;
#X text 128 21 Example on how to generate an impulse, f 19;
#X text 44 76 Example on how to use [vline~] to convert floats to samples with more precision than [sig~], f 31;
#X obj 489 158 vline~;
#X obj 474 200 print~;
#X obj 474 91 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X obj 566 432 vline~;
#X obj 518 472 print~;
#X obj 518 320 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X obj 566 363 delay 1 1 samp;
#X msg 533 395 0;
#X msg 566 394 1 0.5 0 \, 0 0.5 0.5;
#X msg 489 122 0 \, 1 0.5 0;
#X text 587 95 Here we first have an immediate jump to 0 and start a new ramp from it to 1 in 0.5 ms., f 23;
#X text 587 157 Note that the ramp up doesn't start at 0 but at the 1st increment step., f 23;
#X obj 159 319 tgl 19 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X obj 263 344 samplerate~;
#X floatatom 263 403 12 0 0 0 - - - 0;
#X obj 263 374 expr 1000/$f1;
#X obj 122 383 b;
#X obj 159 400 vline~;
#X obj 159 452 print~;
#X obj 159 364 pack f 10 f;
#X obj 263 317 loadbang;
#X text 253 428 one sample delay;
#X text 443 30 This is more problematic when you try to set a start point to a ramp \, like you can do with [line~]., f 45;
#X text 470 250 Below we deal with this situation by delaying the following ramps after the start point by one sample with [delay]., f 39;
#X obj 223 573 pack f 10;
#X obj 198 617 list;
#X obj 100 540 trigger bang float;
#X obj 100 570 delay 1 1 samp;
#X obj 100 507 tgl 19 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X obj 198 660 vline~;
#X text 127 508 Another strategy is to use [delay];
#N canvas 799 303 452 511 sub-sample-accuracy 0;
#X obj 162 341 vline~;
#X obj 114 381 print~;
#X obj 114 287 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X msg 146 139 0;
#X msg 162 167 0.5;
#X msg 172 200 1;
#X text 204 158 Test different delay times, f 14;
#X floatatom 162 233 5 0 0 0 - - - 0;
#X obj 162 270 delay 1 1 samp;
#X text 106 433 We can see that a half sample delay interpolates the result., f 36;
#X text 73 32 Below we can compare a sub sample delay and see the effect on the output. The object is generating an integer increment ramp over the span of an audio block (considering a sample rate of 48Khz)., f 43;
#X msg 162 301 0 \, 64 1.33333 \, 0 0 1.33333;
#X connect 0 0 1 0;
#X connect 2 0 1 0;
#X connect 3 0 7 0;
#X connect 4 0 7 0;
#X connect 5 0 7 0;
#X connect 7 0 2 0;
#X connect 7 0 8 0;
#X connect 8 0 11 0;
#X connect 11 0 0 0;
#X restore 602 640 pd sub-sample-accuracy;
#X text 20 177 Another known issue: Unlike [line~] \, [vline~] immediately jumps to the first increment when triggered. This is a knowingly unfortunate design (aka bug) and probably ok for most cases. Since ramps are always one sample too short \, a line of 1 sample duration is the same as a 0 length (immediate jump). This may eventually be fixed \, but for the meantime you can add a one sample delay when starting a ramp \, if you really need it to start at the current value., f 57;
#X text 446 520 Sub-sample accuracy: In the above example \, we don't see our ramp reach the value of '1' \, which would be the end of the first ramp and the start of the next one. This is because this point lies in between samples and [vline~] has sub-sample accuracy \, in which it interpolates accordingly. Check another example below., f 51;
#X connect 5 0 6 0;
#X connect 7 0 6 0;
#X connect 7 0 14 0;
#X connect 8 0 9 0;
#X connect 10 0 12 0;
#X connect 10 0 9 0;
#X connect 10 0 11 0;
#X connect 11 0 13 0;
#X connect 12 0 8 0;
#X connect 13 0 8 0;
#X connect 14 0 5 0;
#X connect 17 0 21 0;
#X connect 17 0 24 0;
#X connect 18 0 20 0;
#X connect 20 0 19 0;
#X connect 20 0 24 2;
#X connect 21 0 23 0;
#X connect 22 0 23 0;
#X connect 24 0 22 0;
#X connect 25 0 18 0;
#X connect 29 0 30 1;
#X connect 30 0 34 0;
#X connect 31 0 32 0;
#X connect 31 1 29 0;
#X connect 32 0 30 0;
#X connect 33 0 31 0;
#X restore 433 647 pd details;
#X msg 131 422 1 1000 \, 0 0 2000 \, 1 1000 3000 \, 0 0 4000;
#X obj 135 665 hsl 162 19 0 1 0 0 empty empty empty -2 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X obj 48 545 loadbang;
#X msg 69 317 1 1000;
#X text 35 53 The [vline~] object generates linear ramps like [line~] \, but ramps may start and stop within blocks and even between audio samples (in which case the output is interpolated accordingly). It takes a target value \, a time interval in milliseconds to reach it and an initial delay (also in ms). This object can also convert float to signals with more preciosion than [sig~] (see [pd details] below). Unlike [line~] \, it starts incrementing right away (also see [pd details] below)., f 78;
#X obj 48 572 metro 25;
#X text 140 447 note: times (2000 \, 3000 \, 4000) are cumulative \, not incremental, f 63;
#X text 126 398 ramp up \, wait \, jump down \, wait \, ramp up again \, jump down again, f 63;
#X text 375 602 Open subpacth for more details and information:, f 24;
#X text 387 716 updated for Pd version 0.56-3;
#X connect 0 0 1 0;
#X connect 1 0 31 0;
#X connect 2 0 9 0;
#X connect 3 0 9 0;
#X connect 9 0 0 0;
#X connect 11 0 9 0;
#X connect 14 0 9 2;
#X connect 15 0 9 1;
#X connect 23 0 22 0;
#X connect 30 0 9 0;
#X connect 32 0 35 0;
#X connect 33 0 9 0;
#X connect 35 0 0 0;
