Page 1 of 1

Possible to grab index of pad on release?

Posted: 26 Jan 2012 21:21
by malkomalko
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!

Re: Possible to grab index of pad on release?

Posted: 26 Jan 2012 22:54
by axel_liine
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.

Re: Possible to grab index of pad on release?

Posted: 26 Jan 2012 23:07
by malkomalko
Excellent! This is very helpful. Thank you.

Re: Possible to grab index of pad on release?

Posted: 31 Jan 2012 00:16
by kraftf
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?

Re: Possible to grab index of pad on release?

Posted: 31 Jan 2012 01:55
by Macciza
Hi
Think of it as logic not comparison
psuedo-code
released = 1 if x lessthan last_state 0 otherwise


Cheers
MM

Re: Possible to grab index of pad on release?

Posted: 31 Jan 2012 08:58
by axel_liine
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).

Re: Possible to grab index of pad on release?

Posted: 31 Jan 2012 14:51
by kraftf
Thanks for the reply Axel, you've been really helpful.
I have to get to work to clarify some logics of Lemur.
Some things are not so imminent how they work.