Use a background Cue List as a non-repeating jukebox

159 views
Skip to first unread message

MattM

unread,
Feb 3, 2016, 11:31:07 PM2/3/16
to QLab
I've been looking for a way to keep a second workspace open in the background with a huge list of songs that I can invoke as needed during an event when "commercial breaks" come up.  In particular I'd like to be able to avoid repeating any songs in my list.

There are probably MUCH slicker ways to do this than what I've come up with, but this seems to work for my purposes.  Since I'm cribbing a lot of code others have contributed to the group, I thought I'd post mine as well.

First of all, the basic concept is that you have a secondary workspace named "Jukebox" (in my example) that's loaded up with however many tracks you'd like in your overall playlist.  The list isn't randomized or anything (although there are lots of ways to do that if you need it).  Rather, it starts at the top and plays down to the bottom.  Each time you stop the jukebox (e.g. when the event is "back from commercial"), a script will drop a flag on the last-played track.  The next time you resume the jukebox, the script will find the last flagged item in the list, and resume playing with the next track directly below that one.

Again, not super-slick but if you're only triggering this jukebox programmatically from MIDI or an outside controller, it does what it needs to do & you shouldn't ever hear the same song twice.

So -- the elements:

A. Create a workspace called "Jukebox" and fill its Main Cue List with as many audio cues as you wish.  Each should be set to "auto-follow."  If you forget while creating & need to batch-set them, run this script:

tell application id "com.figure53.qlab.3" to tell workspace "Jukebox"

set foundCues to every cue whose q type is "Audio"

set foundCuesRef to a reference to foundCues

repeat with eachCue in foundCuesRef

set continue mode of eachCue to auto_follow

end repeat

end tell


B. At the beginning of your event, especially if you've used this script before, trigger a script cue with the following.  This will clear all the flags in the playlist so you start fresh:

tell application id "com.figure53.qlab.3" to tell workspace "Jukebox"

set foundCues to every cue whose q type is "Audio"

set foundCuesRef to a reference to foundCues

repeat with eachCue in foundCuesRef

set flagged of eachCue to false

end repeat

end tell


The above code borrows some of the terminology & discussion about flagging cues in this thread.  

C. Next, to trigger the jukebox from your controller or main workspace, trigger a script cue containing the following code:

tell application id "com.figure53.qlab.3" to tell workspace "Jukebox"

tell (the first cue list whose q name is "Main Cue List")

try

set thecurrentcue to the (last cue whose flagged is true)

set thecurrentcue to cue after thecurrentcue

on error

set thecurrentcue to the (first cue whose q type is "Audio")

end try

set the playback position to thecurrentcue

start thecurrentcue

end tell

end tell


The "try" statement above checks to make sure there's at least ONE flagged cue in the Jukebox's Main Cue List.  If not, if will start over at the first Audio Cue in the List.

After the above steps, your jukebox will play on its merry way, moving from the first track down the list to the bottom.  

D. Now suppose you need to interrupt the playback for some reason & you don't want to resume on the previously playing track.  Trigger the jukebox to stop with the following:

tell application id "com.figure53.qlab.3" to tell workspace "Jukebox"

try

set currentTrack to second cue whose running = true

set currentTrackRef to a reference to currentTrack

on error

return -- no track playing; do nothing

end try

panic

set flagged of currentTrackRef to true

end tell


As before, the "try" statement ensures that a track is actually playing.  If not, the script exits.  Otherwise, it panics the workspace and flags the then-currently playing track.  Now, the next time you restart the jukebox using the "play" script above, it will find the last flagged track in the playlist and go from there.

I hope this is helpful!  It's not the cleanest solution to the problem, I'm sure, and it wins no awards for being slick, but it's lightweight code-wise and should work as a "black box" that you never have to look at for those times when you've got periodic breaks to fill & need to have a lot of music available at your fingertips.

Cheers,
Matt

Ken McD

unread,
Sep 24, 2017, 5:11:06 AM9/24/17
to QLab
Thanks so much Matt, this works Great!

Cheers,
Ken
Reply all
Reply to author
Forward
0 new messages