OSC Bidirectional control of Qlab with iPAD

553 views
Skip to first unread message

micpool

unread,
Feb 22, 2015, 9:50:09 PM2/22/15
to ql...@googlegroups.com

So this week I have been messing on and off with OSC and iPads to see how far I could get with it.

My aim was to get a full bidirectional remote control. I envisaged having a control with perhaps 20 custom controllers per screen, including buttons and faders and to get these working with full bidirectional feedback so anything  relevant to those controls that was done on the mac would be visible on the iPad and vice versa.


First the bad news. I tried to do this with Touch OSC but it became apparent that without the promised scripting ability, it was going to be very difficult to get bidirectional control. 


LEMUR is far deeper and has a much steeper learning curve, but can do just about anything (except send OSC messages without arguments).  I decided to concentrate on this.


I've attached the fruits of a few days experimenting. This project lacks a lot of error checking and is more a proof of concept than a practical example, but I managed to get all the important bits working.

(See screenshot)


In this example you put a load of audio files  into the bundled audio folder. Press Key 1 and up to the first 16 audio files are loaded into 16 cues in Qlab automatically.

As they are loading 16 buttons on LEMUR on the iPad are instantly  labelled with the titles of the cues.


The LEMUR then acts as a simple jingle style remote. Press a button to start that cue. Press again to stop.


Any cues that are started or stopped on Qlab will echo on their button on the iPad and if you ESC on Qlab all the buttons on the iPad indicate this


The fader is more a proof of concept than a sensible application. It is automatically assigned to the highest number button that is playing. It displays the current master level for that cue from Qlab and will then controls that level. Again if you make changes to the currently selected fader in Qlab the fader on the iPad will move as well.


I think there's enough in this example for those happy with some involved scripting to modify this to create a whole range of custom remote panels with full bidirectional control.  


To use the attached:

Copy a dozen or so audio files into the audio folder.

Install the LEMUR .jzml file onto your iPad using LEMUR editor on the mac.

SET IP address of Mac in LEMUR  OSC1 setting


Open Qlab workspace

Patch your audio device

Set IP address of LEMUR ipad in Qlab OSC 2 setting 


Press 1 to Sync. 

Loads  up to first 16 files in 'audio' folder, sorted by name.

Labels 16 Buttons on LEMUR with cue titles


LEMUR Fader controls highest number pad in use.


Feel free to contact me off list for any detailed technical questions.


Now back to the OSCARS.


Mic

LemurQlabBiderctionalRemoteControl.zip
LEMUR Remote.PNG

micpool

unread,
Feb 22, 2015, 10:51:18 PM2/22/15
to ql...@googlegroups.com
Ha

I just transferred this to a machine running Yosemite to test it over a big network and it broke. Not the difficult OSC stuff, just the mundane file path stuff.

This is the routine 

--Find the path of the audio folder that is in the folder with this workspace
set workspacepath to (path of my document)
set filename to name of my document as text
set thecharfile to the length of filename
set thepath to the length of (workspacepath as text)
set thetruncate to (thepath - thecharfile)
set workspacepath to text 1 thru thetruncate of (workspacepath as text)
set workspacepath to workspacepath & "audio"
set theTitleList to list folder workspacepath without invisibles
set theitemcount to number of items in theTitleList
end tell

The problem is the line:  set filename to name of my document as text. On the machine I programmed it on  (10.8)  the filename returned included the extension .cues on the other machine (10.10) It didn't although both machines included the extension in the path of my document.

So 2 things. 

If you run it and it breaks the script in the second cuelist called routines (you will know because you won't get any audio cues loaded).,  then you can quickly fix it by adding +5 to the line: set thecharfile to the length of filename becomes: set thecharfile to the (length of filename)+5

And more importantly, can anyone tell me how I should have scripted it to avoid this problem?

Thanks

Mic

micpool

unread,
Feb 23, 2015, 1:50:33 AM2/23/15
to ql...@googlegroups.com
I've found the culprit.  In finder preferences advanced show all filename extensions should be ticked before launching Qlab
This also effects the applescript name of my document. It seems the default has changed from ON to OFF on newer operating systems

Mic

Rich Walsh

unread,
Feb 23, 2015, 4:04:20 AM2/23/15
to ql...@googlegroups.com
If you look at "Convert to wav" and "Import files" on the wiki you will see the ingredients to do this:

tell front workspace


-- Establish the path to the current workspace


set workspacepath to path
if workspacepath is missing value then
display dialog "The current workspace has not yet been saved anywhere." with title dialogTitle ¬
with icon 0 buttons {"OK"} default button "OK" giving up after 5
return
end if


-- Get the path that should prefix all media file paths


tell application "System Events"
set sharedPath to path of container of file workspacepath
end tell


end tell

sharedPath is a text string, so sharedPath & "audio" would be the text path to the audio subfolder.

Also, this doesn't care if the extension is used or not – it will get the filename:

tell application "System Events"
set theContainer to path of container of currentFileTarget
set theExtension to name extension of currentFileTarget
if theExtension is "" then
set theName to name of currentFileTarget
else
set theFullName to name of currentFileTarget
set theName to text 1 through (-1 - (length of theExtension)) of theFullName
end if
end tell

You may also find these bits useful to make a list of just audio files in a folder:

set audioFileTypes to {"com.apple.coreaudio-format", "com.microsoft.waveform-audio", ¬
"public.aifc-audio", "public.aiff-audio", "public.audio", "public.mp3", "public.mpeg-4-audio"}
(* This list deliberately excludes "com.apple.protected-mpeg-4-audio" to protect against old DRM-restricted iTunes files *)

tell application "System Events"
set audioFilePaths to {}
set folderFiles to files of folder (sharedPath & "audio") whose visible is true
repeat with eachFile in folderFiles
if type identifier of eachFile is in audioFileTypes then
set end of audioFilePaths to path of eachFile
end if
end repeat
end tell

Rich

micpool

unread,
Feb 23, 2015, 10:28:08 AM2/23/15
to ql...@googlegroups.com
Thanks very much Rich

New  extension agnostic version  attached.
LemurQlabBiderctionalRemoteControlv0.2.zip

micpool

unread,
Feb 23, 2015, 4:40:34 PM2/23/15
to ql...@googlegroups.com
I have had some success with doing something similar with Touch OSC and have limited  bidirectional ability.

The main stumbling block is that neither Qlab nor Touch OSC have the ability to maintain communication as a background task. So if you press ESC on the Qlab system the link will break and so will the bidirectional feedback. 

Because you can't have multiple OSC messages on the same button you can't have the start and stop on a single control. I have had to split them 2 a start and stop control.

Because there is no fader z parameter in the Touch OSC implementation you can't have  bidirectional  control, as without switching off the feedback from Qlab when the fader is touched (z), they fight each other. The fader value on the iPad is only synced  once.when its play button for that channel  is pressed.

So it's a lot more informative and useful  than a dumb remote, but not nearly  as versatile as a LEMUR.

In the attached example workspace pressing 1 reads in the first 4 files from the audio folder and sets the iPad labels automatically.

You will need to set the IP addresses as detailed in the notes.

There are 4 files live on the iPad and they have each have start and stop controls, an indicator if the cue is playing, and a fader 
The stop controls fade the audio rather than cutting it.
The faders are always live so you can drop a fader before starting a cue to fade it in.
There is a PANIC button on the iPad which should be used as a stop all instead of ESC on Qlab.

Again, it's all fairly easily scalable for more buttons or faders  and other types of control, and most of the basics for some degree of bidirectional control are covered in the example. As always I am quite happy to discuss any details off list.


Mic


OSC Touch Bidirectional.PNG
TouchOSCQlabBiderctionalRemoteControlv0.1.zip

Drew Schmidt

unread,
Feb 25, 2015, 10:27:38 AM2/25/15
to ql...@googlegroups.com
I've had the same need to use TouchOSC with bidirectional communication. To be fair, it's because while at work, my kids want to keep the iPad to watch Daniel Tiger's Neighborhood ... which I highly recommend. So I'm stuck with my Android phone. Occasionally I want to quick adjust a level, opacity, duration, etc. So I've sat down a couple of mornings with a cup of coffee and made this ( Warning, not meant for the faint of heart! ) ...


It's not completely fleshed out. It's not well documented. But because this topic has popped up a couple of times in the last few weeks, I thought I would post what I've got. On the page you'll find two main items
  • TouchQlab.py - The python script that runs as a translation tool between TouchOSC (or whatever you want really) and Qlab
  • TouchQlab.touchosc - The TouchOSC file that I use. It's just an example, but fairly well fleshed out.
    Be sure to examine the formatting of the OSC addresses used. 
Things to note are ...
  • Be sure to press ctrl-C when you're finished to exit. Don't just quick IDLE.
    Otherwise the port / address will remain open and you'll need to restart your computer to run the script again. 
  • Communication is over port 54000 and 54001. It then communicates with Qlab over 53000 and 53001.
  • Some command, any command, needs to be sent from TouchOSC to begin communication.
  • The script pulls the frontmost workspace when started.
  • TouchQlab.py needs to be opened and run via IDLE (be sure to run as sudo).
  • TouchQlab.py uses the PyOSC library. That will need to be downloaded and unpacked. (Below are some quick install instructions)

Hope it helps someone! I'm sure it could easily be adapted for Lemur or another OSC application. 


$ curl -O https://gitorious.org/pyosc/devel/archive/633c0112318a3519314aa798a552a092566c73c1.tar.gz
$ cd ~/Downloads/
$ open "633c0112318a3519314aa798a552a092566c73c1.tar.gz"
$ cd pyosc-devel
$ sudo python setup.py install
 * You'll need to enter your password here *

Drew Schmidt

unread,
Feb 26, 2015, 9:48:51 AM2/26/15
to ql...@googlegroups.com
And if you're interested, here's a bit more information about usage and customization.

Reply all
Reply to author
Forward
0 new messages