Possible to grab index of pad on release?

Discuss Lemur and share techniques.
Post Reply
malkomalko
Newbie
Posts: 4
Joined: 26 Jan 2012 21:20

Possible to grab index of pad on release?

Post 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!
axel_liine
Liine Staff
Posts: 126
Joined: 14 Dec 2011 12:12

Re: Possible to grab index of pad on release?

Post 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.
Attachments
ReleaseDetection.jzlib.zip
(969 Bytes) Downloaded 112 times
malkomalko
Newbie
Posts: 4
Joined: 26 Jan 2012 21:20

Re: Possible to grab index of pad on release?

Post by malkomalko »

Excellent! This is very helpful. Thank you.
kraftf
Regular
Posts: 124
Joined: 14 Dec 2011 06:36

Re: Possible to grab index of pad on release?

Post 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?
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Possible to grab index of pad on release?

Post by Macciza »

Hi
Think of it as logic not comparison
psuedo-code
released = 1 if x lessthan last_state 0 otherwise


Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
axel_liine
Liine Staff
Posts: 126
Joined: 14 Dec 2011 12:12

Re: Possible to grab index of pad on release?

Post 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).
kraftf
Regular
Posts: 124
Joined: 14 Dec 2011 06:36

Re: Possible to grab index of pad on release?

Post 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.
Post Reply