Auto Generating Midi Cues with Script for Desk Scenes

259 views
Skip to first unread message

William Midgley

unread,
Sep 30, 2023, 2:54:08 PM9/30/23
to QLab
Hello! 

I am very new to apple script and I am still finding my feet. Keen to know if what I want to do is possible and any pointers on apple script basics would be great! 

I am programming shows that need to be run autonomously with an op baby sitting. So I want a script that when I fire a desk cue it would first get the currently elapsed time of the currently running group, then great a midi cue in that group and finally assign the pre wait to the elapsed time of when it was first fired. 

Then at the end of the show I can just put in the actual midi information then the next time I run the show the desk will be fired from Qlab.

Any advice would be great! 

Thanks,
Will Midgley 

micpool

unread,
Oct 2, 2023, 6:16:00 AM10/2/23
to QLab
Hard to know exactly what to recommend  without more details of what you are firing with the MIDI , but assuming that you are sending sequential MIDI PC's
The built-in tool in QLab to record cue sequences  works in a slightly different way in that you have the cues first and then the sequence recorder creates a series of start cues in a timeline group targeting the MIDI cues as you fire them while recording.

To generate a series of sequential MIDI PC cues use this script:

--generate a series of MIDI PC cues

--set up

set theoffset to 0 -- change  to MIDI PC that selects Program 1 on device (0 or 1)

set therepeat to 10 --change to number of cues to generate

set thedevicename to "My MIDI DEVICE" --change to name of your MIDI device

set theMidiCh to 1 --Change to MIDI channel for PC Messages

set the midiPatchNumber to 1 --number of MIDI patch in patchlist

--do not change anything under this line

set theindex to 1

set theincrement to 1

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

repeat therepeat times

make type "MIDI"

set theselectedcue to last item of (selected as list)

set the q number of theselectedcue to ""

set the q name of theselectedcue to thedevicename & " PRESET " & (theindex) as string

set the message type of theselectedcue to voice

set the command of theselectedcue to program_change

set byte one of theselectedcue to (theindex + theoffset - 1) as integer

set the channel of theselectedcue to theMidiCh

set the midi patch number of theselectedcue to midiPatchNumber

set theindex to theindex + theincrement

end repeat

end tell



Run the script and put the generated cues in a fire first group with the audio or video cue you are sequencing.

From the tools menu select Record cue sequence..... and start recording

Play the audio cue (not the group) and then fire your MIDI cues at the appropriate times

Stop recording. QLab will generate a timeline group with start cues for every cue you fired while recording.

Drag this timeline group to be the first cue of the fire first group.

Play the fire first group.

Screen recording attached


Cue Sequence.mov

Paul

unread,
Oct 4, 2023, 11:12:46 AM10/4/23
to QLab
Will - here is a script which I think will do what you want. Grabs the clasped time of (last) running group cue, creates a midi cue, moves into into the group and set the pre-wait.  Don't know the details of what MIDI (voice, MSC, SysEx) message you need, so you will have to modify that bit to suit your application. When running unattended I always think it is useful to log things, so if things don't work as intended you have some info to try and debug it - but that would add more complexity than I want to include here. The script uses notifications to let the user know something is happening without being too intrusive.

(sorry I can't get this is nicely format as Mic has done, even though I'm using Safari browser)

-- make midi cue with pre wait
-- change these midi parameters to suit
set MIDIpatchNum to 1
set MIDIchannel to 1
set midiSysExMessage to "B0 69 00 B0 76 21"

-- TODO for an unattended installation useful to log to file so can review problems

set nl to linefeed
tell application id "com.figure53.QLab.5" to tell front workspace
try
set runningGroupCue to last item of (every cue whose (running is true) and (q type is "Group"))
set elapsedtime to (action elapsed of runningGroupCue) as real
on error ErrorMessage
display notification ErrorMessage & nl & "no running group cue?" with title "Error"
return
end try
make type "midi"
set midiCue to last item of (selected as list)
set notes of midiCue to "created at " & (current date)
-- set other midi cue parameters here
--  MIDI cue parameters
set midi patch number of midiCue to MIDIpatchNum
set channel of midiCue to 1
-- MIDI types can be Voice (note, CC, Prog Change etc), MSC (MIDI Show Control) or SysEx (System Exclusive)
set message type of midiCue to sysex
-- there are lots of different midi parameters you can set, depending on your application
-- and you may want to modify the message / midi bytes here depending on some criteria
set sysex message of midiCue to midiSysExMessage

try
-- move cue into group and set prewait
move cue id (uniqueID of midiCue) of parent of midiCue to beginning of runningGroupCue
set pre wait of midiCue to elapsedtime
display notification " in group " & (q display name of runningGroupCue) & " with pre wait of " & elapsedtime & " Sys Ex message " & midiSysExMessage with title "Made MIDI Cue"
on error ErrorMessage
display notification ErrorMessage with title "Error"
end try
end tell
Reply all
Reply to author
Forward
0 new messages