HOT KEYS ‘n’ OSC

[Updated for QLab 4.1 16 JUL 17 ]

One of the great things about QLab, is that you can extend it’s capabilities beyond those included in the program.  For instance  QLab 3 only allows you to select looping on one audio file at a time, using the checkbox  in the Time and Loops tab of the inspector. But what if you frequently have large numbers of cues you want to set to loop. It is possible to create a cue that will perform a batch, set loop, on all cues that are selected. Prior to version 3 of QLab the only way to do this was with the script cue. But now you can also use OSC (Open Sound Control)

In QLab 4 some cue parameters can be set on multiple cues, e.g LOOP,  but the hotkey method is still useful, as you don’t have to be in the correct tab of the inspector to use them. You can use similar OSC cues on hotkeys to control a huge range of parameters in QLab. The OSC dictionary for QLab 4  can be found here

 

How It Works: In QLab OSC is often used to communicate with other pieces of equipment, e.g you could send OSC commands across a network to a lighting board, but you can also send OSC to QLab itself.

By default, in  QLab,  the settings for OSC default to Patch 1 being a ‘loopback’, i.e the OSC is sent to the Mac QLab is running on, which has a special address, ‘localhost’, and to the port number which QLab listens for  OSC  on, port 53000.

Localhost

The OSC commands that QLab recognises are set out in a document called the QLab OSC API.

All the commands in the API are custom commands, so to set up a hotkey to set the selected cue to loop we would do the following:

Create an OSC cue and set the message type in the settings tab of the cue inspector to ‘custom OSC message’

You now have a box at the bottom of that tab to type your OSC command. In our loop selected example we would type:

/cue/selected/infiniteLoop 1

to switch the loop on or:

/cue/selected/infiniteLoop 0

to switch the loop off.

IMPORTANT: OSC is case sensitive, so you must enter OSC with the capital letters in the correct place. If you are typing an OSC string from memory then the general rule is, all letters are lower case except the first letter of any words that are joined to another without a space, like ‘infiniteLoop’ where only the ‘L’ is capitalised .

Here’s a screenshot of our OSC cue that will switch selected cues’ loops on:

LoopOSC

Of course, if we play this cue nothing will happen, because the only cue selected would be the OSC cue itself. So what we need to be able to do is trigger the OSC cue, while we have a bunch of other cues selected. To do this we assign a Hot Key Trigger to the OSC cue, in the basics tab of the cue inspector. ‘L’ is generally already in use, as a shortcut  for the built in command LOAD, so we might use shift-L  If we have a remote that sends MIDI we could also set a MIDI trigger to fire the cue. I’ve set it to MIDI note 60 on with any velocity.

OSC Triggers

We can now select all those cues  we want to switch the loop mode to  on, and hit our shift-L Hot Key Trigger.

The attached workspace contains many useful OSC commands that will work in this way. You can copy and paste any OSC command you might find useful into your own workspaces. Generally, its best to keep all your Hot Key cues together in a separate cue list. Remember though,  batch commands are potentially dangerous, particularly when they can be triggered by simple key presses. It is good practice to disarm lists with hotkeys when you are not programming (unless they are specific hotkeys designed for an operator to use in a show).

Here’s whats included in the example workspace:

OSC Hotkeys

You can download the workspace here.

You can combine these in fire all groups. e.g to  set selected cues to NO LOOP and HOLD LAST FRAME you would put the OSC cues for these functions into a fire all group. You will need to clear the triggers for the individual cues and create a new unique trigger for the group cue as in this example:

LOOP and Hold

Comparison with Applescript

If you are interested, here is how the LOOP ON  could have been achieved in a script cue.

tell application id “com.figure53.qlab.3” to tell front workspace
repeat with eachCue in (selected of front workspace as list)
set infinite loop of eachCue to true
end repeat
end tell

That’s a lot more complicated, but OSC has one other advantage. If you send an OSC command to a cue that doesn’t understand it, then it just politely, and without any drama ignores it.  If you do the same with an applescript cue, it has a nervous breakdown, cries in the corner and decompiles itself. So you have to put even more code into the applescript to test what sort of cue it is working with.  Some proper programmers like this sort of thing, me, I’ll use an OSC cue where it will achieve the same end!

OSC within QLab3 is a bit of a one trick pony though, as a cue can’t modify  it’s custom message, depending  on what’s going on in the rest of the program.

In QLab4 OSC cues can get values from other cues using queries. This is described in detail in the final section of this chapter space-hijack

So script cues are in QLab3 the best way of achieving anything more complex than setting one thing to an absolute value and in QLab4 they are still very useful. For instance, (and as a reward for reading this far, if you didn’t know this already, here is the most useful applescript in the universe, based on original scripts by Chris Ashworth, Rich Walsh and Jeremy Lee). If you have an audio cue, you will probably at some stage want to fade it out. Put this script on a hotkey like cntrl-F, select your audio cue,  trigger it, and a fade cue will magically appear below it.

set userDuration to 10 — Edit Duration of Fade here
tell application id “com.figure53.qlab.3” to tell front workspace
set originalCue to last item of (selected as list)
set originalCueType to q type of originalCue
if originalCueType is in {“Audio”} then
make type “Fade”
set newCue to last item of (selected as list)
set cue target of newCue to originalCue
set duration of newCue to userDuration
newCue setLevel row 0 column 0 db -120
set stop target when done of newCue to true
set q name of newCue to “Fade out and Stop: ” & q list name of originalCue
end if
end tell

 

MenuGraphic