Applescript to use midi cc slider/knob to control iTunes volume
Hey, didn't know where to share this, figured this was as good a place as any...
Because I am such a n00b at applescript, or any type of coding for that matter, when trying to figure out how to get a midi control knob to control my iTunes volume it turned to google, but to no avail...
So after much trial and error, I have written my own code that seems to work nicely and thought I should share it in case someone else like me is looking for a cut and paste answer.
So it is not perfect, as obviously iTunes addresses its volume from 0 to 100 and midi is 0 to 127, which means that any message above 100 is ignored, so it is full volume before the knob reaches its full volume, but it works. If anyone can suggest a better way, perhaps one that maps it more on a percentage scale? If that makes sense....
this is what I wrote:
on runme(message)
set myVariable to (item 3 of message)
if (item 1 of message = 176) and (item 2 of message = 109) then tell application "iTunes"
set sound volume to myVariable
end tell
end runme
I use this in my live set as an applescript in midipipe along side a bunch of other things to help me control mainstage better with my lexicon mpx R1 foot controller and behringer UMA25s keyboard.
So now I can have mainstage running in full screen mode, finish the last song of a set and click a button on my foot controller which I use an applescript to open itunes and play a specific playlist for while I'm on break. Then if it is too loud or quiet for the venue I am in, I can quickly change the volume with one of the knobs on my keyboard, rather than having to exit full screen, open iTunes window and fumble around with my trackpad and the tiny iTunes slider...
Feedback is welcomed, as I really have no idea what the **** I am doing!
MacBook Pro (13-inch Early 2011)