Formula to move a source forward every Xth beat

126 views
Skip to first unread message

Mathieu

unread,
Oct 5, 2025, 6:48:57 PMOct 5
to Lightjams
Here's a handy formula to move a source forward on every Xth beat. 

let( beatDivisor, 4, // move forward every Xth beat
signal, music.1.beat, // the input for the beat detection, like an audio band
xtopercent(floor(counter( 0,
(grid.lastx+1)*beatDivisor-1,
onbeat(trigger(signal,0,10,30,0.2)), // clean the signal with the trigger and detect beats
0,
grid.onactivated // reset the counter when the grid is activated
)/beatdivisor)))

Use this formula for the X slider of a source. Replace the music.1.beat by your signal.

Jeff Drees

unread,
Oct 18, 2025, 11:08:26 AMOct 18
to Lightjams
Hey Matt and all, 

I am long time user of lightjams. I read all of the posts here, thanks to everyone using lightjams and solving problems together. Thank you Matt for always coming through with solutions. 

This brings up a common issue I have. How would I fade this function between steps? I know I could use the grid fade feature but I want to be able to change the fade on the fly, ideally connecting it to my global fade sliders that are connected to midi controls. Is there a way to use the fade function on the grid activation and have the formula for the x moving reset the grid with each step? I am specifically trying to fade hue. 

I think one solution, that I see you suggest often, would be to have each set of hue attributes in their own grid and create attribute and then make a sequencer by moving a source along the x axis. Then each activation slider for each separate grid would be connected to my global fader slider. Would that be the same issue I am having now? 

One solution I see would be a new feature. My idea is to make the grid fade feature at the top of each grid more like the other features of lightjams. Have it able to controlled by a formula, midi, etc. I know that would be a fair bit of coding and a lot of debugging though.  

Thanks, 
Jeffrey Drees 

Here are some examples of how I use lightjams if anyone is interested. 

Mathieu

unread,
Oct 18, 2025, 11:49:14 AMOct 18
to Lightjams

Hi Jeff,

You can set the fade in and out time of a grid with a formula by using the grid.fadeintime(time) and grid.fadeouttime(time) functions. This way, you can use the value of a midi control to set the fade times. You need to use these functions in a source that is on the grid you want to control.

Let me know if this is what you were looking for.

Daniel Profir

unread,
Oct 26, 2025, 10:28:38 AMOct 26
to Lightjams
Hi all,
I’m new user of Lightjams and I try to learn how to use this complex program. This forum helped me a lot to start to make the lights ‘dancing’.  I done some testing projects. I appreciate some suggestions, critics too. 
I uploaded few samples on YouTube and few people view them. I don’t know how many supposed to be (in 4 days was 3.9k). Also this is first time when I use YouTube. 


Please let me know your thoughts. And I am sure I will have a lot of questions to ask in the future.

Have a nice day/night :)
Daniel  

Mathieu

unread,
Oct 27, 2025, 9:25:37 AMOct 27
to Lightjams
Hi Daniel,

You are really good actually! It's pretty entertaining to watch.

Daniel Profir

unread,
Oct 29, 2025, 3:47:47 AMOct 29
to Lightjams
IMG_9947.png
Thank you. 
It looks like people are interested in this. 


Lennart Schiesswohl

unread,
Dec 15, 2025, 1:55:13 PMDec 15
to Lightjams
Hey Matt and everyone,

Thanks for that input, really helps a lot!

I'm new to Lightjams and currently exploring it's capabilities for a future project. I'm already really enjoying the customization and flexibility it offers.
Thank you for creating such a versatile piece of software!

Now to my question: I can imagine this might have already been answered; I’ve searched the forum and the command-line information but didn’t find anything.

I understand that this formula allows me to move a source every Xth beat. What I want to do is create a 16-step sequencer where each step can either be turned on or off, or have a specific effect applied from a pool of available effects.

For example, I have 6 effects for Fixture type 1, 6 effects for Fixture type 2, and so on. I want to be able to:

  1. Press a button on my MIDI controller to select an effect.

  2. Choose which steps the effect should apply to.

  3. Let the sequencer move through every Xth beat, but only trigger the steps that have been turned on and have that effect assigned.

  4. Using different effects from multiple fixture groups on the same sequencer could get a bit cluttered, so the idea is to create separate rows for each fixture group that the sequencer moves through simultaneously.

    All of these rows would also be represented on the MIDI controller, with LED feedback showing which steps have been toggled on.

Is this possible? I’ve been trying to figure it out but got stuck. Maybe you could point me in the right direction.

Thanks already and best regards,

Lennart

Mathieu

unread,
Dec 15, 2025, 3:23:30 PMDec 15
to Lightjams
Hi,

Creating a sequencer where each step can be enabled via MIDI is possible but can get a bit complex. Here's a sample project showing how to toggle the activation of each column of the sequencer by pressing the MIDI notes from 1 to 16 on channel 1. The activation state of each column is also saved into the project file since the source last value is saved.

The formula for the source that is computing what column of the sequencer to activate looks like:

xtopercent(

let( beatDivisor, 4, // move forward every Xth beat
signal, pulse(0.5), // the input for the beat detection, like an audio band

let( lookAt,
floor(counter( 0,
(grid.lastx+1)*beatDivisor-1,
onbeat(trigger(signal,0,10,30,0.2)) // clean the signal with the trigger and detect beats
| grid.powerat(x,0)==0, // skip disabled steps

0,
grid.onactivated // reset the counter when the grid is activated
)/beatdivisor),

// update the memory only when the step is enabled
if(grid.powerat(lookAt,0)>0, mem(0, lookAt), lookAt)
)
)
)

For testing purpose, I'm using a pulse(0.5) signal. Replace it by the audio if you want.

You need to put the attributes corresponding to the effects on the grid. I don't see a way to do this only via MIDI.
sequencer with midi toggle for steps.ljp
Reply all
Reply to author
Forward
0 new messages