[PD] basic data structures!

matthew jones m.jones at signal.qinetiq.com
Fri Feb 6 11:42:01 CET 2004


one whole side of pd I have overlooked is the use of data structures and
templates within pd.  now it seems like I should learn these basics though I
have to admit I have some difficulties in understanding how a lot of that
stuff is used.

say I want to keep a list of the last 6 midi notes that are pressed (and
still pressed).  when one is released, I want to remove this pitch number
from the list, and shift the list along, filling in empties with zeroes.
How I used to do this was with something like:

[l] <- list from zexy
|
[unpack f f]
|              |
[== n]   [== n]
|              |
[moses 0] [moses 0] <- If larger than zero, put FIRST element into pack (2nd
inlet) and zero into 1st
        |
        |if larger than zero, put SECOND element into pack (2nd inlet)
        |
[pack 0 0]
|
send back to list up top

(I bet this is unclear, but is quite basic so hope you can follow me)
Is there a better way than this??! I'm sure there must be.  I mean, I've
shown this for the case of a 2-element list, but probably want six or more,
and will start to look unecessarily complicated when having to deal with
each element match as a separate case....

matt

-=-=-=-=-=-=-=-=-=-=-=-=-
http://www.loopit.org/
-=-=-=-=-=-=-=-=-=-=-=-=-





More information about the Pd-list mailing list