Jump to content

Change Region Gain With Key Commands


speakerfood

Recommended Posts

With a little reverse engineering I managed to create an AppleScript that changes the gain/velocity of a selected region.

You can call this script with an application like yKey, and have it mapped to any shortcut you like.

http://plumamazing.com/mac/ykey/

 

Note: this only works if you have the Control Bar visible at the top, and the Region inspector is open.

 

Applescript to change the gain +3dB or the velocity of a MIDI region by 30:

 

tell  application "System Events"

tell  process "Logic Pro X"

tell  row 6 of  outline 1 of  scroll area 1 of  group 1 of  list 1 of  group 2 of (first  window  whose  name contains "- Tracks")

set  x to (get  value of  slider 1)

set  value of  slider 1 to  (x + 30)

end  tell

end  tell

end  tell

 

Applescript to change the gain -3dB or the velocity of a MIDI region by -30:

 

tell  application "System Events"

tell  process "Logic Pro X"

tell  row 6 of  outline 1 of  scroll area 1 of  group 1 of  list 1 of  group 2 of  (first  window  whose  name contains  "- Tracks")

set  x to  (get  value of  slider 1)

set  value of  slider 1 to  (x + 30)

end  tell

end  tell

end  tell

Link to comment
Share on other sites

  • 1 year later...
With a little reverse engineering I managed to create an AppleScript that changes the gain/velocity of a selected region.

I just tried this, and it seems to change the Fine Tune in the Inspector instead of the Gain parameter.. any help? I do have both the Control Bar and Region Inspector visible by the way. Would be great if I get this working!

Link to comment
Share on other sites

Try this instead:

Thanks so much Eric!

 

Also, for anyone interested I'm using the Better Touch Tool app to run this script via custom key commands. It is 3 times (suggested Pay-What-You-Want price) cheaper than the Y Key app that was suggested in the initial post, and you can remap your Trackpad and regular key commands to do whatever you want. Better Touch Tool has about 80% of the features that Y Key has as well.

Link to comment
Share on other sites

  • 4 months later...
I have the macro working but it seems to conflict with Logic Key commands? Every time I hit the keys I assigned Logic just flashes gray (like it does when you hit a key that isn't assigned anything). This could be such a great workaround if I can figure this out!
Link to comment
Share on other sites

I have the macro working but it seems to conflict with Logic Key commands? Every time I hit the keys I assigned Logic just flashes gray (like it does when you hit a key that isn't assigned anything).

 

It's most definitely conflicting with a Logic key command if it's flashing like that, you should probably check out the Logic's Key Commands window. One good way to test out whether the key commands you've set conflict with Logic's or not is by assigning them to an un-assigned Logic function first just as a test. If there are conflicts you will immediately be alerted with a pop up message.

 

The other thing you need to keep in mind is that the Inspector on the left must be visible for this to work, it doesn't work with the Region Inspector float window.

Link to comment
Share on other sites

Thanks for the scripts! I use a tiny application called "FastScripts" which is all about script execution.

I saved 2 scripts - one for +3 dB, one for -3 dB, assigned keypress SHIFT-OPTION-F11 and SHIFT-OPTON-F12 - that's where the speaker up/down icons are on the Apple keyboards - wheee!

 

FastScripts from Red Sweater Software is $9.95

Link to comment
Share on other sites

I'm using Keyboard Maestro. It works if I click to run the macro, but if I try to actually hit the hotkey I set (ctrl - option - up arrow) it just flashes. I've checked and this isn't set for anything else in Logic. Usually it flashes when you hit a hotkey that hasn't been set to anything, correct?

 

I guess I can mess with different hotkeys. Not sure why this is happening.

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
One issue I've noticed with this is if I have a movie in the side panel it messes it up. Any idea how to fix this?

 

It changes the numbering of the windows in the side panel, probably.

I will try to figure out how to access GUI elements by their name instead of index.

Don't know if this is possible. Would make this script a little bit more future proof.

Link to comment
Share on other sites

Here's an improved version of the script. It works as long as you don't put the string "- Tracks" in the name of your session, which is very unlikely I guess.

 

tell application "Logic Pro X"

tell application "System Events"

tell process "Logic Pro X"

set tracks_window to title of first window whose title contains "- Tracks"

tell row 8 of outline 1 of scroll area 1 of group 1 of list 1 of group 2 of window tracks_window

set x to (get value of slider 1)

set value of slider 1 to (x + 10)

end tell

end tell

end tell

end tell

Link to comment
Share on other sites

Here's an improved version of the script. It works as long as you don't put the string "- Tracks" in the name of your session, which is very unlikely I guess.

 

tell application "Logic Pro X"

tell application "System Events"

tell process "Logic Pro X"

set tracks_window to title of first window whose title contains "- Tracks"

tell row 8 of outline 1 of scroll area 1 of group 1 of list 1 of group 2 of window tracks_window

set x to (get value of slider 1)

set value of slider 1 to (x + 10)

end tell

end tell

end tell

end tell

 

Hmmm, just tried this script and it doesn't appear to be working. The very first script you posted worked, but liked morganmd, I ran into problems with it not working when there was a movie in the project. Any help?

Link to comment
Share on other sites

  • 1 month later...

The movie window messes up the UI Elements order. If you use a seperate window for the movie it should work.

And here is an update to the script:

 

tell application "Logic Pro X 10.3.0"

tell application "System Events"

tell process "Logic Pro X"

set tracks_window to title of first window whose title contains "- Tracks"

if (description of group 1 of window tracks_window = "Control Bar") then

set group_nr to 2

else

set group_nr to 1

 

end if

tell row 8 of outline 1 of scroll area 1 of group 1 of list 1 of group group_nr of window tracks_window

set x to (get value of slider 1)

set value of slider 1 to (x + 10)

end tell

end tell

end tell

end tell

 

BTW: I'm on 10.12.6. Maybe High Sierra or Mojave also has influence on the interface.

Link to comment
Share on other sites

This script also works with the non-floating movie window.

 

tell application "Logic Pro X"

tell application "System Events"

tell process "Logic Pro X"

set tracks_window to title of first window whose title contains "- Tracks"

if (description of group 1 of window tracks_window = "Control Bar") then

set group_nr to 2

else

set group_nr to 1

end if

if (value of static text 1 of group 1 of list 1 of group group_nr of window tracks_window is "Movie") then

set sub_group_nr to 2

else

set sub_group_nr to 1

end if

tell row 8 of outline 1 of scroll area 1 of group sub_group_nr of list 1 of group group_nr of window tracks_window

set x to (get value of slider 1)

set value of slider 1 to (x + 10)

end tell

end tell

end tell

end tell

 

In the attachment are my Keyboard Maestro macro's.

Logic Pro X Clip Gain Macros.kmmacros.zip

Link to comment
Share on other sites

  • 2 months later...

My apologies for the typo. I meant the Fade Out Type in the Inspector window. There are 4 values: Out, X, EqP, and X S.

 

The below AppleScript was posted earlier to change the Region Gain (and works perfectly). Can this be modified to change the Fader Out Type?

 

Thanks for the help!

 

tell application "System Events"

tell process "Logic Pro X"

tell row 8 of outline 1 of scroll area 1 of group 1 of list 1 of group 2 of (first window whose name contains "- Tracks")

set x to (get value of slider 1)

set value of slider 1 to (x + 30)

end tell

end tell

end tell

Link to comment
Share on other sites

You can use this script. Modify it to go to an exact type, by changing the keycode 125 to match the first letter of the type. If you only use this script, you also need a script to go up in the menu (key code 126 is arrow up.

 

BTW, this script is an improvement to previous scripts, because it also works when a movie is present or when Control Bar is not shown.

 

tell application "Logic Pro X"

tell application "System Events"

tell process "Logic Pro X"

set tracks_window to title of first window whose title contains "- Tracks"

if (description of group 1 of window tracks_window = "Control Bar") then

set group_nr to 2

else

set group_nr to 1

end if

if (value of static text 1 of group 1 of list 1 of group group_nr of window tracks_window is "Movie") then

set sub_group_nr to 2

else

set sub_group_nr to 1

end if

tell pop up button 1 of row 14 of outline 1 of scroll area 1 of group sub_group_nr of list 1 of group group_nr of window tracks_window

click

delay 0.2

key code 125

key code 36

end tell

end tell

end tell

end tell

 

My apologies for the typo. I meant the Fade Out Type in the Inspector window. There are 4 values: Out, X, EqP, and X S.

 

The below AppleScript was posted earlier to change the Region Gain (and works perfectly). Can this be modified to change the Fader Out Type?

 

Thanks for the help!

 

tell application "System Events"

tell process "Logic Pro X"

tell row 8 of outline 1 of scroll area 1 of group 1 of list 1 of group 2 of (first window whose name contains "- Tracks")

set x to (get value of slider 1)

set value of slider 1 to (x + 30)

end tell

end tell

end tell

Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...