How do you schedule Lightjams for a specific time and duration each day

97 views
Skip to first unread message

Doug W

unread,
Oct 29, 2019, 12:31:52 AM10/29/19
to Lightjams
I'm new to lightjams and have been playing with it for the last few days.
So far I'm very impressed with what it can do.

I'm seeing if i can use lightjams to run my christmas lights this year.
It's not one of those highly sophisticated displays.
I want to replace 4, 3 channel light organs that I've been using for a number of years with dmx.

I've been able to set up a 16 channel generic dimmer and have the lights synchronizing to the music
I am currently using the lightjam player and it works quite well.

My next question though is I want the lights and music to start at 5pm and shut off at 10pm
I've looked at the Date&Time tab but haven't been able to figure out how to set it.
Or maybe there is a better way to do?

Any help would be appreciated.

thanks
Doug

Mathieu

unread,
Oct 29, 2019, 10:13:19 AM10/29/19
to Lightjams
Hi,

The idea is to activate grids and groups based on your schedule. The 24/7 Scheduler sample project (https://www.lightjams.com/tutorial.html#projectsSection) shows how to do it on a hour by hour basis.

In your specific case, you could just control the master intensity slider with this formula:

time.isbetween(17,0, 22,0)

To do so, click on the master intensity slider and then click on the nuclear icon at the bottom to enter a formula. The time.isBetween function returns 100% when the current time is between the specified start and end times. To test your schedule without having to change your computer time, go in the view/configuration menu and then under the Date&time tab. Use the Test Helpers section to temporarily set the time and date.

Doug W

unread,
Nov 4, 2019, 11:31:46 PM11/4/19
to Lightjams
Thanks Mathieu.
It's now starting to make sense how to use the programming.
I do have another question.
I found the section on turning on the player and randomizing the song list but I can't figure out how you make it work.
(unfortunately you're dealing with someone whose formal education in programming was in fortan back in the late 70's where where you used a pencil to fill out the cards and then feed them into a card reader ).
Can the player be turned on and off at the same time? if so how?

thanks again

Doug

Mathieu

unread,
Nov 5, 2019, 8:36:55 AM11/5/19
to ligh...@googlegroups.com
Hi,

To stop the music player, you use a formula like:

if(onbeat(midi.note(1,39)), music.player.playing(0), 0)

That means when pressing the midi note 39, it pauses the music player. Replace the onbeat(midi.note(1,39)) part by what you want to trigger the pause.

To start again the music player, you could do something like:

if(onbeat(midi.note(1,40)), music.player.playing(1), 0)

You could even toggle the play/pause state by pressing the same button to toggle like this:

if(toggle(midi.note(1,39)), music.player.playing(1), music.player.playing(0)) 

or rewritten in a more declarative form:

music.player.playing(toggle(midi.note(1,39)))

Mathieu

unread,
Nov 5, 2019, 8:52:25 AM11/5/19
to ligh...@googlegroups.com
Knowing how to play/pause the music player (see the previous post), for your specific case, if you are using the formula time.isbetween(17,0, 22,0) to control the master intensity, you can do a clever thing and use that as the parameter for the music.player.playing function like this:

music.player.playing(time.isbetween(17,0, 22,0))

The music.player.playing function returns the playing state, so the result is still usable to control the master intensity. So with this short formula, you control the master intensity and the music player state.

Doug W

unread,
Nov 17, 2019, 12:23:11 AM11/17/19
to Lightjams
So I have the Player turning on and off at the preset times using:

music.player.playing(time.isbetween(17,0, 22,0))

I have also added the following to randomize the playlist:

if(onbeat(!music.player.playing), music.player.song(randint(0,music.player.nbsongs-1))&music.player.restart(), 0)

It also allows me to add new songs to the playlist without having to change any of the programming.

There is one more tweak I'm would like to add.

With the set time of 10PM for the shutdown, it will shutdown in the middle of the song. 
I want to get the current time and if the length of the next song plus the current time is greater than 10PM, pause the player so it won't get cut off in the middle of the song, otherwise keep playing songs.

Based on what you mentioned previously, I've been trying to figure out how to do the statement:

If ([get the current time]+music.player.songlength>[10PM {or probably 79,200?],music.player.playing(0), 0)

I see the variables for time.hour, time.minute and time.second, but I don't see one for just getting the complete computer time.

Other than that, I think I've got the last part of the for my lights together for this Christmas.
Thank you!
Doug

Mathieu

unread,
Nov 17, 2019, 4:40:18 PM11/17/19
to ligh...@googlegroups.com
The formula should look like:

if(seconds(time.hour,time.minute,time.second)+music.player.songlength > seconds(22,0,0), music.player.playing(0), 0)

Use the seconds function to calculate the total number of seconds for a given hours, minutes and seconds.

However, it might be more simple and elegant just to fade in/out both the master intensity and the music volume based on the schedule. Something like this:

music.player.playing(music.player.volume(fade.exp(20,time.isbetween(17,0, 22,0))))

This does a 20 seconds fade of the volume. Only when the volume is at 0% that the music player stops.

Seth Goldberg

unread,
Feb 27, 2020, 2:12:47 PM2/27/20
to Lightjams
What if I only want it to produce a lower value then 100% of the desired activaition? is there a way to include that in the formula ? 

Mathieu

unread,
Feb 27, 2020, 3:39:54 PM2/27/20
to Lightjams
Hi,

You can multiply the result. If you want 80%, you multiply by 0.8. In this case the formula becomes 

music.player.playing(time.isbetween(17,0, 22,0)) * 0.8
Reply all
Reply to author
Forward
0 new messages