General

Possible to grab index of pad on release?

Started by malkomalko on .

Sign in or create an account to join the conversation.

7 posts

Topic starter
Hi there,

I know you can get the index value of a pad by firstof(SynthPad1.x), but this only seems to work when ascending x (key down) and it always returns the same value on descending x (key up).

Thanks!
axel_liine wrote:You could use a script that saves the last known state of a Pads object to a variable. The last known state can be compared to the new state whenever Pads.x change.
Try the module attached.
Could you please explain the follwing line in your code:
released = x < last_state;
How does this declaration/comparison works?
kraftf wrote:
axel_liine wrote:You could use a script that saves the last known state of a Pads object to a variable. The last known state can be compared to the new state whenever Pads.x change.
Try the module attached.
Could you please explain the follwing line in your code:
released = x < last_state;
How does this declaration/comparison works?
Anytime you use a comparison operator, the returned value is '1' id the comparison is true, and '0' otherwise. When comparing two arrays of the same length, the returned value is an array itself, containing the result of the comparison item by item.
So here, 'released' will contain ones for each pad whose new 'x' value is inferior than the last (i.e released), and zeroes otherwise (i.e unchanged or pressed).