Lemur 2

Here’s another project using Lemur by liine.

If you are not familiar with using Lemur with QLab, basic setup information is included in the first Lemur chapter in the cookbook.

This project uses Lemur to synchronize a fader bank on the iPad with the sliders in the selected cue in QLab. It also displays the cue number and name of the current cue. It exploits one of the advantages Lemur has over some other OSC apps; its internal clocks. We’ll use this feature to manage the synchronization with QLab.

While the example uses an iPad, Lemur is also available for Android. Any device capable of running Lemur will work. Because of the great variety of Android devices available, we are unfortunately unable to even guess about the compatibility of specific devices.

Here’s the example workspace in action, best viewed full screen:

In case you’re not already familiar with Lemur, you can find its manual and tutorial videos here.

Here is the QLab workspace we are going to control:

Lemur 2 QLab workspace

The main cue list contains three cues in a Group cue set to “start all children simultaneously” and a second cue list that contains all the utility cues which enable the clever Lemur integration.

Each of the Audio cues is an eight-channel WAV file containing repeated notes played on a single instrument. Each of eight notes of the C major scale, C-C, are on separate tracks.

Connecting your Mac to Lemur

Open Lemur Editor on the Mac and Lemur on your tablet.

Lemur Editor

Open a new document in Lemur Editor and set the document size to iPad (or the size of your device) using the pop up menu in the top right of the editor window

Click the play arrow in the top right to get a list of available devices running Lemur

Lemur connection

Select the device you want to sync to and connect. Then, click on the Lemur sync icon (circular arrows, right next to the connect button) in the top right.

You are now synchronized.

Connecting Lemur to QLab

In Lemur, tap on the gear menu to get to settings:

Lemur settings

Under OSC targets, connect OSC 0 to your Mac by typing its IP address into the Host field and typing “53000” into the Port field. 53000 is the port number that QLab uses for incoming OSC messages.

Now tap Done.

Creating Faders in Lemur

First, we will create nine faders, eight for cue outputs 1 through 8 and one for the master level, and set them up to control the level sliders of the selected cue in QLab.

In Lemur Editor on the Mac, drag a Fader object from the panel on the right side of the Lemur window. To keep things simple, we’ll give the faders in Lemur the same numbers as the QLab sliders that they’re going to control. With the new fader selected, look to the Properties tab of the Objects panel in the lower left of the Lemur Editor window. There, change the name of the fader to “Fader0”.

In the Mapping panel at top left of the Lemur Editor window, check the box labeled Custom Address and set the address to:


That message corresponds to the master fader of the currently selected cue in QLab.

Check the box labeled Scale and enter -60 in the first box, and 12 in the second. These set the minimum and maximum values for the Fader.

-60 is the default minimum audio level in QLab. If you’re using a different minimum level, which you can configure in Workspace Settings → Audio, you’ll want to replace any reference to -60 with whatever minimum level you’ve set.

When you’re done, the Lemur Editor window should look like this:

Fader 0

To label the fader, drag a Monitor object underneath the fader. Then, with the Monitor selected, type “M” into the Name field in the Properties tab of the Objects panel in the bottom left corner of the Lemur Editor window.

To direct the Monitor object to display values from Fader 0, check the box marked value= and enter range(Fader0.x,-60,12). This tells Lemur to look at Fader0, grab its current level (represented by x), and scale that value to a range of -60 to +12.

Set Units to “dB”, set Precision to “1”, and set Font to “16pt”.

We can now copy and paste the fader object and monitor object eight times to make a total of nine faders.

We need to edit the name and custom address for each of these faders so that they each correspond to the appropriate slider in QLab. So, for example, we’ll name the first copy “Fader1” and set its custom address to /cue/selected/sliderLevel/1

We also need to edit the fader’s monitor object name and value to match the Fader name. Lemur objects’ names cannot begin with a digit, so we’ll use “F1” for the first copy’s name. The range gets set to range(Fader1.x,-60,12).

Continue this incremental process for faders 2 through 8.

Nine faders

We can now test the Lemur remote by selecting an Audio cue in QLab and moving a fader in Lemur. If the corresponding slider in the Audio Levels tab of the inspector moves accordingly, then we’ve set things up correctly.

Text Fields for Current Cues

It’s nice to be able to see the cue number and name of the selected cue right in Lemur. To facilitate this, drag two Text objects into the main area of the Lemur Editor window and name them “TextQ” and “TextT”.

Select the “TextQ” object in the Project panel and click the script icon at the bottom of the panel. Name the script “setcontent(OSC_ARGS)“.

Set the Execution of the script in the script pane to “On OSC”

Then, enter the following script:

setattribute(TextQ, 'content', OSC_ARGS);

This tells Lemur to set the contents of the Text object named “TextQ” to the value of the OSC arguments every time the message /TextQ/setcontent is received. Later on, we’ll set up QLab to send that message with the appropriate arguments.

OSC messages are composed of an “address” with optional “arguments”. The address is the part of the message that contains slashes, and the arguments are the part of the message that come after that. So the message /message/in a bottle consists of the address “/message/in” with two arguments: “a” and “bottle”.

Create another script for the “TextT” object, also named “setcontent(OSCARGS)”, with _Execution also set to “On OSC”

Set the contents of the script to:

setattribute(TextT, 'content', OSC_ARGS);

TextQ script

Bi-directional Control

In order for Lemur to stay up to date as we select different cues and adjust levels in QLab, we need to get QLab to regularly report the cue number, cue name, and sliderLevels of the currently selected cue.

The first step is creating a network patch in QLab which will allow it to send OSC messages to Lemur.

In QLab, go to Workspace Settings → Network and set up Patch 2 like this:

Network patch to lemur

The name is set to “Lemur”, the type is set to “address”, the network is set to “Automatic”, the Destination is set to the IP address of your iPad or other device, the port is set to “8000”, and the passcode is left blank.

Do note that your iPad or tablet will probably not have the same IP address as in the screen shot above.

Now return to the main QLab window, open the sidebar, and create a new cue list and named “OSC”.

In the OSC list, create a Group cue set to “start all children simultaneously” and number it SYNC.

Inside the Group, create a Network cue. Set its destination to “Lemur”, and enter this OSC message:

/cue/selected/sliderLevel 0 #/cue/selected/sliderLevel 0#

This uses an OSC query (the part between the hash marks) to get the current level of slider 0 (master) of the currently selected cue, and send that as the second argument of an OSC message beginning with /cue/selected/sliderLevel 0. That message will set the level of the fader in Lemur with the corresponding address, “Fader0” in this case, to the level of the slider in the selected cue.

Copy and paste the cue eight times to create Network cues for the other eight Lemur faders, editing the OSC message appropriately. So, for Fader1:

/cue/selected/sliderLevel 1 #/cue/selected/sliderLevel 1#

And so on.

Next, create two more Network cues for sending the cue number and name of the selected cue to Lemur. The first will set the cue number using this OSC message:

/TextQ/setcontent "#/cue/selected/number#"

The second will set the cue name using this message:

/TextT/setcontent "#/cue/selected/number#"

Note the quote marks around the OSC queries. This allows spaces in the result of the query to be sent to Lemur. If you omit them, then only the first word of the cue name or number is sent.

SYNC cue

Once all these Network cues are created, starting Group SYNC will update Lemur all at once. We now need to set up a mechanism which will trigger Group SYNC a few times per second so that Lemur stays up to date automatically. We could create a loop within QLab to do this, or give all the Network cues a very long duration, both of which would work perfectly well until the escape key was pressed. You’d then need to manually restart the SYNC group which is a bit of a hassle and easily forgotten.

Instead, it’s far better if the cue is started a few times per second from Lemur. Because Lemur has internal clocks, this is quite straightforward to arrange.

Lemur Clocks

To start a clock when a Lemur project opens, we need a script at Project level. In Lemur Editor, in the Project panel, select the Project folder and click the Script button at the bottom of the panel. Name the script “startclock”, set its Execution to “On Load”, and enter this script:


This starts clock number 0 (Lemur has several clocks which can each run independently) at its default tempo of 120 beats per minute.

Clock script

Create another script at project level named “sync”. Set its Execution to “On Clock” which will cause two more drop-down menus to appear. Set the first to “Clock 0” and the second to “On 18 note”

This will cause the script to execute 16 times per second, because there are sixteen eighth notes per second at a tempo of 120 beats per minute.

Set the script to:


This scripts sends the OSC message /cue/SYNC/start 1 to QLab. The first parameter of the message, 0, is the output patch to use. Since we configured OSC 0 to send to QLab, we use 0 here. The second parameter is the OSC message itself. The third parameter is an argument for the OSC message. This particular OSC message does not need an argument, but Lemur does not support sending OSC messages without arguments. Fortunately, QLab ignores arguments that it isn’t expecting, so this works out nicely.

Sync script

Now, whenever this project is opened in Lemur, clock number 0 will begin ticking at 120 beats per minute, and the OSC message to trigger the SYNC cue in QLab will be sent every sixteenth of a second. Lovely.

However, there may be times that we’d like to turn this feature off. After all, the update cycle means one OSC message going to QLab, then ten OSC messages coming back to Lemur (one for each fader and one each for cue name and cue number). That’s 176 OSC messages per second, which isn’t nothing.

Let’s add a button to turn our OSC sync system on and off. Start by dragging a CustomButton object into the Lemur workspace. Name it “SYNC” and set its Color On to green and both its Style Off and Style On to the play symbol. That’s done by clicking on the button that’s labeled “Tt” and choosing the symbol from the drop-down menu.

Change the project script named “sync()” to this:


The new part of the message, if(SYNC.x==1), means that the OSC message to QLab will only be sent when the “SYNC” button is on.

Sync button

One more finishing touch is all we need: a manual sync button to update Lemur when automatic sync is switched off. To crate this, drag another CustomButton object into the Lemur editor. Click on the Behavior tab of the Object panel and change the button’s mode to “PAD”. This gives the button a momentary action like a drum pad, rather than a latching on/off action.

In the Mapping panel, give the button a custom address of /cue/SYNC/start, then click on the drop-down menu labeled “any” and change the execution to “message sent when value goes from 0 to positive” (the second choice, right below “any”).

In the Properties tab of the Objects panel, set both the Style On and Style Off to the text “GET”.

Get button

You can now tap that button at any time to manually synchronize Lemur.

The finished product