MIDI sending via AppleScript cue

1,010 views
Skip to first unread message

Phil Manson

unread,
Feb 9, 2017, 9:33:02 AM2/9/17
to QLab
Hi all,

Can anyone think of or already know a way, of sending a custom midi message out via an AppleScript cue?

In my current workspace, I am prompting for the user to enter a value (number 32-63) and then I need this to take that number and send out a MIDI Message on the 1st midi port, with a velocity value to an external midi controller so that it can light up the corresponding button

For example,

If the user enters value 44, i want to send :

A midi note on channel 8, note number 44 and velocity 2

If the user enters 36, i want send

A midi note on channel 8, note number 36 and velocity 2


Currently, because I have 32 possible numbers, I have 32 different cues to trigger these, but was thinking there must be a nice way within Applescript to automate this, but have been coming up with nothing so far in my trawling .

Any help or thoughts, greatly appreciated

P


Rich Walsh

unread,
Feb 9, 2017, 9:43:34 AM2/9/17
to ql...@googlegroups.com
I don’t think there’s a way of sending MIDI without using an actual MIDI Cue, and starting that from within the script. There are a number of ways you could construct such a cue, based on the user input, eg:

tell application id "com.figure53.QLab.3" to tell front workspace
set dummyCue to cue "MIDI_Dummy"
set byte one of dummyCue to text returned of (display dialog "Enter a number:" default answer "")
start dummyCue
end tell

You can dress it up a bit by insisting on an integer, etc.

Rich

Phil Manson

unread,
Feb 9, 2017, 9:45:54 AM2/9/17
to QLab
That's great, Rich 

Had looked in the applescript dictionary, and overlooked the variables for a midi cue itself, and was scratching my head just looking at factors for a generic cue !

This is absolutely brilliant.

And many thanks

Phil

Phil Manson

unread,
Feb 9, 2017, 10:59:56 AM2/9/17
to QLab
Have implemented the changes, Rich

Thanks again...

It has got me thinking about using the DUMMY CUE facility to manipulate my ARM, START and DISARM cues, but I am having trouble finding the script to change the TARGET CUE of each of these?

I have used both set file target and set cue target, again using a variable that is entered, but it doesn't seem to work (?)

Will keep trying, but is there anything I might need to know, as when I look at the DICTIONARY in Applescript for QLab, there doesn't seem to be a specific list of commands for ARM, DSARM or START cues, just generic cue information

Once again, any help would be great - 

I look forward to posting my successful workspace !

Thanks again

P



On Thursday, February 9, 2017 at 2:43:34 PM UTC, Rich Walsh wrote:

Rich Walsh

unread,
Feb 9, 2017, 11:13:41 AM2/9/17
to ql...@googlegroups.com
You don’t need dummy cues for arm, disarm or start as you can script those directly:

start cue "1"
set armed of cue "1" to true
set armed of cue "1" to false

Cue targets:

set cue target of cue "1" to cue "2"

Have you looked at the QLab wiki? There are lots of examples of this sort of thing there…

There’s a script in my post from earlier this week that manipulates many cue properties (Batch adjust selected), which might help show you how to do some of this.

Rich

Phil Manson

unread,
Feb 9, 2017, 11:33:23 AM2/9/17
to QLab
Thanks once again, Rich

Invaluable help is really assisting...

I think I have found that my problem is that I am trying to read my values from the NOTES field of a cue where I ams boring the information that has been entered

I am then trying to convert this into an integer rather than a string, but i think it is this that is causing me a few hiccups

My SCRIPT to try and start the selected cue is :

tell application id "com.figure53.QLab.3" to tell front workspace
set TRIGGERNUMBER to notes of cue "RECEIVE MIDI NOTE" as integer
start cue TRIGGERNUMBER
end tell


...... and it is this that i am not getting to work

I think I will adjust how the information is entered and stored, and once again, Many thanks

Ta

PHIL

Rich Walsh

unread,
Feb 9, 2017, 11:42:12 AM2/9/17
to ql...@googlegroups.com
q number isn’t an integer:

q number (text) : The number of the cue. Unique if present.

If you’re using the form start cue someVariable then someVariable needs to be text. If you send a number you’re addressing, say, the first cue in the workspace – not the cue called “1”.

If confused try:

get q number of cue TRIGGERNUMBER

It probably won’t be TRIGGERNUMBER.

(As always, you should be working in Script Editor to build and troubleshoot scripts.)

Rich
Reply all
Reply to author
Forward
0 new messages