From 2eb8ef793a66f56f47b631a3e1d4efb3115bcafc Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 2 Nov 2004 06:21:59 +0000 Subject: first version. seems to work well, but maybe could use log and exp scaling, tho that might be best left to other objects svn path=/trunk/externals/hcs/; revision=2198 --- autoscale-help.pd | 34 ++++++++++++++++++++++++++ autoscale.pd | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 autoscale-help.pd create mode 100644 autoscale.pd diff --git a/autoscale-help.pd b/autoscale-help.pd new file mode 100644 index 0000000..286b12f --- /dev/null +++ b/autoscale-help.pd @@ -0,0 +1,34 @@ +#N canvas 588 67 469 401 10; +#X floatatom 26 88 5 0 0 0 - - -; +#X floatatom 26 152 0 0 0 0 - - -; +#X obj 68 270 autoscale; +#X obj 2 2 cnv 15 450 20 empty empty [autoscale] 2 11 1 18 -233017 +-66577 0; +#X obj 418 3 pddp; +#X text 18 35 [autoscale] scales a stream of numbers based on an output +range set as arguments \, and an input range which is set dynamically. +; +#X text 13 193 If you use [autoscale] with no arguments \, then the +output range defaults to 0-127.; +#X floatatom 68 249 5 0 0 0 - - -; +#X obj 71 293 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X text 17 343 (C) Copyright 2004 Hans-Christoph Steiner +; +#X text 234 357 released under the GNU GPL; +#X floatatom 150 152 0 0 0 0 - - -; +#X floatatom 297 152 0 0 0 0 - - -; +#X obj 213 83 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X text 18 376 $Revision: 1.1 $$Author: eighthave $$Date: 2004-11-02 06:21:59 $; +#X obj 26 122 autoscale 0 1; +#X obj 150 122 autoscale -0.01 0.01; +#X obj 297 122 autoscale -4095 4095; +#X connect 0 0 15 0; +#X connect 2 0 8 0; +#X connect 7 0 2 0; +#X connect 13 0 16 0; +#X connect 13 0 17 0; +#X connect 15 0 1 0; +#X connect 16 0 11 0; +#X connect 17 0 12 0; diff --git a/autoscale.pd b/autoscale.pd new file mode 100644 index 0000000..06a55d3 --- /dev/null +++ b/autoscale.pd @@ -0,0 +1,71 @@ +#N canvas 254 119 637 533 10; +#X obj 45 20 inlet; +#X obj 45 453 outlet; +#X obj 105 233 f; +#X text 132 233 min; +#X text 230 234 max; +#X obj 324 167 f \$1; +#X obj 522 167 f \$2; +#X obj 105 210 moses 0; +#X obj 190 210 moses 0; +#X obj 45 102 trigger float float float bang bang; +#X obj 45 390 expr (($f1 - $f2) * (($f5 - $f4) / ($f3 - $f2))) + $f4 +; +#X obj 196 170 oneshot; +#X obj 234 191 f; +#X obj 190 143 t f b f; +#X obj 111 170 oneshot; +#X obj 149 191 f; +#X obj 105 143 t f b f; +#X obj 254 234 + 1e-09; +#X obj 348 213 ==; +#X obj 348 233 sel 1; +#X obj 415 77 loadbang; +#X obj 348 299 print [autocal]; +#X floatatom 342 189 5 0 0 0 - - -; +#X obj 415 100 t b b; +#X obj 324 329 expr if ($f1 == $f2 \, 0 \, $f1) \; if ($f1 == $f2 \, +127 \, $f2); +#X msg 348 278 using default range (0-127); +#X obj 348 256 oneshot; +#X text 2 480 (C) Copyright 2004 Hans-Christoph Steiner +; +#X text 219 495 released under the GNU GPL; +#X text 5 510 $Revision: 1.1 $$Author: eighthave $$Date: 2004-11-02 06:21:59 $; +#X connect 0 0 9 0; +#X connect 2 0 7 1; +#X connect 2 0 10 1; +#X connect 5 0 18 0; +#X connect 5 0 22 0; +#X connect 5 0 24 0; +#X connect 6 0 18 1; +#X connect 6 0 24 1; +#X connect 7 0 2 0; +#X connect 8 1 17 0; +#X connect 9 0 10 0; +#X connect 9 1 16 0; +#X connect 9 2 13 0; +#X connect 9 3 5 0; +#X connect 9 4 6 0; +#X connect 10 0 1 0; +#X connect 11 0 12 0; +#X connect 12 0 8 1; +#X connect 13 0 8 0; +#X connect 13 1 11 0; +#X connect 13 2 12 1; +#X connect 14 0 15 0; +#X connect 15 0 7 1; +#X connect 16 0 7 0; +#X connect 16 1 14 0; +#X connect 16 2 15 1; +#X connect 17 0 8 1; +#X connect 17 0 10 2; +#X connect 18 0 19 0; +#X connect 19 0 26 0; +#X connect 20 0 23 0; +#X connect 23 0 5 0; +#X connect 23 1 6 0; +#X connect 24 0 10 3; +#X connect 24 1 10 4; +#X connect 25 0 21 0; +#X connect 26 0 25 0; -- cgit v1.2.1