lyricsSocket Events

Hey @leolabs , thanks for all of the continued work on Ableset. In the console, I see events that occur when a lyrics line has changed:

Is there any way that event could be emited from lyricsSocket? I know I could write my own logic through ableton-js but since you’ve already done the heavy lifting, it would make my life so much easier! :slight_smile:

One other quick question. With that clip’s live_id, can I make a direct set() call to the arrangement clip with ableton-js? Or would I still have to iterate through all of the arrangment clips and match the clip id?

Hey @RichardB,

Since different browsers might display different lyrics tracks, AbleSet doesn’t do any line matching on the server side and thus can’t emit events about it through the socket.

The logic for it is fairly simple though if you’re not using time or beat delays:

const currentLine = lyrics.find(
  // Add the 0.01 buffer to account for inaccuracies in playhead position
  (l) => l.start <= currentTime + 0.01 && l.end >= currentTime - 0.01,
);

Unfortunately, you can’t use the id field of a line to directly access the clip in your plugin. Your ableton-js script needs to cache it first to build a reference from the ID to the actual clip object, so you’d have to request a list of all arrangement clips first and find the matching clip yourself.

I hope this helps!

Thanks for the reply. I had wondered if the socket could emit the track name with current line info but no worries. I’ll proceed with my own code.

1 Like