A technical support community for Apple Logic Pro users.

 
User avatar
carlcaulkett
Topic Author
Posts: 128
Joined: Sat May 13, 2017 2:50 am

Scripting Logic Pro X using Keyboard Maestro

Thu Jul 12, 2018 4:34 pm

Hello, over in `Patches, Plug-In & Channel Strip Settings` you may have seen the thread `3rd Party Plugin factory presets database for Logic`. It's been going for 11 years and has grown so big that recent reports have said that it can be observed from space!

Many folks have used a variety of means to automate the process of generating Logic presets from plugins so that they can be browsed using Logic's library. Recently, I had some success using an automation tool called Sikuli but it has transpired that the smart kids around here use Keyboard Maestro for their macro needs.

This post, therefore, is intended to be the start of a thread which deals, not only with generating presets but with the wider issue of automating Logic Pro X in general but with a special emphasis on using Keyboard Maestro.
Logic 10.5
macOS 10.14.6 Mojave (thanks to dosdude1.com/mojave)
Apple Mac Pro (early 2009) - 4,1 -> 5,1 - 32GB RAM - 2.66 GHz Quad-Core Intel Xeon
Novation Impulse 49
Novation Launchpad X
Scarlett 2i2 Audio Interface
 
jdoo
Posts: 104
Joined: Tue Feb 07, 2012 5:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Thu Jul 12, 2018 5:10 pm

I'll start. A couple of years ago, user des99 posted up his method of utilizing Keyboard Maestro. I modeled what I created after his approach and consider it the gold standard of how to use KM for turning soft synth patches into AU Presets.. His post is at this location: viewtopic.php?f=8&t=15267&p=623825#p623825
Last edited by jdoo on Thu Jul 12, 2018 5:19 pm, edited 1 time in total.
Logic Pro 10.4.1 MainStage 3.3.2 OS X 10.14 iMac i5 2.7 8 GB
 
jdoo
Posts: 104
Joined: Tue Feb 07, 2012 5:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Thu Jul 12, 2018 5:15 pm

Also... (as long as we're here). There was a recent thread on GearSluz, where a user (@vanhaze) posted up a list of the macros that he has created for Logic Pro. The list is at this location: https://imgur.com/Q9B1VJH . Some good ideas imo.

Joe
Logic Pro 10.4.1 MainStage 3.3.2 OS X 10.14 iMac i5 2.7 8 GB
 
jdoo
Posts: 104
Joined: Tue Feb 07, 2012 5:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Thu Jul 12, 2018 5:49 pm

This is in the big thread but.. is important.

If you're going to generate Logic AU Presets presets for a commercial library and plan on sharing them, please work directly with the developers - and let them distribute the au instruments with their commercial libraries. These AU Instruments can bypass other restrictions on their libs. I learned this, early on from Urs Heckman. I am thankful I asked :) as he pointed out that the settings from their presets get baked into the au instruments.. negating the need for someone to actually purchase their commercial libraries. Since then, I have been sharing au presets that I generate - but only directly with the developers. I've done this with a few u-he lib developers, and a handful of others. I can probably share the macros I use.. but there is no documentation (short of Des' description of how to approach this). :) Anyway - I'll post up an export of what I have used, which might be a good starter for someone new to this.

Joe
Logic Pro 10.4.1 MainStage 3.3.2 OS X 10.14 iMac i5 2.7 8 GB
 
User avatar
anp27
Posts: 1728
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Scripting Logic Pro X using Keyboard Maestro

Thu Jul 12, 2018 6:21 pm

jdoo wrote:
Also... (as long as we're here). There was a recent thread on GearSluz, where a user (@vanhaze) posted up a list of the macros that he has created for Logic Pro. The list is at this location: Some good ideas imo.


Yup, I participated in that thread, and I'm demoing Keyboard Maestro right now :) Since you're a KM user, I'm trying to replicate van haze's Trim Region End to Mouse macro but I feel like I'm missing certain pieces... I think it has something to do with the Move or Click Mouse action but then I get stuck. I'd like to know what the Action name is for the moving the region to the mouse. Any help?
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM Macbook Pro 15" (early 2011) 2.3 Ghz i7~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.1~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61
 
User avatar
des99
Posts: 5151
Joined: Tue Jan 27, 2015 12:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Thu Jul 12, 2018 6:34 pm

Thanks for starting the thread. I’m primarily using KM (at least in conjunction with Logic - I use it for quite a few other purposes too) for creating Logic presets, so I’ll try to go into a bit more detail about my approach with some more concrete examples and script examples when I get the time to document them.

Then I’m sure as the thread develops I’ll try to contribute as I can...
Last edited by des99 on Thu Jul 12, 2018 6:53 pm, edited 1 time in total.
mu:zines | music magazine archive | difficultAudio
 
User avatar
anp27
Posts: 1728
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Scripting Logic Pro X using Keyboard Maestro

Thu Jul 12, 2018 6:42 pm

des99 wrote:
I’ll try to go into a bit more detail about my approach with some more concrete examples and script examples when I get the time to document them.

Please do! Until the day we finally see a native Macro feature in Logic, apps like these come in super handy and are a God send :D
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM Macbook Pro 15" (early 2011) 2.3 Ghz i7~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.1~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61
 
User avatar
des99
Posts: 5151
Joined: Tue Jan 27, 2015 12:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Thu Jul 12, 2018 6:46 pm

jdoo wrote:
This is in the big thread but.. is important.
If you're going to generate Logic AU Presets presets for a commercial library and plan on sharing them...


I'll go further on this and say - do not share commercial libraries, full stop. By all means convert your own purchased commercial libraries for yourself, but you do not have the rights to distribute commercial patches, whatever has been done to them. The preset sharing thread referenced above is for *presets that come with the instrument*, and thus, everyone who owns the instrument already owns those patches - creating Logic format versions as a convenience to owners of that instrument is generally fine.

But third party. commercial, paid-for or banks that are not free and publicly downloadable from the author are off-limits - as Joe says, you're simply sharing commercial products and making them freely available for everybody, which is very obviously a no-no.

By all means, as Joe says, if you want to work with the developer of those commercial libraries to create Logic versions, great. Then the copyright owner can decide how to distribute them, as is right and proper.
mu:zines | music magazine archive | difficultAudio
 
User avatar
des99
Posts: 5151
Joined: Tue Jan 27, 2015 12:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Fri Jul 13, 2018 7:57 am

anp27 wrote:
I'm trying to replicate van haze's Trim Region End to Mouse macro but I feel like I'm missing certain pieces... I think it has something to do with the Move or Click Mouse action but then I get stuck. I'd like to know what the Action name is for the moving the region to the mouse. Any help?


I'm not sure what's going on here - I'll try to have a look at that in a moment.

But remember, all KM is really doing is remote-controlling Logic - so, it's sending mouse clicks, or keyboard commands to Logic - there's often not much that's particularly "clever", except in the problem solving techniques of the script creator, perhaps, as macro controlling sometimes requires a bit of left-field inspirational creative problem solving...

Edit: Ok. So there are usually different ways to achieve a given goal. One way I can think of to do it would be:

- You have a region from bar 1 to bar 7
- Your mouse is at around the 5 1 0 0, over the region you want to trim, as you want to trim your region end to bar 5
- You execute the macro, which does:
- Step 1: Send key command to select Logic's Scissor tool
- Step 2: Click where the mouse is to split the region at that bar (this leaves the second region selected)
- Step 3: Send a Backspace key to delete the selected region
- Step 4: Send key command to re-select Logic's default arrow tool

Now this isn't necessarily the best way of doing this, and the GS poster doesn't say how he's implemented it, or what the exact behaviour is, so I don't know.

Might be a nice exercise for us to see how many other ways this could be done using Logic + KM...

Edit: I also came up with a few variations that afterwards I see someone in the GS thread also mentioned, which is using locators, but I think that's a less optimal solution as requires picking up the playhead position by clicking on the timeline vertically up from the mouse position (which I would regard as a bit "fragile"), setting rounded locators of the region and then right locator by playhead, and then trimming the region by the locators, then restoring the original mouse position.
mu:zines | music magazine archive | difficultAudio
 
User avatar
des99
Posts: 5151
Joined: Tue Jan 27, 2015 12:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Sun Jul 15, 2018 2:34 pm

Oh, I just remembered another use I put KM to in Logic - batch processing Logic's controller assignments.

You can't just select a bunch of assignments and change a parameter for all of them - only the first one of the group selected changes. So on occasions I've needed to change a whole bunch of assignments - hundreds or even thousands - and I used KM to make the change, step to the next assignment, make the change, etc in a loop.

Comes in handy!
mu:zines | music magazine archive | difficultAudio
 
sjgam
Posts: 130
Joined: Sun Sep 11, 2016 7:06 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Mon Jul 16, 2018 8:26 pm

Just got String Machines 2 and the preset name does not appear in Logic preset field as you advance with the Plugin preset arrows. It’s in the UVI workstation and I can’t pull the preset name as the GUI does not appear to have its own save function to pull it that way. Any suggestion how to pull preset name to copy and save?
 
User avatar
des99
Posts: 5151
Joined: Tue Jan 27, 2015 12:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Tue Jul 17, 2018 1:54 am

I don't think there's a direct way to get the patch names from the UVI Instruments, as there is no way to actually save patches or edit names within the plugin.

For instruments such as these, I will go to try a Finder method where you can try to pick up the name from the Finder in parallel with patch saving - unfortunately, the UVI instruments all bundle the content (samples + patches) together in one encrypted file, so the individual patches are not files, which rules out that method.

So, tricky one. If I were approaching this, I think what I would do would be this:

- Take screenshots of each of the subfolder contents you want to save (Bass, Bell, Fretted etc in the example below)
- OCR those into a text file, with each patch on a separate line - they will be in the same order that the plugin displays them
- Use the parallel method of name extraction during the save process (Ie, start at patch one, flip to the text editor, pick up name 1 into the clipboard/variable, go back to Logic, save the patch, paste in the name, increment the patch, loop...)

uvi.jpg
uvi.jpg (86.25 KiB) Viewed 2807 times

So, once you have the text file of the patch names, you're basically doing:

- Activate TextEditor (or whatever your text editor is)
- Select the first line
- Copy name
- Move to the next line ready for the next iteration
- Activate Logic
- Save As
- Paste name
- Increment the patch
mu:zines | music magazine archive | difficultAudio
 
User avatar
carlcaulkett
Topic Author
Posts: 128
Joined: Sat May 13, 2017 2:50 am

Re: Scripting Logic Pro X using Keyboard Maestro

Tue Jul 17, 2018 1:02 pm

There's an interesting thread over at viewtopic.php?f=5&p=708896#p657291 which talks about using Apple Script with and without Keyboard Maestro. From what I can gather, it appears that Apple Script is able to access some of the innards of Logic Pro X.
Logic 10.5
macOS 10.14.6 Mojave (thanks to dosdude1.com/mojave)
Apple Mac Pro (early 2009) - 4,1 -> 5,1 - 32GB RAM - 2.66 GHz Quad-Core Intel Xeon
Novation Impulse 49
Novation Launchpad X
Scarlett 2i2 Audio Interface
 
sjgam
Posts: 130
Joined: Sun Sep 11, 2016 7:06 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Tue Jul 17, 2018 6:41 pm

Wow ocr screenshot. I think as s KM newb I am going to manually do this one as it’s a few hundred not thousand.

des99 wrote:
I don't think there's a direct way to get the patch names from the UVI Instruments, as there is no way to actually save patches or edit names within the plugin.

For instruments such as these, I will go to try a Finder method where you can try to pick up the name from the Finder in parallel with patch saving - unfortunately, the UVI instruments all bundle the content (samples + patches) together in one encrypted file, so the individual patches are not files, which rules out that method.

So, tricky one. If I were approaching this, I think what I would do would be this:

- Take screenshots of each of the subfolder contents you want to save (Bass, Bell, Fretted etc in the example below)
- OCR those into a text file, with each patch on a separate line - they will be in the same order that the plugin displays them
- Use the parallel method of name extraction during the save process (Ie, start at patch one, flip to the text editor, pick up name 1 into the clipboard/variable, go back to Logic, save the patch, paste in the name, increment the patch, loop...)

uvi.jpg
So, once you have the text file of the patch names, you're basically doing:

- Activate TextEditor (or whatever your text editor is)
- Select the first line
- Copy name
- Move to the next line ready for the next iteration
- Activate Logic
- Save As
- Paste name
- Increment the patch
 
Angelos58
Posts: 206
Joined: Thu Jun 14, 2018 1:15 am

Re: Scripting Logic Pro X using Keyboard Maestro

Wed Jul 18, 2018 5:50 am

Just your opinion: Keyboard Maestro or Bome Midi Translator Pro? (or ... MidiPipe)
 
jdoo
Posts: 104
Joined: Tue Feb 07, 2012 5:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Thu Jul 19, 2018 6:43 am

sjgam wrote:
Just got String Machines 2 and the preset name does not appear in Logic preset field as you advance with the Plugin preset arrows. It’s in the UVI workstation and I can’t pull the preset name as the GUI does not appear to have its own save function to pull it that way. Any suggestion how to pull preset name to copy and save?


Aloha Steven -

Look at the presets I shared with you. In addition to other soft synths, I used those macros to generate presets for UVI Grand Piano Collection, Cameo, Falcon. Pretty certain I used the method that Des describes to save them. Check out the "Next Falcon and Next Falcon Lower" macros. Those position themselves within the UVI GUI, choosing to move to the next preset. Then - the macro issues a "SAVE AS" command, and from the pop up dialogue executes a Command-A (select all), and Command-C (Copy to buffer) from the area that has the preset name.. That copies the UVI preset name into the copy buffer. Finally - the macro finds and presses the [Cancel] button, closing that dialogue. This macros is embedded in the "2 SAVE a PRESET Many" macro.. which loops through xxx times within the GUI. So - you need to change this one, to call the UVI one (I believe it was set to "Next DIVA Preset" in the macros I sent you. Change that to Next Falcon Preset--- if you want to see it in action)

I know it's a little convoluted... which is why sharing stuff like this is difficult. There are a lot of ways of making this all work. It's far easier, when you can stick to just the Logic PRO GUI... but it's definitely possible to screen scrape preset names off the instrument GUIs too. The high level process is:
Loop xxx times --
Click within the GUI to select the next preset
Select SAVE AS from the Menu
Screen scrape the preset name (copy/paste the text) to the buffer
Close the Save AS dialogue
Save the preset
next . . .
Logic Pro 10.4.1 MainStage 3.3.2 OS X 10.14 iMac i5 2.7 8 GB
 
User avatar
des99
Posts: 5151
Joined: Tue Jan 27, 2015 12:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Thu Jul 19, 2018 7:18 am

You're doing this in Falcon though, not the UVI Workstation?

As I see it, in UVI Workstation, there is no Save As command (unless I'm missing something super obvious) and thus no way to get at the name at all... (hence the OCR recommendation, which should only take a few minutes to screenshot and compile the text file of names.)
mu:zines | music magazine archive | difficultAudio
 
sjgam
Posts: 130
Joined: Sun Sep 11, 2016 7:06 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Fri Jul 20, 2018 6:17 am

Yeah jdoo - not seeing how you are getting at the name to do a copy and paste in UVI workstation.
 
jdoo
Posts: 104
Joined: Tue Feb 07, 2012 5:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Fri Jul 20, 2018 7:07 am

des99 wrote:
You're doing this in Falcon though, not the UVI Workstation?

As I see it, in UVI Workstation, there is no Save As command (unless I'm missing something super obvious) and thus no way to get at the name at all... (hence the OCR recommendation, which should only take a few minutes to screenshot and compile the text file of names.)


Oh crap... I sure was! Must... read.... more....carefully - before replying. I thought I had used workstation for one or more plug-ins, and will try to dig up how I did it. Sounds like, I may have had to do manual generation though. Sorry for the diversion guys ...

Joe
Logic Pro 10.4.1 MainStage 3.3.2 OS X 10.14 iMac i5 2.7 8 GB
 
User avatar
des99
Posts: 5151
Joined: Tue Jan 27, 2015 12:08 pm

Re: Scripting Logic Pro X using Keyboard Maestro

Sun Jul 22, 2018 11:29 am

Interesting method for the Valhalla plugins.

Again, with these, there is no direct way of getting the patch name - when you click "Save", the current preset name does not populate the save dialog.

So, instead, the plugin has a "Copy patch to clipboard" feature, which creates a text representation of the patch to the system clipboard - so we do that, then use a regular expression text search step to extract the name from the patch in the clipboard. Works great!
mu:zines | music magazine archive | difficultAudio