Jump to content

Scripting Logic Pro X using Keyboard Maestro


carlcaulkett

Recommended Posts

I've been trying to use Automator/Keyboard Maestro (trial) to automate the process of converting lots of presets to au.presets.

But I cant figure out how. I tried following @des99's method for KM but didnt quite understand it.

Maybe if someone would make a tutorial or something on how to do this.

 

That way others could use this method which could make others contribute factory presets faster.

Any help would be appreciated!

Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...

I found this script on the Soundflow forum for adding a plugin to the first available channel slot in Logic Pro. It's set up to add an instance of Fabfilter Pro-Q3 but could be adapted for any plugin in theory. I'm wondering if there's a way to trigger it without needing Soundflow, as their Logic support is currently quite limited. Any script geniuses out there who can make sense of this?

 

```applescript

```applescript

const logic = sf.ui.app('com.apple.logic10'); const pluginPath = ['Audio Units', 'FabFilter', 'FF Pro-Q 3'];

 

function openInspector() {

const inspectorBtn = logic.mainWindow.groups.whoseDescription.is('Control Bar').first.checkBoxes.whoseTitle.is('Inspector').first;

 

if (!inspectorBtn.isCheckBoxChecked) {

inspectorBtn.elementClick();

}

}

 

function addInsertNextFreeSlot(pluginPath) {

const inspector = logic.mainWindow.groups.whoseDescription.is('Inspector').first;

 

inspector.childrenByRole("AXList").first.groups

.filter(group => group.children.whoseDescription.is('Mixer').first.childrenByRole("AXLayoutItem").first.buttons.whoseDescription.is('audio plug-in').first.exists)

.map(group => group.children.whoseDescription.is('Mixer').first.childrenByRole("AXLayoutItem").first.buttons.whoseDescription.is('audio plug-in').first.popupMenuSelect({

menuPath: pluginPath,

}));

}

 

function main() {

logic.appActivateMainWindow();

logic.mainWindow.invalidate();

 

openInspector();

 

addInsertNextFreeSlot(pluginPath);

}

 

main();

 

sf.keyboard.press({ keys: "right, return", });

```

```

Link to comment
Share on other sites

  • 5 weeks later...

[soundCloud][/soundCloud]

That isn't AppleScript, and I don't know for sure what it is or how it is supposed to work in sound flow.

 

Not being a Soundflow user myself, I can't shed any light I'm afraid. According to the forum it does work, so I'm hopeful that some genius out there knows how to turn this into something usable for the Keyboard Maestro users among us.

 

https://forum.soundflow.org/-3719/is-there-a-select-plug-in-for-insert-logic-pro-x

Link to comment
Share on other sites

What I gather is that soundflow has its own embedded scripting language, which is using javascript, but with extensions to do the wonderful things that soundflow can do. that's all I know at this point. The subscription price they want for it is way too high for me to justify, but it does look like it might be best in class work flow automation, especially if you're using ProTools.

 

Anyway, I don't see any way that script is going to work outside of Soundflow.

 

I'm just getting up to speed with Keyboard Maestro... I think its hypothetically possible to program things that would open your desired plugin and control it...But...would probably be quite finicky in actual use...

 

It would probably be better in that kind of situation to setup smart controls linked to the parameters you want and then use key commands and/or keyboard maestro to control the smart controls...but who knows..I haven't tried anything like that. KM looks to be pretty deep and can do a lot, but the problem here has more to do with how little LogicPro is exposed for outside apps to automate it.

Link to comment
Share on other sites

I am curious what effective, useful and must-have macros for KM people are creating and using? I want to make some for LogicPro, Dorico and some other apps, but I only have a couple things definitely in mind that are simple for Dorico and when I think about LogicPro I can't even think of what I would do that isn't already covered by key commands and wouldn't also be impossible to do.
Link to comment
Share on other sites

I don't think that there is a set that any two people can agree upon, as everyone's workflow situation, personal preferences (do I rather use the mouse or do I use key commands, etc.?) and also frustration threshold are very much different.

 

I'll list a couple of my KM macros in order of depth of the rabbit holes you must get into to understand their purpose

 

1. Very simple ones, useful in all apps

Today's date on a key

 

My email address on a key

 

Single letter keys to directly jump to one of many currently open apps, which I do a lot:

- ctrl-L > Logic

- ctrl-W > Word

- ctrl-D > Davinci Resolve

- ctrl- C > Chrome

- ctrl-4 > Cinema 4D

- ctrl-P > Photohop

- ctrl-O > OBS

 

Any menu command of any app which can't be assigned to a key

 

2. Overcoming recent OS limitations ("Hey Apple, in Logic I have chosen to keep using the Tab key the way *I* like it, thank you")

 

- tab > Play From Selection

- option-tab > Goto Selection Start

- shift-tab > Goto Selection End

 

3. A bit more involved sequences of actions

 

Putting Logic's Region Gain and Fade Ins / Outs on keys

 

Hitting a MIDI drum pad makes a PDF viewer turn pages of a lead sheet, likewise, choosing a scene for one specific song of the set makes the PDF viewer jump to the correct page

 

Opening one app automatically opens one or more others (if I work in Sketchup, I also need Raster to show a zoom-independent grid and iCheckClock for time reporting to bill my clients properly)

 

MS Outlook has lost its ability to switch email accounts, so i now have a KM sequence to

- Quit Outlook in case it's running

- Launch the hidden Outlook Profile Manager

- Select another account

- Close OPM

- (re)launch Outlook

 

4. Putting parts of complex workflows onto single keys

Getting 50 videos that have been synchronized in Davinci as TIFF-sequences with correct length, names an subfolders into Cinema 4D is not exactly a one-click affair, but being able to initiate

- Select all Clips on a track

- Open the Clip Attributes window

- Tab into the clip name field

- Copy the name

- Close the Clip Attributes window

- Create a Compound Clip from the selection

- Paste the just copied name into the Compound Clip's name field

- Select the next track

from just one key gets it pretty close to being one.

 

5. Entirely automated workflows

I have a couple of these, but they are by nature very specialized. Think along the lines of "Ok, I bought a drum module with a large, highly multi-sampled library in a proprietary format and I'm going to extract and convert all its 15000+ samples into EXS format, complete with every drum name, sample name and velocity range, in less than a day."

Link to comment
Share on other sites

I've managed to figure out how to insert plugins using Keyboard Maestro and PlugSearch together, using the 'found image' action. It's fiddly, inelegant and has some limitations, but if you're aware of them it works just fine. It took a fair bit of work to get going! So now I can hit a button on my Stream Deck and the chosen plugin will be inserted into the first available slot in the selected channel.

 

I'll detail my Logic Stream Deck / Keyboard Maestro macros:

 

- Panning and fader bumps: One button for each increment of panning using CC10 and approx 3db bumps in either direction for fader level.

- Fade in/out/crossfade on buttons, set to 1/10/30/100 and one with a pop-up prompt where you can enter your own value.

- Region gain up or down by 1/3/6db, on buttons.

- Region end to playhead (for reverse cymbals and the like, when you want them to end at a specific point)

- As mentioned before, plugins on buttons, categorised in folders and subfolders on the Stream Deck

- De-ess with one button: loads Melodyne ARA into the first channel slot, plays and stops the audio to load it into the plugin, selects all, switches to Sibilant Balance tool and turns Sibilant Balance down to -40%, then closes the plugin window.

- Transport controls on the Stream Deck.

- Copy selected midi up/down an octave, up a fifth or down a fourth.

- Reset tempo data for selected audio.

- All UAD Console presets on dedicated buttons, bypassing the "Do you want to save" dialogue, so I can switch amp sims or routing options in one press.

- Hitting record in Logic disables my headphone/speaker correction (if it's enabled) and switches my Console headphone routing to direct to avoid latency from Sonarworks, which I use via Audio Hijack.

- UAD Console extras: listen in mono, mute speakers.

Link to comment
Share on other sites

I am curious what effective, useful and must-have macros for KM people are creating and using? I want to make some for LogicPro, Dorico and some other apps, but I only have a couple things definitely in mind that are simple for Dorico and when I think about LogicPro I can't even think of what I would do that isn't already covered by key commands and wouldn't also be impossible to do.

 

You should be driven by need, rather than what's possible. If you have no need of anything, then that's easy enough to implement! ;)

 

I use KM a lot for many reasons with many applications. For Logic, I don't require KM stuff for general music use, but I have two specific cases where I use it a lot - one is to save out plugin presets to Logic presets, so KM will for example, get the current patch name and bank, then save a Logic preset with that name (creating the necessary folders), increment the patch, and repeat.

 

The other one is to batch change controller assignments. I've I need to change, for instance, Vpot assignments from relative to absolute mode, and change direct to scaled, for 100+ assignments, and I simply get KM to do it for me - select the first assignment ,and KM will change the parameters to what i need, then move on to the next assignment, etc. These kinds of batch changes can be very painful done manually, but a lot more workable getting the computer to do it as a batch.

 

So both those needs are basically remote-controlling Logic to perform repetitive batch operations. But obviously there is a world of possibilities out there, including setting key or MIDI shortcuts to functions that don't have key commands, or operations with one trigger that do multiple things in sequence, and so on.

Link to comment
Share on other sites

 

You should be driven by need, rather than what's possible. If you have no need of anything, then that's easy enough to implement! ;)

 

Maybe I just don't know what I don't know. I'd like to hear how other people are using KM to make their life easier, maybe I will go "aaha,...I need that too!".

 

 

I use KM a lot for many reasons with many applications. For Logic, I don't require KM stuff for general music use, but I have two specific cases where I use it a lot - one is to save out plugin presets to Logic presets, so KM will for example, get the current patch name and bank, then save a Logic preset with that name (creating the necessary folders), increment the patch, and repeat.

 

I like it

 

The other one is to batch change controller assignments. I've I need to change, for instance, Vpot assignments from relative to absolute mode, and change direct to scaled, for 100+ assignments, and I simply get KM to do it for me - select the first assignment ,and KM will change the parameters to what i need, then move on to the next assignment, etc. These kinds of batch changes can be very painful done manually, but a lot more workable getting the computer to do it as a batch.

 

Another good one. thanks for sharing!

 

I bought KM mainly for controlling Dorico, which really needs it. but I plan to expand to many apps and different things, but now I'm just asking people how they are using it so that I can think of things also. it goes without saying that if I find myself doing some long and tedious thing over and over again, if I can find a way to script it with KM I will. But I'm just asking what you guys have been using it for.

 

thanks for telling me your two main ways in logicPro.

Link to comment
Share on other sites

@dewdman42, In case it wasn't clear before, that list of stuff I wrote out is all KM macros assigned to buttons on the stream deck but you don't need a stream deck to use them. I think I've given you a pretty good idea of what's possible.

 

@des99, I've been using Murgaa to automate plugin preset saving (UAD H910 for example), but I'd be interested to know how your KM macro works. with Murgaa, you record a sequence, then start playback and walk away. Does your macro repeat the process until complete or do you have to manually keep triggering it for each preset?

Link to comment
Share on other sites

@des99, I've been using Murgaa to automate plugin preset saving (UAD H910 for example), but I'd be interested to know how your KM macro works. with Murgaa, you record a sequence, then start playback and walk away. Does your macro repeat the process until complete or do you have to manually keep triggering it for each preset?

 

It's much more advanced than that, and has evolved to use a few different methods as you need to use different methods for different plugins. I think I've documented this before but in short I have a main script than handles initialising, and the main loop, then I have sub-macro scripts for getting patch/bank names from the plugin, saving as a Logic patch etc. I can essentially do whatever I need to, and like I say it various between plugins.

 

So I can work through the entire plugin's presets automatically, picking up bank names and creating the necessary bank names in Logic's presets directories and saving the named patches there.

 

If there is no way to get bank names from the plugin, then I can flip some different variables and it will ask me to input a bank name manually, then work through that bank, move on to the next bank and prompt for that name etc. I have versions where if you can't pull out the patch names from the plugin directly, i can pull them out from a finder window displaying the patch files and sync preset changes from that. Sometimes you have to get creative with this stuff!

 

And of course different plugins have different methods required for extracting names, so I tend to copy this macro set uniquely for each plugin type, and modify what I need to modify for that plugin/range of plugins(click in different places, use a different method to pick up the patch name etc). And I keep all those versions as I often need to go back to redo the plugin, or modify them for a new version (eg Arturia V4 to V5 etc).

 

I even have code in it to send me text updates of progress, so if I'm eg leaving it going all night, I can check my phone and see how many banks it's done, whether it's stopped and so on - this was invaluable for converting the Dexed stuff as there was well over 100,000 patches to do...

 

So it's basically evolved to do what I need to, and when I hit a new plugin and it requires something different, that method then gets added in...

Link to comment
Share on other sites

do you tend to use the image approach for clicking on things, or what are some of the most common KM approaches you used to get things done with LogicPro in particular?

 

Me? I use whatever the best methods are, bearing in mind the speed of getting things done.

If it's a simple macro I just need to run once for a one-time batch task, I'll often use the quickest/simplest method and don't need it to be bulletproof.

 

If it's something that I will re-use a lot, then I'll often build it a bit more robustly (and also refine over time). if I need to trigger things via the GUI, I will tend to use in this order:

 

- key commands (as this does not depend on the UI state at all)

- Clicking on things/buttons (or orientating) based on image recognition (because this doesn't require windows to be in particular positions etc)

- Clicking on a particular pixel location on screen (the most fragile as gui elements can be in different places, but fine for one time tasks etc)

 

You can often use image recognition to determine state (eg, if the image at this location matches this disabled button state, do one thing, but if it matches this enabled button state, do something else, etc). Image recognition is one of KM's super-powers (as is triggering by MIDI commands, which I also use a lot to set up actions from connected MIDI controllers - eg, I trigger a hands-free image scan process from a footswitch connected to my MIDI keyboard, as an example).

 

But really every task has different implementation problems to solve, depending on what needs to be done. It's essentially a very simplified form of programming, and there's often many ways to implement a given task.

Link to comment
Share on other sites

Yeah I've gone pretty deep with some logic macros with a lot of if/else actions within if/else actions, dependent on one or multiple found images. It can get pretty confusing if you don't rename things with handy descriptions as you go! I have to admit when one of them goes a bit janky and doesn't work as expected, I feel a mixture of frustration and excitement that I get to dive into it and solve the problem. It's tantamount to a hobby! Dear lord I need to get out more! (Don't we all!)
Link to comment
Share on other sites

  • 4 months later...
  • 5 months later...

 

Just checked this out, really cool stuff! I don’t use KB though... could you please explain the set of commands that go into “Region End to Playhead”? My crude way of doing this is simply zooming in and nudging by samples until the Region end or end of the waveform touches the Playhead.

 

I do use Better Touch Tool so I can set up my own macro.

Link to comment
Share on other sites

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...