On Fri, 2010-04-23 at 13:36 +0300, João Pais wrote: > is the formula somewhere? I found a parcial one by frank, but didn't > really work. and now I'm too busy to be chasing this.
I don't know "the" formula, but I did it by putting two "Dreisätze" (rules of three?) in a row: The first scales the input to 0-1, the second scales 0-1 to the output range. If written out as a formula, this could probably even made shorter, I don't know. Check the attached scale_abs.pd (It lacks the log/lin switch feature, though). Roman P.S.: [maxlib/scale] seems to apply correct formulas, but the initialization seems to be buggy. After manually setting the ranges, it outputs correct values. > > On Fri, 2010-04-23 at 13:12 +0300, João Pais wrote: > >> Hi, > >> > >> I think I found a bug in maxlib/scale. Unless the order of the > >> parameters > >> is aligned - smaller value as smaller input/output and bigger value for > >> input/output -, the external doesn't work properly. Is this normal or > >> desired? I always thought that the parameter order would be > >> interchangeable without problems. > >> > >> Here's a patch to illustrate it: > > > > Indeed, very wrong. > > > > Unfortunately, from what I know maxlib is not maintained anymore by its > > original author (probably it can be considered 'community-maintained'). > > And since this can be nicely written as an abstraction, I'd say that > > the buggy external version should be avoided. > > > > Roman > > > > > > > >
#N canvas 227 150 965 469 10; #X floatatom 33 77 5 0 0 0 - - -; #X floatatom 34 173 5 0 0 0 - - -; #X msg 88 82 99; #X msg 87 56 0; #X text 114 82 comes out 1 instead of 0; #X obj 35 124 maxlib/scale 0 99 10 0; #X floatatom 328 86 5 0 0 0 - - -; #X floatatom 329 182 5 0 0 0 - - -; #X msg 383 91 99; #X msg 382 65 0; #X obj 330 133 maxlib/scale 99 0 0 10; #X text 334 43 inverted is even weirder; #X floatatom 49 277 5 0 0 0 - - -; #X floatatom 50 373 5 0 0 0 - - -; #X msg 104 282 99; #X msg 103 256 0; #X floatatom 289 276 5 0 0 0 - - -; #X floatatom 290 372 5 0 0 0 - - -; #X msg 344 281 99; #X msg 343 255 0; #X obj 291 323 maxlib/scale 0 99 0 10; #X text 268 235 only this combination works; #X text 83 230 ??????; #X floatatom 513 91 5 0 0 0 - - -; #X floatatom 514 187 5 0 0 0 - - -; #X msg 568 96 99; #X msg 567 70 0; #X text 594 96 comes out 1 instead of 0; #X floatatom 808 100 5 0 0 0 - - -; #X floatatom 809 196 5 0 0 0 - - -; #X msg 863 105 99; #X msg 862 79 0; #X text 814 57 inverted is even weirder; #X floatatom 529 291 5 0 0 0 - - -; #X floatatom 530 387 5 0 0 0 - - -; #X msg 584 296 99; #X msg 583 270 0; #X floatatom 769 290 5 0 0 0 - - -; #X floatatom 770 386 5 0 0 0 - - -; #X msg 824 295 99; #X msg 823 269 0; #X text 748 249 only this combination works; #X text 563 244 ??????; #X obj 515 138 scale_abs 0 99 10 0; #X obj 810 147 scale_abs 99 0 0 10; #X obj 531 338 scale_abs 99 0 10 0; #X obj 771 337 scale_abs 0 99 0 10; #X msg 151 264 99 0 10 0; #X obj 151 285 unpack f f f f; #X obj 51 324 maxlib/scale 99 0 10 0 0; #X text 19 219 It works after setting it manually; #X connect 0 0 5 0; #X connect 2 0 5 0; #X connect 3 0 5 0; #X connect 5 0 1 0; #X connect 6 0 10 0; #X connect 8 0 10 0; #X connect 9 0 10 0; #X connect 10 0 7 0; #X connect 12 0 49 0; #X connect 14 0 49 0; #X connect 15 0 49 0; #X connect 16 0 20 0; #X connect 18 0 20 0; #X connect 19 0 20 0; #X connect 20 0 17 0; #X connect 23 0 43 0; #X connect 25 0 43 0; #X connect 26 0 43 0; #X connect 28 0 44 0; #X connect 30 0 44 0; #X connect 31 0 44 0; #X connect 33 0 45 0; #X connect 35 0 45 0; #X connect 36 0 45 0; #X connect 37 0 46 0; #X connect 39 0 46 0; #X connect 40 0 46 0; #X connect 43 0 24 0; #X connect 44 0 29 0; #X connect 45 0 34 0; #X connect 46 0 38 0; #X connect 47 0 48 0; #X connect 48 0 49 1; #X connect 48 1 49 2; #X connect 48 2 49 3; #X connect 48 3 49 4; #X connect 49 0 13 0;
#N canvas 324 367 451 372 10; #X obj 20 19 inlet; #X obj 101 24 inlet; #X obj 159 24 inlet; #X obj 252 22 inlet; #X obj 310 20 inlet; #X obj 20 121 -; #X obj 101 98 t a a; #X obj 128 121 pack f f; #X obj 159 100 t b a; #X msg 128 141 \$2 \$1; #X obj 128 162 -; #X obj 20 196 /; #X obj 252 113 t a a; #X obj 310 159 pack f f; #X obj 310 115 t b a; #X msg 310 179 \$2 \$1; #X obj 310 200 -; #X obj 20 288 +; #X obj 20 254 *; #X obj 20 327 outlet; #X obj 117 76 f \$1; #X obj 180 78 f \$2; #X obj 265 80 f \$3; #X obj 327 82 f \$4; #X obj 368 28 loadbang; #X obj 368 49 t b b b b; #X connect 0 0 5 0; #X connect 1 0 6 0; #X connect 2 0 8 0; #X connect 3 0 12 0; #X connect 4 0 14 0; #X connect 5 0 11 0; #X connect 6 0 5 1; #X connect 6 1 7 0; #X connect 7 0 9 0; #X connect 8 0 7 0; #X connect 8 1 7 1; #X connect 9 0 10 0; #X connect 10 0 11 1; #X connect 11 0 18 0; #X connect 12 0 13 0; #X connect 12 1 17 1; #X connect 13 0 15 0; #X connect 14 0 13 0; #X connect 14 1 13 1; #X connect 15 0 16 0; #X connect 16 0 18 1; #X connect 17 0 19 0; #X connect 18 0 17 0; #X connect 20 0 6 0; #X connect 21 0 8 0; #X connect 22 0 12 0; #X connect 23 0 14 0; #X connect 24 0 25 0; #X connect 25 0 20 0; #X connect 25 1 21 0; #X connect 25 2 22 0; #X connect 25 3 23 0;
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
