midi flash

117 views
Skip to first unread message

Grangil

unread,
Nov 19, 2024, 7:24:46 AM11/19/24
to QLab
Hi community... I'm trying to send flashes (midi or osc) to a light cue and have the light source return to its initial state when the midi flash button is released. For now with a midi capture in the light patch the source returns to zero.
Thank you all very much for your help.

Bas Warnars

unread,
Jan 19, 2026, 10:13:36 AMJan 19
to QLab
I would love to know the same, have tried a bunch of different options, even with an apple script launching on releasing midi to revert channel changes but due to a bug in qlab not reading the midi changes into the current cue (only changes that are done in the sliders are recorded and then you can revert to the right cue but if you only make midi changes the revert goes to a cue before the last one...) that doesn't revert to the right cue. It shouldn't be this hard to just flash a light! I hope somebody has a good suggestion? (best would be a sub master that does HTP but for some reason qlab has a combination of HTP and LTP on the sub masters.... this is very frustrating).

Paul

unread,
Jan 19, 2026, 6:11:58 PM (14 days ago) Jan 19
to QLab
It is possible to do this with a few caveats.
You need to be able to read the level of the light in the current cue. Unfortunately, although there is a setLight command there is no equivalent  "getLight" command. (although you can getLevel of an audio cue!) The second tricky thing is to determine what the current lighting state/cue is (assuming this is running not plotting a show).
Here is a script which flashes a dimmer channel and reverts to the level in the last run cue
This uses the very useful utility awk in a shell script to extract the level for a channel [actually a selector] from the light command text of a light cue. 
  echo light_cmd | awk -F= '$1~/" & mySelector & "/  {print $2}'"
This takes the light command of the cue, set the record separator to be = and then matches the first field to the selector (eg 1 or 2.blue) and returns the second field - the light value.
This is only minimally tested: Make sue you backup your Workspace before running this (or any) script!

-- flash a channel in lighting and restore to level in cue

-- run on hotkey / MIDI / OSC trigger

-- uses awk via shell script to parse the ligthing command of cue


-- define the channel to flash, the time and flash level

set ch to 1

set flashTime to 0.3

set flashLevel to 100

-- we know that ch 1 is a dimmer, so only has intensity parameter

set mySelector to ch


tell application id "com.figure53.QLab.5" to tell front workspace

-- get the cue at the playhead ..

set pendingCue to playhead of current cue list

-- move back until we find a lighting cue [WARNING: this will loop forever if no previous light cue!]

movePlayheadUp

repeat until (q type of playhead of current cue list as string is "Light")

movePlayheadUp

-- TODO put a break of this looping forever if no previous light cues

end repeat

set lightCue to playhead of current cue list

set cueLevel to my getLightLevel(command text of lightCue, mySelector)

-- display dialog (command text of myCue) & linefeed & "in cue " & (q number of myCue) & " ch " & mySelector & " level is " & cueLevel with title "debug light command and level"

-- TODO use multiple selectors for RGB fixtures

setLight current light dashboard selector mySelector value flashLevel

delay flashTime

setLight current light dashboard selector mySelector value cueLevel

-- reset the playhead (and hope the operator hasn't pressed go in the meantime!)

set playhead of current cue list to pendingCue

end tell


-- really need a getLight function but doesn't exist


on getLightLevel(lxcmd, mySelector)

-- return the level for given light selector

-- a light selector is a channel number and parameter (eg 32.red or just channel number for dimmer/intensity only channels)

set scpt to "echo \"" & lxcmd & "\" | awk -F= '$1~/" & mySelector & "/  {print $2}'"

return (do shell script scpt)

end getLightLevel


You can trigger this script via hotkey/MIDI. This works a dimmer channel (with only the intensity parameter); for RGB fixtures you need to specify the selector to be, say 5.red to flash the red channel. If you wanted to flash to white (all RGB values at 100) you could modify the script to use additional selectors, perhaps stored in a list. Unfortunately there is now way for a script to read the light patch to find out what type a fixture is, so you would have to code this into the script, which makes it less generic/flexible. The matching is done on regular expression so might be possible to use regEx to match more intensity channels, get values into a list and check length of list.

Finally the usual caveat about not using Qlab for lighting for anything like this, you're better off using a dedicated lighting program/desk. You can make Qlab  do all sorts of things with lights, including effects, but the amount of effort is large and the show has to go up on time!

Bas Warnars

unread,
Jan 20, 2026, 1:38:56 PM (13 days ago) Jan 20
to QLab
That is a nice script but looks quite a bit dangerous for now to put in a live show. I will test it but don't know if this is the answer I need. Yes a lightning console would be more useful for now. It's just that I, as a touring theatre tech, wanted my setup to be portable and light but since the sound part is also getting out of hand at the moment... Kind of funny that you start with an all in one solution and in the end always seem to end up with the "more devices is more flexibility and more reliability" thing. 

Paul

unread,
Jan 22, 2026, 11:48:36 AM (11 days ago) Jan 22
to QLab
Here is a revised version of the script which now stops the loop at top of cue list if no light cue found and also changes the awk command to deal with channel 22 vs 2. This also prompts the user for the channel/selector to flash. Of course you could command this out and edit the channel/selector and have multiple copies of this script with different MIDI triggers to flash different channels. 
For production use I would want add some error checking (try .. on error .. end try) left out here for clarity.

-- flash a light and revert to level in (previous run) light cue, v2

-- put this script on hotkey / MIDI / OSC trigger

-- uses awk via shell script to parse the ligthing command of cue


-- define the default channel to flash

set ch to 1

-- ask the user to enter the selector/channel to flash (comment this out if not needed)

set ch to text returned of (display dialog "Enter channel or selector " default answer ch with title "Flash Light Channel")

-- adjust these to suit

set flashTime to 0.3

set flashLevel to 100


-- we assume that ch  is a dimmer, so only has intensity parameter

set mySelector to ch


tell application id "com.figure53.QLab.5" to tell front workspace

-- get the cue at the playhead ..

set pendingCue to playhead of current cue list

set MyCueList to current cue list

-- get the id of the first cue in the list to check when we reach the top of the list

-- (note the first item of cues whose parent is the cue list itself; so we want the second item)

set firstCueId to uniqueID of second item of ((cues whose parent list is MyCueList) as list)

set qtype to "Light"

movePlayheadUp

-- move the playhead up until we find a Light cue or until we reach the first cue in the list

repeat until (q type of playhead of MyCueList as string is qtype or uniqueID of (playhead of MyCueList) is equal to firstCueId)

movePlayheadUp

end repeat

-- check we've found a light cue

if q type of playhead of MyCueList as string is qtype then

set lightCue to playhead of current cue list

-- TODO try use multiple selectors for RGB fixtures

set cueLevel to my getLightLevel(command text of lightCue, mySelector)

setLight current light dashboard selector mySelector value flashLevel

delay flashTime

setLight current light dashboard selector mySelector value cueLevel

else

display notification qtype & "  cue not found - nothing to do"

end if

-- reset the playhead (and hope the operator hasn't pressed go in the meantime!)

set playhead of current cue list to pendingCue

end tell


on getLightLevel(lxcmd, mySelector)

-- return the level for given light selector

-- a light selector is a channel number and parameter (eg 32.red or just channel number for dimmer/intensity only channels)

set scpt to "echo \"" & lxcmd & "\" | awk -F' = ' '$1~/^" & mySelector & "$/  {print $2}'"

-- display dialog scpt with title "Shell Script"

return (do shell script scpt)

end getLightLevel


I think the real solution to this would be a feature request to extend the scriptable properties of the light dashboard, so you could 'getLight' as you can getLevel for an audio cue. It might also be useful for scripting access to the lighting patch. But development effort is limited and I for one would prefer resources focused on the (more used) audio and video aspects of Qlab.
On the more general point, I have toured with a single computer running Qlab and EOS software, with Qlab doing video, audio and trigger lighting cues. The external hardware involved a USB audio interface, a USB hub with HDMI (for video projection) and network ports  and a DMX-network converter. All that, with power supplies, fitted in an easy to carry plastic box.

Reply all
Reply to author
Forward
0 new messages