[PD] range of numbers
Frank Barknecht
fbar at footils.org
Fri Aug 20 19:31:44 CEST 2004
Hallo,
Lazzaro N. Ciccolella hat gesagt: // Lazzaro N. Ciccolella wrote:
> what succeeds if I must convert one portion of that range ?
> example
> I would want to convert
> the range 0.20 - 0.60
> in the range 0 - 127
>
> in other word:
>
> 0.20 must become 0
> and
> 0.60 must become 127
>
> (I am making a patch that transforms whichever thing inside a pidip_canvas
> in one slider 0-127)
>
> I have already made the subpatch (with the maths object :)) that make this trasformation
> but
> the patch becomes more and more large and I asked if were a pd object that let me to save cpu.
It could be interesting to benchmark an abstraction solution agains
maxlib.scale, but I doubt, that maxlib.scale would be that much
faster.
Attached is an abstraction I sometimes use when I want to make sure, I
don't need to rely on maxlib.scale (which also can clash with
Gem.scale)
Ciao
--
Frank Barknecht _ ______footils.org__
-------------- next part --------------
#N canvas 542 303 677 498 10;
#X obj 352 92 f \$1;
#X obj 464 94 f \$4;
#X obj 426 94 f \$3;
#X obj 386 92 f \$2;
#X obj 300 142 s \$0-il;
#X obj 354 140 s \$0-ih;
#X obj 476 134 s \$0-oh;
#X obj 412 138 s \$0-ol;
#X obj 375 185 -;
#X obj 384 161 t b f;
#X obj 461 248 s \$0-ir;
#X obj 461 199 -;
#X obj 462 169 t b f;
#X obj 521 248 s \$0-or;
#X obj 61 206 spigot;
#X obj 372 214 select 0;
#X obj 98 174 r \$0-ir;
#X obj 423 285 t b f;
#X obj 423 324 /;
#X obj 423 365 s \$0-k;
#X obj 61 55 inlet;
#X obj 77 354 r \$0-ol;
#X obj 61 382 +;
#X obj 77 306 r \$0-k;
#X obj 61 331 *;
#X obj 61 273 -;
#X obj 77 240 r \$0-il;
#X obj 61 423 outlet;
#X msg 275 403 WARNING: Input range of 0 detected. Object might block!
;
#X obj 318 45 inlet;
#X obj 422 45 inlet;
#X obj 472 45 inlet;
#X obj 522 43 inlet;
#X obj 371 28 t b b;
#X obj 368 5 loadbang;
#X text 118 28 ARGS;
#X text 128 52 1: input_low_border;
#X text 128 74 2: input_high_border;
#X text 128 100 3: output_low_border;
#X text 128 122 4: output_high_border;
#X obj 268 437 print \$0-scaler;
#X connect 0 0 4 0;
#X connect 0 0 8 0;
#X connect 1 0 6 0;
#X connect 1 0 12 0;
#X connect 2 0 7 0;
#X connect 2 0 11 0;
#X connect 3 0 5 0;
#X connect 3 0 9 0;
#X connect 8 0 15 0;
#X connect 9 0 8 0;
#X connect 9 1 8 1;
#X connect 11 0 13 0;
#X connect 11 0 18 0;
#X connect 12 0 11 0;
#X connect 12 1 11 1;
#X connect 14 0 25 0;
#X connect 15 0 28 0;
#X connect 15 1 10 0;
#X connect 15 1 17 0;
#X connect 16 0 14 1;
#X connect 17 0 18 0;
#X connect 17 1 18 1;
#X connect 18 0 19 0;
#X connect 20 0 14 0;
#X connect 21 0 22 1;
#X connect 22 0 27 0;
#X connect 23 0 24 1;
#X connect 24 0 22 0;
#X connect 25 0 24 0;
#X connect 26 0 25 1;
#X connect 28 0 40 0;
#X connect 29 0 0 0;
#X connect 30 0 3 0;
#X connect 31 0 2 0;
#X connect 32 0 1 0;
#X connect 33 0 0 0;
#X connect 33 0 2 0;
#X connect 33 1 1 0;
#X connect 33 1 3 0;
#X connect 34 0 33 0;
-------------- next part --------------
#N canvas 480 396 450 300 10;
#X floatatom 171 105 5 0 0 0 - - -;
#X floatatom 177 179 5 0 0 0 - - -;
#X obj 173 141 scaler 0 127 1 10;
#X msg 313 99 -1;
#X obj 240 196 print;
#X msg 225 99 bang;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 2 0 4 0;
#X connect 3 0 2 4;
#X connect 5 0 2 0;
More information about the Pd-list
mailing list