random cues for installation using Applescript

258 views
Skip to first unread message

Geoffrey Dyson

unread,
Apr 5, 2014, 6:04:33 AM4/5/14
to ql...@googlegroups.com
I am trying to set up an installation where we have random audio files playing between 10 AM and midnight with a random time of anything up to 15 minutes of silence between the tracks.  I thought of doing this with applescript and having all the different audio files in a group and a whole bunch of differently timed "wait" cues also in the same folder.  I found this Applescript

-- Shuffle the cues in a specific Group Cue and set them to play consecutively (you should turn this into a Script Cue)

tell application "QLab"

set userGroupCueNumber to "1" -- Change this to the q number of the Group Cue

set userOverlap to -1 -- Use this variable to define how long before the end of a cue the next one should start (eg: "-1" will give a 1s overlap)

tell front workspace

set theGroupCue to cue userGroupCueNumber

set countCues to count cues of theGroupCue

repeat countCues times -- This won't always move every cue, but should move sufficient to randomise the order

set eachCueID to uniqueID of some item of items 1 thru -1 of (cues of theGroupCue as list) -- Trying to move the last cue to the end will result in a non-functional copy of it

move cue id eachCueID of theGroupCue to end of theGroupCue

end repeat

set shuffledCues to cues of theGroupCue

repeat with i from 1 to countCues

set eachCue to item i of shuffledCues

if i is not countCues then

set post wait of eachCue to (duration of eachCue) + userOverlap

set continue mode of eachCue to auto_continue

else

set post wait of eachCue to 0

set continue mode of eachCue to do_not_continue

end if

end repeat

end tell

end tell


which i thought would probably be a good starting point.  However as I am not an Applescript expert I don't really know how to move forward.  Would anyone be able to give me a few pointers.  Thanks in advance

 

Lucas Krech

unread,
Apr 5, 2014, 9:16:06 AM4/5/14
to ql...@googlegroups.com
Why not two groups that loop each set to fire random child and continue to next group. First group has audio files to play. Second group has silent audio of varying length. No scripting needed. 

-L

*insert witty mobile device advertising here*
--
--
Change your preferences or unsubscribe here:
http://groups.google.com/group/qlab
 
Follow Figure 53 on Twitter: http://twitter.com/Figure53

---
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.
For more options, visit https://groups.google.com/d/optout.

Sebastian Frost

unread,
Apr 5, 2014, 10:41:44 AM4/5/14
to ql...@googlegroups.com
Here's a small version of a Qlab soundscape generator that I use for this kind of purpose - this version has very few WAIT cues, but you can obviously add more.

Seb

RandomLoop.cues.zip
Message has been deleted

Geoffrey Dyson

unread,
Apr 5, 2014, 2:25:49 PM4/5/14
to ql...@googlegroups.com
Thanks very much for your contributions. 

 Lucas I like your idea but I can't work out how to configure a cue so that it switches to the other group after playing.  I haven't used Qlab for a long time so I'm struggling a bit.  

Sebastian, thanks for the file.  The only difference is that I want just one track to play at a time instead of having simultaneous tracks.  I haven't worked out yet just how to do that.  But thanks so much for your rapid replies.


Geoffrey Dyson

unread,
Apr 16, 2014, 3:02:18 AM4/16/14
to ql...@googlegroups.com
Here's the solution I found for this problem which may come in handy for someone else.  A simple Applescript that is set up in Automator with a link to Calendar Events, meaning that when the time and date correspond to the Calendar Event the Applescript runs and starts up a random track with the specified playlist group.
automator.jpg
Qlab window.jpg
calendar.jpg

Rich Walsh

unread,
Apr 16, 2014, 3:45:39 AM4/16/14
to ql...@googlegroups.com
You do realise you could just add a Start Cue directly in QLab with a wall clock trigger, don't you?

This solution doesn't quite achieve what you originally outlined, in that it doesn't randomise the times at which tracks will play. It also has no protection against playing the same track twice in a row. You could implement that by using cuelists instead of random Group Cues, and shuffling them at the start of each day.

Rich

On 16 Apr 2014, at 08:02, Geoffrey Dyson <dys...@gmail.com> wrote:

Here's the solution I found for this problem which may come in handy for someone else.  A simple Applescript that is set up in Automator with a link to Calendar Events, meaning that when the time and date correspond to the Calendar Event the Applescript runs and starts up a random track with the specified playlist group.

--
--
Change your preferences or unsubscribe here:
http://groups.google.com/group/qlab
 
Follow Figure 53 on Twitter: http://twitter.com/Figure53

---
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.
For more options, visit https://groups.google.com/d/optout.
<automator.jpg><Qlab window.jpg><calendar.jpg>

Drew Schmidt

unread,
Apr 16, 2014, 3:45:37 PM4/16/14
to ql...@googlegroups.com
Attached is another solution. The logic is ...

1) Have a group that fires a random audio cue
2) Follow into a Script cue that Arms all the audio cues in that group (in order to undo the next step's previous iteration)
3) Follow into a Script cue that Disarms the currently playing audio cue so that it can't be selected again the next time around
4) Follow into a group that fires a random start cue that loops the entire sequence. Each start cue then has a different prewait time that you could change.

Added to this then is
 - A stop cue triggered by the wallclock that disarms the Wait/Loop cue (#4). This stop will allow the sequence to end gracefully 
 - A start cue triggered by the wallclock that arms the Wait/Loop cue (#4) then starts the sequence (#1)


The only "gotcha" is that the current version of QLab may occasionally select a disarmed cue in a random group. The cue doesn't play, but you might end up having a cue played twice in a row because of this. Figure53 knows about this logic and are planning on changing this soon. 

Here is also a picture if you don't want to download the bundled file. 



And if you download the file. Sorry for the crappy cat sounds .... but it was highly entertaining for the people in my office
Random Cats.zip

Geoffrey Dyson

unread,
Apr 18, 2014, 2:36:30 AM4/18/14
to ql...@googlegroups.com
Thanks for your input Rich.  I do realise that this could have been done with the wall clock trigger, however I need to have this run for five months but only on given non sequential and irregular days and at given times. It seemed much easier to programme using Calendar, Automator and Applescript rather than to make hundred of Qlab triggers for those dates and times.
Reply all
Reply to author
Forward
0 new messages