Feature Request - OS2L Support

64 views
Skip to first unread message

Blender Renderer

unread,
May 21, 2024, 5:53:06 PMMay 21
to Lightjams
Really enjoying Lightjams so far, it's very unique approach to programming and sound reactive features make it a pleasure to work with and the fact I can delve into the lower level functions allows for some really creative and complex potential to be unlocked. 

I would really like to use LJ instead of SoundSwitch in DJ sets since it seems more stable and in my opinion more fun and creative. The only issue is that it lacks the key feature SoundSwitch has been capitalizing on, the ability to interface with DJ software so that we can tie lighting cues to specific timestamps on specific tracks and the DJ can mix them as they please (essentially a track-aware version of timecoding)

I can get this functionality in a DAW using MIDI messages, but there's no way to have those stored with the track and sent from a modern DJ application. Same goes for the Lightjams Music player, it's close to what I'm looking for, but not quite.

Recently I noticed Virtual DJ started implementing this functionality using OS2L (Open Sound to Light) and various lighting applications (QLC+, WMX, MagicQ) have begun to support it. If LJ were to add support for this it would have the ultimate trifecta of sound reactivity, manual triggers (via midi/osc), and track-aware timecode (os2l) unlocking countless possibilities for DJs.

It could probably be handled in a similar way to MIDI/OSC in LJ.

The protocol seems pretty simple with 4 JSON messages: 
More info on how it's used in Virtual DJ, mainly interested in the last guide "Creating Lightshows Per Track w/OS2L"

Thanks for taking time to read, curious to know your thoughts!

Mathieu

unread,
May 21, 2024, 9:00:56 PMMay 21
to Lightjams
Hi,

Yes, that sounds interesting. I guess the cmd and beat messages would be the interesting ones? The btn message doesn't fit as much in LJ as you'd need to map it to an id (integer) in order to use the on and off value.

Mathieu

unread,
May 21, 2024, 9:21:08 PMMay 21
to Lightjams
As Virtual DJ supports Ableton link (like LJ), I guess the beat messages are a bit useless as the beat info from Ableton link is a bit more complete.

Blender Renderer

unread,
May 21, 2024, 9:48:35 PMMay 21
to Lightjams
Very true, I was super excited to see Link support in the last release! I'm mainly interested in the first 2, the btn and cmd messages.

The cmd message is probably the most useful and straightforward to use and implement in LJ since it's already mapped to integers...

The primary benefit of the btn messages is to trigger effects by name, so once we set up an effect in LJ we don't have to remember a corresponding integer id, rather use a more memorable effect name. I could see this being implemented in one of two ways: 

1) As you mentioned we could map the name to an id in LJ like we do OSC,  where "on" would be 100% and "off" 0%
2) If we want to avoid the extra step of having the user mapping these, I would imagine the btn message would most likely be used to trigger effects by activating grids/groups... so we could have it implemented such that it would just search for a grid/group with the same name as the message and if it exists turn the activation to 100% or 0% based on the on/off.

Blender Renderer

unread,
May 21, 2024, 9:52:20 PMMay 21
to Lightjams
2) Or even better the group/grid Attribute @id...

Mathieu

unread,
May 23, 2024, 4:41:51 PMMay 23
to Lightjams
I've been playing with VirtualDJ and so far so good. OS2L feels so close to OSC that what I've done is to route the messages to the OSC input in order to get the full capabilities of the OSC input without duplicating everything. It's also handy when you support both OSC and OS2L inputs in your project as you can control the same parameters with the two methods. You can also see the OS2L messages in the OSC input monitor.

By doing so, I've also added more features to the OSC input. You can now control the global sliders, the activation and speed sliders of the grids/groups with an attribute id. That means you can also do that with OS2L. See the screenshot below with the OS2L commands.

And there's also an addition to OSC to provide the formula for the slider. So when targeting a slider directly, you can provide a number or a string that will be put as the slider formula. So you can activate a grid with a fade in by using "fadein(5, 100)" for example. 

For OS2L and the btn command, there's a page string parameter that has no meaning in LJ but it kind of makes sense to use it to contain the formula text. And since it can contain text, that means you can do more than the 'on' and 'off' state value and provide a decimal number like "10.53" and LJ will use it correctly.

So at this point in VirtualDJ, I have cues like this:
os2l_button "50.5" "/lj/activations/fx01"     -> set the fx01 activation slider to 50.5%
os2l_button "sin(2)" "/lj/activations/fx02" -> turn on and off the fx02 with a sinus wave
os2l_cmd 10 50.4%   -> set the OSC channel 10 to 50.4%
etc.

I'll continue exploring but it's pretty fun at this point!

os2l.png

Mathieu

unread,
May 24, 2024, 4:15:00 PMMay 24
to Lightjams
New beta version with OS2L: https://www.lightjams.com/history.html

In Lightjams, you enabled OS2L in the view/configuration menu. I've put the doc directly there. Open the OSC input monitor to see the incoming messages from VDJ.

os2l.png

In VirtualDJ, the options should look like this:

vdj-os2lpng.png

Blender Renderer

unread,
May 25, 2024, 11:07:33 PMMay 25
to Lightjams
Wow that was fast! Thank you so much for implementing this,  been testing it out and so far it's working great! (◕‿◕)♡ Really love your clever use of the "page" parameter to pass formulas into Lightjams, that was quite genius of you! Makes me wonder if there's potential in being able to pass/store formulas in the individual OSC channels... but maybe that's a bit too far xD.

Noticed that the btn messages in Virtual DJ have to be labeled as "os2l_button" not "os2l_btn," idk if that's worth noting in the documentation.

During testing I also started trying to use Ableton Link to relay the beat data from Virtual DJ to Lightjams and unfortunately that proved to be rather finicky... it worked for a short bit, but then started giving me no end of issues. I think the problem stems from Link attempting to be a bi-directional sync... I managed to get it to set the BPM in Lightjams for one song, but then it decided to start working in the wrong direction, using the BPM in Lightjams to set the tempo in Virtual DJ. Now when I activate Link in both programs, it consistently goes in the wrong direction, LJ sets Virtual DJs tempo to the default 120 BPM and won't let me change the tempo in Virtual DJ so long as Link is active. xP

I've used a lot of Link enabled programs in the past and often times they fail to function the way Ableton envisioned... especially when it comes to DJ software. Really unfortunate, since if it worked as well as it was initially advertised, it appears to have a lot of potential.

Anyways...really sorry to bother you to do this, but would you be willing to support full OS2L and include the beat cmd as a Link alternative?  Hopefully it is more stable than Link for this use case and won't suffer from bi-directionality.

Thanks again! ♡

Mathieu

unread,
May 26, 2024, 9:02:33 AMMay 26
to Lightjams
Hi,

For AbletonLink, why do you set the beat from Lightjams? By default LJ doesn't try to set the BPM, so I guess you're using the function abletonLink.tempo(bpm) or other functions that take a parameter?

If you do so, you need to use the if function along with those (most of the time) otherwise LJ will keep setting the tempo. So if you want to set the tempo once, use: if(some condition,  abletonLink.tempo(bpm), 0)

I'll correct the mention of os2l_btn -> os2l_button.

Blender Renderer

unread,
May 26, 2024, 11:29:17 AMMay 26
to Lightjams
So a bit of an update on the Link issue... seems I'm getting an extra peer now. I tried rebooting my computer and then launching only Virtual DJ and Lightjams but they still seem to find 2 peers as if an unknown 3rd application is running and sending Link data, and that app is forcing them both to 120 BPM. This makes it impossible for me to use Link unless I can find that other peer.

Albeit I don't really think this is an issue with Lightjams necessarily (in fact it probably isn't since it occurs without even running LJ)....more of an issue with Link in general, how it's hard to tell what apps are sending/receiving link data etc... 

Video of the Issue:

Blender Renderer

unread,
May 26, 2024, 11:50:06 AMMay 26
to Lightjams
Update:
So it's definitely an issue with VDJ Link implementation... when I close VDJ the Peers count drops from 2 to 0. Have contacted them regarding this. Hopefully they can fix this issue b/c currently it makes using Link in their software unusable.

Not the first time experiencing issues with Link implementation in DJ software... think I had issues with it in Serato awhile back. Partly why I'd be interested in an alternative BPM sync protocol that hopefully just works as intended.

Mathieu

unread,
May 26, 2024, 11:54:32 AMMay 26
to Lightjams
Hi,

It seems to be working but might be due to each deck being a peer. 120 is the default BPM for the link session. So at first, when you activate link in VDJ by cliking on the Ableton link effect, it goes to 120. Then when I adjust the BPM in VDJ, everything works as expected and LJ is updated (see the screenshot below).

But I think each deck or something in VDJ can be a peer.

abletonlink.png

Mathieu

unread,
May 26, 2024, 11:58:27 AMMay 26
to Lightjams
Here I have the AbletonLink effect on the two decks and I now see 2 peers. If one deck isn't playing, it can't change the tempo. But once it's playing, it can change the tempo of the Link session.

abletonlink.png

Blender Renderer

unread,
May 26, 2024, 12:26:39 PMMay 26
to Lightjams
Aha, that's a good point! The issue seems to stem from the fact that turning off the Ableton Link effect on a deck fails to actually disable the peer correctly. In fact, once activated on a deck the Link cannot be disabled at all... regardless of  if you toggle the effect on/off, restart VDJ, uninstall the effect, restart your computer, etc... the only way to disable the Link is to uninstall and reinstall VDJ entirely as far as I can tell.

Mathieu

unread,
May 26, 2024, 3:18:19 PMMay 26
to Lightjams
I've updated the beta version (now 698) to optionally process the beat messages and route them to the OSC input. 

There are two OSC messages: 
/os2l/beat: received at each beat and giving you the beat position
/os2l/bpm: the BPM

Open the attached project file to get the OSC mapping. 

One thing to note is that you won't receive any os2l beat messages until at least one button or cmd messages has been sent. VDJ then sends one beat message at each beat.

os2l osc mapping.ljp
Reply all
Reply to author
Forward
0 new messages