Import cues with prewaits

370 views
Skip to first unread message

cpet...@gmail.com

unread,
May 12, 2021, 9:39:08 PM5/12/21
to QLab
Hi Guys,

I'm using qlab a lot to trigger OSC/MIDI and am using lots of DAW markers to mark where the cues need to go.

Given I can export the markers from the DAW to a CSV or similar, is it possible to somehow 'import' these markers as a particular cue type and use the marker time as the prewait?

Is there a way to do this with scripting?

Thanks,

Chris

micpool

unread,
May 13, 2021, 12:07:18 AM5/13/21
to QLab
The answer is very probably yes! What DAW are you exporting the markers to csv from?

Mic

Chris PP

unread,
May 13, 2021, 12:50:39 AM5/13/21
to QLab
Oh cool!

I'm actually using Adobe Premiere for this project.. but I have done it in Adobe Audition too.

C

Rich Walsh

unread,
May 13, 2021, 4:20:32 AM5/13/21
to ql...@googlegroups.com
I have the framework for something like this here: https://wiki.allthatyouhear.com/doku.php#make_group_cues_from_a_text_file_droplet.

It would take minor tweaking to change the cue type it makes and add pre wait as a column. It's based around tab-delimited files as I've not looked into handling escaped commas within a CSV.

Rich

micpool

unread,
May 13, 2021, 4:32:18 PM5/13/21
to QLab
I don't have a copy of Premiere or Audition to hand with the option to export markers (it's not in CS6).  If you post a csv file of exported markers, I can give you a script.

However, I try to avoid reading csv's In Applescript mainly because the generally acknowledged best script to do this, Nigel Garvey's csv to list script, is very, very, long and I don't really understand all of it.

What I do with any CSV file is import it into Excel, and then use a few lines of   Applescript to use the  data in that open Excel document to set the cue properties of generated cues in QLab. Excel makes it easy to import most types of data formats in a way that shows you the data prior to using in QLab in a crystal clear manner.

Here's a script to read the markers file exported as csv from Twisted Wave.

When I open the csv in Excel the data structure is immediately apparent 

Screen Shot 2021-05-13 at 21.23.25.png

and I then generate cues using this short and simple script, which can be really easily adapted for more data columns as required, as long as you know the names of the QLab cue  properties you want to set, which you can find in the QLab  AppleScript dictionary.

set theName to {}

set thePreWait to {}

tell application "Microsoft Excel" to tell active sheet

tell used range to set rowcount to count of rows

repeat with eachrow from 2 to rowcount

set end of theName to value of cell ("A" & eachrow)

set end of thePreWait to value of cell ("B" & eachrow)

end repeat

end tell

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

make type "group"

set thegroup to last item of (selected as list)

set the mode of thegroup to timeline

repeat with eachrow from 1 to count of items of theName

make type "MIDI"

set thecue to last item of (selected as list)

set the pre wait of thecue to item eachrow of thePreWait

set the q name of thecue to item eachrow of theName

move cue id (uniqueID of thecue) of parent of thecue to end of thegroup

end repeat

end tell


If you think the Excel trick is cheating and you really do want to do it directly from a csv file, then get to grips with this!

https://macscripter.net/viewtopic.php?pid=125444#p125444


You may also find some other useful marker related stuff here:

https://qlab.app/cookbook/master-marker-manipulation


Mic

Chris PP

unread,
May 13, 2021, 6:03:33 PM5/13/21
to QLab
Hey Mic,

This is amazing, I can't thank you enough.. yep excel will work fine and totally makes sense.

I think I can work it out from here. I'll post the results!

Thanks so much!

C

Chris PP

unread,
May 13, 2021, 8:57:20 PM5/13/21
to QLab
Hi Guys,

So I've got it most of the way there, I had to use frames as the time readout of Premiere wasnt useful. I worked out how to divide frames by fps to give me a decimal value that qlab likes.

The next bit which I cant work out is how to use theName to create the OSC command... I've got theName into the message but need to concatenate a bit of text before and after, you can see these as message1 and message2.

I can't seem to get it to work within the array.

Any assistance with this would be great.

Thanks,

C

Script here:

set theName to {}

set thePreWait to {}

set fps to 50

set message1 to "/eos/cue/1/"

set message2 to "/fire"

tell application "Microsoft Excel" to tell active sheet
tell used range to set rowcount to count of rows
repeat with eachrow from 2 to rowcount
set end of theName to value of cell ("A" & eachrow)
set end of thePreWait to value of cell ("C" & eachrow)
end repeat
end tell

tell application id "com.figure53.QLab.4" to tell front workspace
make type "group"
set thegroup to last item of (selected as list)
set the mode of thegroup to timeline
repeat with eachrow from 1 to count of items of theName
make type "NETWORK"
set thecue to last item of (selected as list)
set the q name of thecue to item eachrow of theName
set the pre wait of thecue to (item eachrow of thePreWait) / fps
set the osc message type of thecue to custom
--- need to add the message 1 before theName and add message 2 after theName of the below bit of script
set the custom message of thecue to item eachrow of theName
move cue id (uniqueID of thecue) of parent of thecue to end of thegroup
end repeat
end tell

Chris PP

unread,
May 13, 2021, 9:01:17 PM5/13/21
to QLab
I got it!

set theName to {}

set thePreWait to {}

set fps to 50

set message1 to "/eos/cue/1/"

set message2 to "/fire"

tell application "Microsoft Excel" to tell active sheet
tell used range to set rowcount to count of rows
repeat with eachrow from 2 to rowcount
set end of theName to value of cell ("A" & eachrow)
set end of thePreWait to value of cell ("C" & eachrow)
end repeat
end tell

tell application id "com.figure53.QLab.4" to tell front workspace
make type "group"
set thegroup to last item of (selected as list)
set the mode of thegroup to timeline
repeat with eachrow from 1 to count of items of theName
make type "NETWORK"
set thecue to last item of (selected as list)
set the q name of thecue to item eachrow of theName
set the pre wait of thecue to (item eachrow of thePreWait) / fps
set the osc message type of thecue to custom
--- need to add the message 1 before theName and add message 2 after theName of the below bit of script
set the custom message of thecue to message1 & item eachrow of theName & message2
move cue id (uniqueID of thecue) of parent of thecue to end of thegroup
end repeat
end tell

Chris PP

unread,
May 13, 2021, 9:14:52 PM5/13/21
to QLab
oh my god this script has saved me! you guys are all legends!

Taylor Glad

unread,
Jun 17, 2021, 4:41:00 AM6/17/21
to QLab
After fiddling with similar things on my own on past projects, I've decided to finally start putting together a mega-Google Sheet template of all sorts of different batch cue generating needs. I'd love people's input, but to keep it from turning into a messy pot, I'm not sharing editing privileges with everyone just yet.

The idea is that a sheet and script go hand-in-hand. Just make a copy of the sheet and duplicate as many tabs as you want. Just don't delete things in the gray boxes; some are using formulas.
Google Sheets exports CSVs just one page/tab at a time, making it easy to keep them all in one place.
And then I leave a link to the scripts in a comment in one of the cells as well.


In particular, I finished one for importing ProTools Markers and generating start cues, and one that turns ProTools Markers into slices in a cue.
Even though the discussion here is on Adobe Editors, I still figured I would share here because of the way I use a CSV file without opening a spreadsheet app like Excel.

The scripts prompt for a csv file, and then just run without Microsoft Excel. I thought I stole this way of parsing CSVs from Mic, but now I'm not sure. It looks like a relatively simple bit of code, so he must be aware of some potential drawbacks. But this has consistently worked for me. *shrug*


Export the markers to a text file like normal, then Select All, Copy, and Paste in cell A1 of the Google Spreadsheet
Just copy and paste the whole thing. That way it includes the project name, and the sample rate. The sheet uses the sample rate to calculate the time with a greater precision. And the Start Cue script also uses the session name to create a new cue lists to populate the new cues.


I'd love any feedback people have!
Send me any common CSVs, and ideas of what to do with them!

Tested with ProTools Version 2020.9.1


To Import Start Cues from CSV

--by Taylor Glad. Updated 6/7/21
--Script will prompt you for a csv file. You don't need Microsoft Excel.
--select csv file from ProTools Marker Start Cues tab of the QLab batch cues template sheet
-- Columns are #,Time, Time Reference, Units, Name, Comments, Seconds
set TheFile to choose file of type "csv" with prompt "Select a csv file:"
set theFileContents to read TheFile
set thetids to AppleScript's text item delimiters
set AppleScript's text item delimiters to ","
set thenumberofrows to count of paragraphs of theFileContents
tell application id "com.figure53.QLab.4" to tell front workspace
make type "cue list"
set songName to (text item 2 of paragraph 1 of theFileContents) & " Marker Import"
--If you want the new cues to be put inside a new group, instead of a new Cue List, comment out the following two lines of code, and uncomment out the rest.
set q name of last cue list to songName
set current cue list to first cue list whose q name is songName
--make type "group"
--set theGroup to last item of (selected as list)
--set the mode of theGroup to timeline
--set the q name of theGroup to songName
repeat with makeCues from 13 to thenumberofcues --starts in 13 to skip the other pasted jargon
set theRow to (paragraph makeCues) of theFileContents
make type "start"
set theCue to last item of (selected as list)
set the q number of theCue to text item 1 of theRow
set the pre wait of theCue to text item 7 of theRow
set the q name of theCue to text item 5 of theRow
set the notes of theCue to text item 6 of theRow
--move cue id (uniqueID of theCue) of parent of theCue to end of theGroup
end repeat
end tell
set AppleScript's text item delimiters to thetids



Import Slices from CSV (into selected audio/video cue)


--by Taylor Glad. Updated 6/7/21
--Script will prompt you for a csv file. You don't need Microsoft Excel.
--select csv file from ProTools Marker Start Cues tab of the QLab batch cues template sheet
-- Columns are #,Time, Time Reference, Units, Name, Comments, Seconds, Play Count

--The script makes sure you have at least one audio or video cue selected. It lets you select multiple to let you do you.
--The script will also tell you if the end time of a cue you have selected is shorter than one of your markers.

tell application id "com.figure53.QLab.4" to tell front workspace
set theSelection to the selected as list
repeat with theCue in theSelection
if (the q type of theCue is "Video") or (the q type of theCue is "Audio") then
set TheFile to choose file of type "csv" with prompt "Select a csv file:"
set theFileContents to read TheFile
set thetids to AppleScript's text item delimiters
set AppleScript's text item delimiters to ","
set thenumberofrows to count of paragraphs of theFileContents
set theCueEndTime to the end time of theCue
set theMarkers to {}
repeat with rowCount from 13 to thenumberofrows --starts in 13 to skip the other pasted jargon
set eachRow to (paragraph rowCount) of theFileContents
set theSliceTime to (text item 7 of eachRow)
if theSliceTime as real is greater than theCueEndTime as real then
display dialog "One of the imported slices in your CSV is past the end time of your selected cue" with title "Incompatible Marker" with icon 2
return
end if
set theSlicePlayCount to (text item 8 of eachRow)
if theSlicePlayCount is not "inf" then
if (text item 8 of eachRow as string as real) * 1 is 0 then
set theSlicePlayCount to "1"
end if
end if
set end of theMarkers to {time:theSliceTime, playCount:theSlicePlayCount}
end repeat --for eachLine
set the slice markers of theCue to theMarkers
else --theCue is an Audio or Video cue
display dialog "Please select an audio or video cue before running this script." with title "Select Audio or Video Cue" with icon 2
end if --theCue is an Audio or Video cue
end repeat --of the selected cues
end tell

Reply all
Reply to author
Forward
0 new messages