Hi,
I figured, attached abstraction could be useful to someone else, too, even though it's very simple.
list-math.pd will do basic math operations on lists, that is, add a constant to a list, multiply a list with a float etc. It is similar to Gem's vector operations v+, v*, etc. but is only using builtin objects (as of pd-0.39, where "list" was introduced) and can deal with mixed lists that also contain symbols, like "list a b c 1 2 3 x".
The basic principle used inside can also be changed to do symbol operations or even more general ops. Just replace the central "expr" with something else.
Frank Barknecht _ ______footils.org_ __goto10.org__
Hallo, Frank Barknecht hat gesagt: // Frank Barknecht wrote:
I figured, attached abstraction could be useful to someone else, too, even though it's very simple.
Oh, and here are some more: [list-makefilename] will change the symbols in a list instead and apply [makefilename $1] to it, whereas [OSCprepend] does the same as the [OSCprepend] in Memento, however using only pd-0.39 builtins instead of Cyclone or Zexy.
I will replace Memento's OSCprepend with attached one in the future (when Pd's GOP on GOP bug is fixed and RRADical moves to require less externals, but pd-0.39).
Frank Barknecht _ ______footils.org_ __goto10.org__
Hallo,
the newest little toy in my neverending exploration of the cool possibilities, that [list] offers, is a settable route, or a dream come true.
Frank Barknecht _ ______footils.org_ __goto10.org__
Hi Frank (and others),
thanks for sharing these ideas. While looking through the abstractions I got an idea for another one: [list-dist] distributes the members of a list over up to four outlets (it could easily be extended to more outlets). With the creation argument or the right inlet you can change the number of outlets (out of the four) that are used. If this exceeds 4 then the corresponding list members are dropped. After the whole list is processed, the right outlet gives a bang.
The abstraction uses the modified [drip] subpatch from list-math.pd and the list-demux 'idiom'.
Have fun Urs
Frank Barknecht schrieb:
Hi,
I figured, attached abstraction could be useful to someone else, too, even though it's very simple.
list-math.pd will do basic math operations on lists, that is, add a constant to a list, multiply a list with a float etc. It is similar to Gem's vector operations v+, v*, etc. but is only using builtin objects (as of pd-0.39, where "list" was introduced) and can deal with mixed lists that also contain symbols, like "list a b c 1 2 3 x".
The basic principle used inside can also be changed to do symbol operations or even more general ops. Just replace the central "expr" with something else.
Ciao
#N canvas 424 89 624 640 10; #X msg 119 113 1 2 3 4 a b c; #X text 251 117 <- click to test; #X obj 196 386 list; #X obj 77 499 list; #X obj 100 271 route float; #X obj 100 385 list prepend; #X floatatom 248 273 5 0 0 0 - - -; #N canvas 0 0 533 407 drip 0; #X obj 64 206 list split 1; #X obj 64 123 until; #X obj 64 181 list append; #X obj 194 206 bang; #X text 146 90 First store list , then start the loop; #X text 163 118 "until" bangs its output until told to stop by a "bang" to its right inlet.; #X text 182 160 Store the remaining list.; #X text 239 205 third outlet of "split" tells us to stop.; #X obj 64 243 outlet; #X obj 64 57 inlet; #X obj 64 86 t b l; #X text 237 44 From list-help.pd; #X connect 0 0 8 0; #X connect 0 1 2 1; #X connect 0 2 3 0; #X connect 1 0 2 0; #X connect 2 0 0 0; #X connect 3 0 1 1; #X connect 9 0 10 0; #X connect 10 0 1 0; #X connect 10 1 2 1; #X restore 100 242 pd drip; #X obj 78 150 t b a b; #X text 254 314 Do math only on float elements; #X obj 122 178 s $0-reset-result; #X obj 179 357 r $0-reset-result; #X text 260 177 clear result list; #X text 175 242 "Drip" (serialize) the list; #X text 258 389 Repack the list (think of the counter); #X text 124 496 Final result is built here; #X obj 78 81 inlet; #X obj 100 307 expr $f1 $1 $f2; #X obj 200 273 inlet; #X obj 77 530 outlet; #X text 182 32 Use as "list-math operator" where operator is some binary operator , expr can understand.; #X connect 0 0 8 0; #X connect 2 0 5 1; #X connect 3 0 19 0; #X connect 4 0 17 0; #X connect 4 1 5 0; #X connect 5 0 2 0; #X connect 5 0 3 1; #X connect 6 0 17 1; #X connect 7 0 4 0; #X connect 8 0 3 0; #X connect 8 1 7 0; #X connect 8 2 10 0; #X connect 11 0 5 1; #X connect 16 0 8 0; #X connect 17 0 5 0; #X connect 18 0 17 1;
#N canvas 395 384 675 536 10; #X obj 160 259 print L; #X msg 160 194 1 2 3 4 a b c; #X floatatom 270 193 5 0 0 0 - - -; #X obj 404 263 print L; #X msg 404 198 1 2 3 4 a b c; #X floatatom 514 197 5 0 0 0 - - -; #X obj 164 365 print L; #X msg 164 300 1 2 3 4 a b c; #X floatatom 274 299 5 0 0 0 - - -; #X obj 160 226 list-math *; #X msg 159 167 1 2 3 4 a b c , 10 20 30 x y z; #X text 144 93 Use as "list-math operator" where operator is some binary operator , that expr can understand , like + , - , * or /; #X obj 406 373 print L; #X msg 406 308 1 2 3 4 a b c; #X floatatom 516 307 5 0 0 0 - - -; #X obj 132 31 cnv 15 140 30 empty empty list-math 20 12 0 14 -233017 -66577 0; #X text 292 40 simple mathematical operations on lists.; #X obj 404 230 list-math +; #X obj 164 332 list-math /; #X obj 406 340 list-math -; #X connect 1 0 9 0; #X connect 2 0 9 1; #X connect 4 0 17 0; #X connect 5 0 17 1; #X connect 7 0 18 0; #X connect 8 0 18 1; #X connect 9 0 0 0; #X connect 10 0 9 0; #X connect 13 0 19 0; #X connect 14 0 19 1; #X connect 17 0 3 0; #X connect 18 0 6 0; #X connect 19 0 12 0;
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Just a related comment -
I made a listmoses external yesterday, and was waiting to correct errors in another extern before I published it, but then I read this thread...
listmoses is now available on cvs, and just segregates lists according to boudary values as well as a "buddy" list (great for organising frequency and amplitude lists output separately from another external). Not so much doing math, but may be useful to you.
Best, Ed
--- Urs Liska pd@ursliska.de wrote:
Hi Frank (and others),
thanks for sharing these ideas. While looking through the abstractions I got an idea for another one: [list-dist] distributes the members of a list over up to four outlets (it could easily be extended to more outlets). With the creation argument or the right inlet you can change the number of outlets (out of the four) that are used. If this exceeds 4 then the corresponding list members are dropped. After the whole list is processed, the right outlet gives a bang.
The abstraction uses the modified [drip] subpatch from list-math.pd and the list-demux 'idiom'.
Have fun Urs
Frank Barknecht schrieb:
Hi,
I figured, attached abstraction could be useful to
someone else, too,
even though it's very simple.
list-math.pd will do basic math operations on
lists, that is, add a
constant to a list, multiply a list with a float
etc. It is similar to
Gem's vector operations v+, v*, etc. but is only
using builtin objects
(as of pd-0.39, where "list" was introduced) and
can deal with mixed
lists that also contain symbols, like "list a b c
1 2 3 x".
The basic principle used inside can also be
changed to do symbol
operations or even more general ops. Just replace
the central "expr"
with something else.
Ciao
#N canvas 424 89 624 640 10; #X msg 119 113 1 2 3 4 a b c; #X text 251 117 <- click to test; #X obj 196 386 list; #X obj 77 499 list; #X obj 100 271 route float; #X obj 100 385 list prepend; #X floatatom 248 273 5 0 0 0 - - -; #N canvas 0 0 533 407 drip 0; #X obj 64 206 list split 1; #X obj 64 123 until; #X obj 64 181 list append; #X obj 194 206 bang; #X text 146 90 First store list , then start the
loop;
#X text 163 118 "until" bangs its output until
told to stop by a "bang"
to its right inlet.; #X text 182 160 Store the remaining list.; #X text 239 205 third outlet of "split" tells us
to stop.;
#X obj 64 243 outlet; #X obj 64 57 inlet; #X obj 64 86 t b l; #X text 237 44 From list-help.pd; #X connect 0 0 8 0; #X connect 0 1 2 1; #X connect 0 2 3 0; #X connect 1 0 2 0; #X connect 2 0 0 0; #X connect 3 0 1 1; #X connect 9 0 10 0; #X connect 10 0 1 0; #X connect 10 1 2 1; #X restore 100 242 pd drip; #X obj 78 150 t b a b; #X text 254 314 Do math only on float elements; #X obj 122 178 s $0-reset-result; #X obj 179 357 r $0-reset-result; #X text 260 177 clear result list; #X text 175 242 "Drip" (serialize) the list; #X text 258 389 Repack the list (think of the
counter);
#X text 124 496 Final result is built here; #X obj 78 81 inlet; #X obj 100 307 expr $f1 $1 $f2; #X obj 200 273 inlet; #X obj 77 530 outlet; #X text 182 32 Use as "list-math operator" where
operator is some binary
operator , expr can understand.; #X connect 0 0 8 0; #X connect 2 0 5 1; #X connect 3 0 19 0; #X connect 4 0 17 0; #X connect 4 1 5 0; #X connect 5 0 2 0; #X connect 5 0 3 1; #X connect 6 0 17 1; #X connect 7 0 4 0; #X connect 8 0 3 0; #X connect 8 1 7 0; #X connect 8 2 10 0; #X connect 11 0 5 1; #X connect 16 0 8 0; #X connect 17 0 5 0; #X connect 18 0 17 1;
#N canvas 395 384 675 536 10; #X obj 160 259 print L; #X msg 160 194 1 2 3 4 a b c; #X floatatom 270 193 5 0 0 0 - - -; #X obj 404 263 print L; #X msg 404 198 1 2 3 4 a b c; #X floatatom 514 197 5 0 0 0 - - -; #X obj 164 365 print L; #X msg 164 300 1 2 3 4 a b c; #X floatatom 274 299 5 0 0 0 - - -; #X obj 160 226 list-math *; #X msg 159 167 1 2 3 4 a b c , 10 20 30 x y z; #X text 144 93 Use as "list-math operator" where
operator is some binary
operator , that expr can understand , like + ,
- , * or /;
#X obj 406 373 print L; #X msg 406 308 1 2 3 4 a b c; #X floatatom 516 307 5 0 0 0 - - -; #X obj 132 31 cnv 15 140 30 empty empty list-math
20 12 0 14 -233017
-66577 0; #X text 292 40 simple mathematical operations on
lists.;
#X obj 404 230 list-math +; #X obj 164 332 list-math /; #X obj 406 340 list-math -; #X connect 1 0 9 0; #X connect 2 0 9 1; #X connect 4 0 17 0; #X connect 5 0 17 1; #X connect 7 0 18 0; #X connect 8 0 18 1; #X connect 9 0 0 0; #X connect 10 0 9 0; #X connect 13 0 19 0; #X connect 14 0 19 1; #X connect 17 0 3 0; #X connect 18 0 6 0; #X connect 19 0 12 0;
PD-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
-- Urs Liska Glümerstr. 5 D-79102 Freiburg
www.graft-music.com www.suono-mobile.de
[Pd 0.39.0, WinXP]
#N canvas 572 48 454 411 12;
#X obj 79 181 print A; #X obj 99 208 print B; #X obj 122 240 print C; #X obj 141 273 print D; #X msg 59 66 1 2 3 4 5 6 this is a six word phrase; #X obj 79 143 list-dist 4; #X msg 213 198 done; #X obj 215 229 print list; #X floatatom 163 102 5 0 0 0 - - -; #X text 20 12 list-dist; #X text 22 26 distributes a list over up to four outlets; #X text 214 102 change number of used outlets; #X text 179 136 creation argument:; #X text 202 151 number of used outlets; #X text 7 319 right outlet gives out a bang; #X text 7 303 After processing is complete the; #X text 7 345 If the number of used outlets exceeds 4; #X text 6 362 then the corresponding list members are dropped; #X connect 4 0 5 0; #X connect 5 0 0 0; #X connect 5 1 1 0; #X connect 5 2 2 0; #X connect 5 3 3 0; #X connect 5 4 6 0; #X connect 6 0 7 0; #X connect 8 0 5 1;
#N canvas 0 0 589 476 10;
#N canvas 0 0 545 419 drip 0; #X obj 64 206 list split 1; #X obj 64 123 until; #X obj 64 181 list append; #X obj 194 206 bang; #X text 146 90 First store list , then start the loop; #X text 163 118 "until" bangs its output until told to stop by a "bang" to its right inlet.; #X text 182 160 Store the remaining list.; #X text 239 205 third outlet of "split" tells us to stop.; #X obj 64 243 outlet; #X obj 64 57 inlet; #X obj 64 86 t b l; #X text 237 44 From list-help.pd; #X obj 155 244 outlet; #X connect 0 0 8 0; #X connect 0 1 2 1; #X connect 0 2 3 0; #X connect 0 2 12 0; #X connect 1 0 2 0; #X connect 2 0 0 0; #X connect 3 0 1 1; #X connect 9 0 10 0; #X connect 10 0 1 0; #X connect 10 1 2 1; #X restore 255 140 pd drip; #X obj 323 198 + 1; #X obj 255 169 t a b; #X obj 290 199 int; #X obj 255 88 t a b; #X msg 324 139 0; #X text 357 140 reset first; #X text 98 140 serialize the list; #X obj 244 396 outlet; #X obj 298 396 outlet; #X obj 352 396 outlet; #X obj 255 263 list prepend 0; #X obj 255 50 inlet; #X obj 255 298 route 0 1 2 3; #X obj 407 397 outlet; #X obj 290 226 mod $1; #X text 70 280 distribute to outlets; #X obj 378 49 inlet; #X obj 519 396 outlet; #X text 482 422 bang after list; #X text 253 25 list; #X text 376 25 number of outlets; #X text 6 1 abstraction list-dist; #X text 5 16 distributes a list over up to 4 outlets; #X text 22 440 based on some list abstractions by Frank Barknecht; #X connect 0 0 2 0; #X connect 0 1 18 0; #X connect 1 0 3 1; #X connect 2 0 11 0; #X connect 2 1 3 0; #X connect 3 0 1 0; #X connect 3 0 15 0; #X connect 4 0 0 0; #X connect 4 1 5 0; #X connect 5 0 3 1; #X connect 11 0 13 0; #X connect 12 0 4 0; #X connect 13 0 8 0; #X connect 13 1 9 0; #X connect 13 2 10 0; #X connect 13 3 14 0; #X connect 15 0 11 1; #X connect 17 0 15 1;
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-> -> --> ---> -----> --------> -------------> r3search + praktik EK5perimenz
___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com