level-playing-field

209 views
Skip to first unread message

Tim Kruithof

unread,
Jan 14, 2021, 10:50:08 AM1/14/21
to QLab
Hello everyone,

I am trying (for quit a while now) to get the level playing tool working. The apple script opens, it says complete, but no levels change.


Is there anyone who got this to work? I'm using macOS Catalina (10.15.6) and Qlab 4.6.8

Would make my life a lot earies when I get this to work..

Thnx,

Tim

Rich Walsh

unread,
Jan 14, 2021, 11:10:21 AM1/14/21
to ql...@googlegroups.com
I've not tried it before but it worked as expected with the downloadable Example Workspace (macOS 10.14.6)…

I'd recommend running the script from Script Editor so you see what's going on while troubleshooting.

Rich

(I did do a sneaky mod to avoid installing the command line tool – see below.)

--
Contact support anytime: sup...@figure53.com
Follow QLab on Twitter: https://twitter.com/QLabApp
User Group Code of Conduct: https://qlab.app/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "QLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/5c3d3488-2b89-4fab-a02d-f9b45f5a869cn%40googlegroups.com.

set theReferenceLevel to -24 --set desired LUFS level
set thefaderLevel to -10 --set the master fader level to your preferred output level for cues with an LUFS at the reference level
set currentTIDs to AppleScript's text item delimiters

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


### MOD TO MIC'S WORK ###
set workspacePath to path
tell application "System Events"
set sharedPath to path of container of file workspacePath
end tell
set commandLineTool to quoted form of POSIX path of (sharedPath & "r128x-cli")
### END MOD TO MIC'S WORK###


display dialog "WARNING: This will change the master levels of all selected cues" & return & return & "A dialog will signal when the level setting is complete." & return & return & "PROCEED?"
try
set theselected to the selected as list
if (count of items of theselected) > 0 then
repeat with eachcue in theselected
if q type of eachcue is "audio" then
set currentFileTarget to quoted form of POSIX path of (file target of eachcue as alias)
tell me to set theLUFS to (do shell script commandLineTool & " " & currentFileTarget as string) -- ### MOD TO MIC'S WORK ###
--parse theLUFS to extract the actual LUFS from a very long string
--replace every occurrence of "+" with "plus"
set AppleScript's text item delimiters to "+"
set the item_list to every text item of theLUFS
set AppleScript's text item delimiters to "plus"
set theLUFS to the item_list as string
--replace every occurrence of "-" with "minus"
set AppleScript's text item delimiters to "-"
set the item_list to every text item of theLUFS
set AppleScript's text item delimiters to "minus"
set theLUFS to the item_list as string
set AppleScript's text item delimiters to currentTIDs
--get the third word from the end
set the theLUFS to word -3 of theLUFS
--replace the string "minus" in theLUFS with "-"
if character 1 of theLUFS = "m" then
set theLUFS to "-" & characters 6 thru -1 of theLUFS
else
--replace the string "plus" in theLUFS with "+"
set theLUFS to "+" & characters 5 thru -1 of theLUFS
end if
set theadjustment to (theReferenceLevel - theLUFS) + thefaderLevel
set the notes of eachcue to theLUFS & " " & theadjustment
eachcue setLevel row 0 column 0 db theadjustment
end if
end repeat
display dialog "Level Setting Complete" buttons "OK" default button "OK"
end if
end try
end tell

micpool

unread,
Jan 14, 2021, 11:15:05 AM1/14/21
to QLab
Hi Tim

Yes it works using your OS and QLab version, however.....

It’s the dreaded localisation issue again, specifically commas instead of decimals in levels.

If you temporarily set your region to US or UK then you will see it working.

I’ll see if there is a quick localisation fix.

micpool

unread,
Jan 14, 2021, 11:37:35 AM1/14/21
to QLab
I think this sorts it (Thanks to Martin Garvey's nifty trick on macscripter.net)

set theReferenceLevel to -24 --set desired LUFS level
set thefaderLevel to -10 --set the master fader level to your preferred output level for cues with an LUFS at the reference level
set currentTIDs to AppleScript's text item delimiters

tell application id "com.figure53.QLab.4" to tell front workspace
display dialog "WARNING: This will change the master levels of all selected cues" & return & return & "A dialog will signal when the level setting is complete." & return & return & "PROCEED?"
try
set theselected to the selected as list
if (count of items of theselected) > 0 then
repeat with eachcue in theselected
if q type of eachcue is "audio" then
set currentFileTarget to quoted form of POSIX path of (file target of eachcue as alias)
set theLUFS to (do shell script "/usr/local/bin/r128x-cli" & " " & currentFileTarget as string)
--parse theLUFS to extract the actual LUFS from a very long string
--replace every occurrence of "+" with "plus"
set AppleScript's text item delimiters to "+"
set the item_list to every text item of theLUFS
set AppleScript's text item delimiters to "plus"
set theLUFS to the item_list as string
--replace every occurrence of "-" with "minus"
set AppleScript's text item delimiters to "-"
set the item_list to every text item of theLUFS
set AppleScript's text item delimiters to "minus"
set theLUFS to the item_list as string
set AppleScript's text item delimiters to currentTIDs
--get the third word from the end
set the theLUFS to word -3 of theLUFS
--replace the string "minus" in theLUFS with "-"
if character 1 of theLUFS = "m" then
set theLUFS to "-" & characters 6 thru -1 of theLUFS
else
--replace the string "plus" in theLUFS with "+"
set theLUFS to "+" & characters 5 thru -1 of theLUFS
end if
-- check for decimal localisation and convert to comma separator if neccesary
set o to (offset of "." in theLUFS)
if ((o > 0) and (0.0 as text is "0,0")) then set theLUFS to (text 1 thru (o - 1) of theLUFS & "," & text (o + 1) thru -1 of theLUFS)
set theadjustment to (theReferenceLevel - theLUFS) + thefaderLevel
set the notes of eachcue to theLUFS & " " & theadjustment
eachcue setLevel row 0 column 0 db theadjustment
end if
end repeat
display dialog "Level Setting Complete" buttons "OK" default button "OK"
end if
end try
end tell


Reply all
Reply to author
Forward
0 new messages