[PD] Forcing Y value

Chuckk Hubbard badmuthahubbard at gmail.com
Fri Aug 26 10:35:51 CEST 2005


I am creating a sequencer so that I can drag notes.  I have it so when
I drag the dummy array attached to a top-level template, pd adds the
changing x and y values of the array to those of the top-level and
zeroes those of the array.  Using metro, the whole structure just
moves around freely, which is perfect.  The array is never touched,
duration is set from the top-level structure.

My next step is to constrain possible values of Y.  The possible
values will be stored in a separate data structure as X values (each
with an array of related info), so they can be sorted automatically. 
I want the Y value of the top-level template to reference the X values
of the pitch collection as it changes, drawnumber some of the data
stored in the arrays in the pitch collection, and finally be forced to
the closest allowed value.  I'm sure some odd combination of set, get,
and metro will allow this forcing, but what I don't know is how to
have Y recognize the closest allowed value from the separate data
structure.  I can't calculate the difference from every allowed pitch
to Y with each movement of Y, my system would crash.

Maybe it could just start at Y's current value and search
simultaneously up and down?
Is there some Pd object for "closest member of x to n?"

Thanks.
Chuckk



-- 
"It is not when truth is dirty, but when it is shallow, that the lover
of knowledge is reluctant to step into its waters."
-Friedrich Nietzsche, "Thus Spoke Zarathustra"




More information about the Pd-list mailing list