Radio-button (mutually exclusive) selector with "momentary mode"

22 views
Skip to first unread message

Alex Sinclair

unread,
Mar 19, 2025, 11:32:08 AMMar 19
to Lightjams
Hi there LJ community,

I'm trying to figure out how to add a "momentary mode" to the radio-button grid-activation select grid.

Background
I'm using a bunch of momentary buttons in TouchOSC to allow the user to select 1-of-25 grids and OFF (which is just another grid actually)
The grids happen to be controlling a laser, but could be any kind of preset scene/palette/effect etc. where you only want 1 in a selection group to be active.

I've used a pattern I've seen on here (and been recommended by Mathieu previously)
Each "effect" grid is activated exclusively by the position of the emitter shown below.
using y=scale(osc.latest(159,184),159,184,0,100) 

The TouchOSC momentary buttons are at address /lj/osc/159 through 184

Currently, the action of this control-grid (and momentary OSC inputs) is to "latch" the grid-activation emitter in a given position.

Challenge
I would like to have an option to toggle the mode of the radio-button matrix from a latching control to a momentary control that will reset to the y=0 position when the momentary button transitions from sending a 1 to zero.
 
I've tried adding an emitter to osc.send(159,pulse(0.1)) to keep pulsing the "OFF" OSC channel, but this doesn't work.

I don't understand the logic of the osc.latest command to make it detect the falling signal from the button (0--->1) and set y=0

Please can you suggest any edits.  

I suspect I could do something smarter in TouchOSC with some lua script, but I don't have any lua script syntax experience and regardless, for other applications, I'd likelt o keep the logic in LJ and treat TouchOSC as a relatively dump button & fader device, with state feedback to the user.


Many thanks
Alex
Screenshot_Laser_Pager.png
screenshot_Laser231_EffectGridSelect02.png

Mathieu

unread,
Mar 19, 2025, 4:21:53 PMMar 19
to Lightjams
Hi,

The osc.latest function gives you the index of the most recent osc channel having received a positive value. So in your case, the selected button in TouchOSC. The osc(channel) function gives you the value of a channel. It will be 0 when unpressed and 100 when pressed. Knowing that this formula will return 0 when the value of the selected channel is 0 and otherwise, it will return the y position as in your original formula:

let( selected, osc.latest(159,184),
if(osc(selected)>0, scale(selected,159,184,0,100), 0)
)

Alex Sinclair

unread,
Mar 19, 2025, 4:44:46 PMMar 19
to Lightjams
Ahh, of course!! returns the "index" of the channel. Got it.

Nice example/use/promotion of the new "let" function :-)
Thanks Mathieu

I need to upgrade to Pro now, I'm using more than 512 channels (or at least I will be once I have the TouchOSC feedback working (see https://groups.google.com/g/lightjams/c/vFOHZxpzCkA)
Cheers
Alex
Reply all
Reply to author
Forward
0 new messages