Update of /cvsroot/pure-data/abstractions/footils/list-abs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20192
Modified Files: README Added Files: list-abs-help.pd list-abs.pd list-equalize-help.pd list-equalize.pd list-normalize-help.pd list-normalize.pd Log Message: Some new additions: list-abs (finally!): do absolute on list. list-normalize: norm. a list, list-equalize: scale, so that the sum of all floats in a list is 1.
--- NEW FILE: list-normalize.pd --- #N canvas 306 264 642 393 10; #X obj 209 202 list-minmax; #X obj 209 170 list-abs; #X obj 179 77 inlet; #X obj 179 99 t a a; #X obj 209 286 list-math /; #X obj 209 319 outlet; #X text 135 41 list-normalize: normalize a list inside (-1 , 1); #X connect 0 1 4 1; #X connect 1 0 0 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 1 1 0; #X connect 4 0 5 0;
--- NEW FILE: list-abs.pd --- #N canvas 228 307 502 424 10; #X obj 130 59 inlet; #X obj 130 86 t b a b; #X obj 152 145 list-drip; #X obj 152 190 abs; #X obj 152 168 route float; #X obj 152 244 list prepend; #X obj 245 244 t l; #X obj 129 274 list; #X obj 129 302 outlet; #X text 92 30 list-abs: apply abs() on float elements of a list.; #X connect 0 0 1 0; #X connect 1 0 7 0; #X connect 1 1 2 0; #X connect 1 2 5 1; #X connect 2 0 4 0; #X connect 3 0 5 0; #X connect 4 0 3 0; #X connect 4 1 5 0; #X connect 5 0 6 0; #X connect 5 0 7 1; #X connect 6 0 5 1; #X connect 7 0 8 0;
--- NEW FILE: list-equalize-help.pd --- #N canvas 485 298 612 548 10; #X obj 93 283 list-equalize; #X obj 93 71 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 2400 1; #X obj 93 248 pack 0 0 0; #X obj 115 209 t b f; #X obj 161 212 t b f; #X obj 93 310 unpack 0 0 0; #X obj 128 71 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 7300 1; #X obj 161 71 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 2500 1; #X floatatom 93 341 5 0 0 0 - - -; #X floatatom 132 341 5 0 0 0 - - -; #X floatatom 172 341 5 0 0 0 - - -; #X obj 93 367 vsl 15 128 0 1 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 2498 1; #X obj 132 367 vsl 15 128 0 1 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 7599 1; #X obj 172 367 vsl 15 128 0 1 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 2602 1; #X text 207 34 list-equalize:; #X text 227 53 scale a list so that all float elements sum up to 1 ; #X text 227 77 L_result = L_input / sum(L_input); #X obj 306 253 list-equalize; #X obj 306 280 print; #X text 258 177 Also handles non-float elements gracefully.; #X msg 306 226 90 plus 10 is 100; #X text 40 138 0-127; #X text 42 427 0-1; #X connect 0 0 5 0; #X connect 1 0 2 0; #X connect 2 0 0 0; #X connect 3 0 2 0; #X connect 3 1 2 1; #X connect 4 0 2 0; #X connect 4 1 2 2; #X connect 5 0 8 0; #X connect 5 1 9 0; #X connect 5 2 10 0; #X connect 6 0 3 0; #X connect 7 0 4 0; #X connect 8 0 11 0; #X connect 9 0 12 0; #X connect 10 0 13 0; #X connect 17 0 18 0; #X connect 20 0 17 0;
--- NEW FILE: list-abs-help.pd --- #N canvas 349 434 450 300 10; #X obj 147 158 list-abs; #X obj 147 204 print; #X msg 147 109 1 2 -3 -4 5 and -6; #X text 55 66 list-abs: apply abs() on float elements of a list.; #X connect 0 0 1 0; #X connect 2 0 0 0;
--- NEW FILE: list-normalize-help.pd --- #N canvas 136 269 816 502 10; #X obj 145 295 list-normalize; #X msg 145 183 10 100 200; #X msg 157 204 -10 100 200; #X msg 165 226 -10 100 and -200; #X msg 168 251 0.1 0.01 and -0.02; #X text 40 13 list-normalize: normalize a list.; #X text 54 89 All the other float elements then are scaled with the same factor.; #X text 54 41 First it looks for the element with the largest absolute value , then this is scaled to be 1 or -1 preserving the sign.; #X text 54 129 It's the same operation as the "Normalize" instruction in many soundfile editors or the "normalize 1" method of Pd arrays. ; #X obj 427 425 list-math *; #X text 33 427 Hint: To normalize to values other than 1 , you can use:; #X obj 499 366 loadbang; #X floatatom 499 406 5 0 0 0 - - -; #X msg 499 386 3; #X obj 145 377 print Normalized; #X obj 427 450 print Norm_to_3; #X obj 617 28 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 5600 1; #X obj 617 205 pack 0 0 0; #X obj 639 166 t b f; #X obj 685 169 t b f; #X obj 617 267 unpack 0 0 0; #X obj 652 28 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 7400 1; #X obj 685 28 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 4400 1; #X floatatom 617 298 5 0 0 0 - - -; #X floatatom 656 298 5 0 0 0 - - -; #X floatatom 696 298 5 0 0 0 - - -; #X obj 617 324 vsl 15 128 0 1 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 9611 1; #X obj 656 324 vsl 15 128 0 1 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 12700 1; #X obj 696 324 vsl 15 128 0 1 0 0 empty empty empty 0 -8 0 8 -262144 -1 -1 7551 1; #X text 735 94 0-127; #X text 740 390 0-1; #X obj 617 240 list-normalize; #X connect 0 0 9 0; #X connect 0 0 14 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 9 0 15 0; #X connect 11 0 13 0; #X connect 12 0 9 1; #X connect 13 0 12 0; #X connect 16 0 17 0; #X connect 17 0 31 0; #X connect 18 0 17 0; #X connect 18 1 17 1; #X connect 19 0 17 0; #X connect 19 1 17 2; #X connect 20 0 23 0; #X connect 20 1 24 0; #X connect 20 2 25 0; #X connect 21 0 18 0; #X connect 22 0 19 0; #X connect 23 0 26 0; #X connect 24 0 27 0; #X connect 25 0 28 0; #X connect 31 0 20 0;
Index: README =================================================================== RCS file: /cvsroot/pure-data/abstractions/footils/list-abs/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README 1 Nov 2005 12:41:16 -0000 1.1 --- README 1 Nov 2005 18:20:14 -0000 1.2 *************** *** 9,12 **** --- 9,16 ---- get a list containing the last x atoms received.
+ list-abs.pd + + change floats in a lists to their absolute values. + list-accum.pd
*************** *** 30,33 **** --- 34,41 ---- serialize a list on demand: each bang will output the next element.
+ list-equalize.pd + + scale a list so that all float elements sum up to 1 + list-inter.pd
*************** *** 52,55 **** --- 60,67 ---- find minimum and maximum float in a list.
+ list-normalize.pd + + normalize a list to (-1,1) like you can normalize a Pd array. + list-rev.pd
--- NEW FILE: list-equalize.pd --- #N canvas 0 0 450 300 10; #X obj 139 43 inlet; #X obj 139 65 t a a; #X obj 139 166 list-math /; #X obj 211 93 list-accum; #X obj 139 227 outlet; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 1 1 3 0; #X connect 2 0 4 0; #X connect 3 0 2 1;