Detect inactivity

Discuss Lemur and share techniques.

Detect inactivity

Postby robflate » 11 Dec 2017 12:58

Hi,

I have a 4 by 4 pad where each button in the pad triggers a midi note. I'd now like to detect inactivity and do one of the following;

1. If none of the pad buttons are touched, a timer starts. If the timer reaches 30 seconds then a midi note is sent out (note 100).
2. If any of the pads are touched then the timer is reset and a midi note is sent out (note 101).

Any help appreciated. Thanks.
robflate
Newbie
 
Posts: 4
Joined: 10 Nov 2014 01:20

Re: Detect inactivity

Postby oldgearguy » 15 Dec 2017 16:12

I've used the MIDI/Sequencer clocks as timers.
You can use clock_start(), clock_stop(), and have scripts trigger "on clock"

Very roughly:

you can choose a tempo and note subdivision and then each time it is reached, your on clock script is called. Keep a global counter in it and when the required number of ticks/calls have been made, send out your message and reset the counter to 0.
oldgearguy
Regular
 
Posts: 315
Joined: 02 Nov 2013 11:19


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron