Bunch of questions (too many for separate posts)

I've been using KM for 6 months now and I finally have the confidence to ask all the questions I haven't asked yet. Here we go.

  1. Does a KM macro have the ability to freeze an app (saying this because it is ACTUALLY HAPPENING RIGHT NOW) even though it is not programmed to do so?
  2. [MUSIC PRODUCTION SOFTWARE USERS WILL UNDERSTAND THIS QUESTION BETTER] DAWs have master volume sliders. I could make a macro so that if a hotkey is pressed, it will look for the master volume slider (click & drag at found image) in the DAW I'm in (let's say Logic) and control it however I want. But how do I program the macro so that if the hotkey is held, it gradually controls the slider depending on how long I hold the hotkey?
  3. Can KM launch an application, and click a button that always appears when you open this application? Except it doesn't launch the application. For those who wonder what application, it's Focusrite Control. And I'm talking about the MUTE button.
  4. I own an application called Finale. It's a music notation program. In it is a plug-in called JW Pattern. When clicked, it shows a set of buttons for plug-ins (like hairpins, notation patterns, etc.), and each of these buttons leads to another set of plug-ins. And on and on. I want to go to a specific plug-in called "Hairpins". The thing is, every time I open up JW Pattern, the window shows the same set of plug-ins, but organized differently. Basically, with the macro I have set up now, it goes to Hairpins and does what I want, 60% of the time. Sometimes it goes to another plug-in in the JW Pattern window. How do I program my macro so that no matter what the window looks like, it will always go to "Hairpins"? Please don't make me add a hundred If Else and/or Click At Found Image actions to my macro. Please no. Please.
  5. [ONLY MUSIC PRODUCTION SOFTWARE USERS WILL UNDERSTAND THIS QUESTION] In GarageBand (and Logic), how do I program a macro that when I select a note in a MIDI region, it shortens/stretches it into a specific duration? I am not talking about Quantize. Example: typed string 1/4 turns selected note into a quarter note, typed string 1/1 turns selected note into a whole note.
  6. [ONLY MUSIC PRODUCTION SOFTWARE USERS WILL UNDERSTAND THIS QUESTION] In GarageBand (and Logic), I move the playhead to a specific location, and then I do the exact same thing but a different location, I activate a macro, it remembers first playhead location and it trims the selected region according to where the playhead has been. Basically Cubase's Cut At Locators but for GB/Logic. Aside from remembering first playhead location, the macro could also just pause until the second click or something.

That's all for now.

Cheers,
John.

1 Like

On its own? Unlikely. However, you totally have the ability to make KM freeze an app, eg by spamming it with commands, sending it to the back whenever it's at the front, and so on (and yes, I've both of those -- and more!). You'll know if it's a macro causing the problem, rather than an issue with the app itself, because you'll spot KM's menu bar icon rotating when the macro runs. Post the macro and perhaps someone will spot the problem.

You can't launch an app without launching the app :wink: You could, however, launch Focusrite Control, click the button, then quit the app again.

Apps with "mobile menus" can be a problem... Usually, the way round that is to emulate what you do naturally -- look for the menu item with an image detection action. It'll only need 100 of them if it's a really badly programmed app :wink: You might be able to get round it with a UI-based AppleScript, but that'll require some poking on your part...

I'll leave the rest for MUSIC PRODUCTION SOFTWARE USERS.

For #5 and #6 it sounds like you need KM to trigger based on something which is specific to those apps (i.e. "when I select a note in a MIDI region" or "move the playhead to a specific location"). I don't think it can, at least not without some kind of code which gives it "deeper knowledge" about the individual apps (like a "Logic Pro plugin", that would add additional event types to the list of what KM can recognize, as well as additional actions that KM could order the app to do as part of a macro).

It may be possible to "fake" the action by setting up a "Execute an Applescript" step, with the script saying something like ... tell application "Logic Pro" to Raise Master Volume or tell application "Logic Pro" to set duration of selected note to 1/4 or something like that (these are examples, I have no idea if Logic Pro even exposes an Appliescript dictionary, or if these are real commands) ... but creating a macro which triggers when you click a note is probably not possible.

I'm interested to see if anybody else responds, it's entirely possible that I'm wrong about there not being a way to set up the trigger - and if so I'd like to know about it, because I also have some ideas for automating things on my computer...

I want it to be triggered by a hotkey, not selecting the note.

Like this:
Step 1: I select the note
Step 2: I do a typed string trigger (e.g. literally just type 1/4)
Step 3: The selected note changes duration

That AppleScript makes a lot of sense though. I'll try something like that. It could work.

OP's using a typed string trigger in #5. And could use any trigger in #6 -- the problem there is that he wants KM to look back in time to see where the playhead was a couple of events before the trigger (but doable -- he could have a "Save PH First" macro that stored the first position to be used in a latter macro, or have a macro that he triggered after setting the playhead the first time then waited for an "OK" button after he set the second position).

There are all sorts of ways to trigger a macro -- and as those ways include via URL and via AppleScript there are loads more not-so-direct methods too. If you can catch an event you can probably use it as a trigger!

If the trigger is you typing 1 / 4 ... maybe? Again, I'm not sure if Logic Pro or Garageband even offer Applescript dictionaries that allow other apps to send them commands.

Also, be careful with the trigger string. 1/1 could be the beginning of 1/16, how is KM supposed to know when you're done typing? Also, remember that the keystrokes in the trigger string will still be processed by the app before KM does anything with them. If you've just selected a note on a MIDI grid and you type 1 /, is Logic Pro going to do anything in response to those keystrokes?

FWIW I have a DuckyPad with the keys programmed to send ⌃⌥⌘⇧F1 through ⌃⌥⌘⇧F15, with KM macros triggering on those keystrokes. My first thought when I read your question was to figure out how to set the selected note's duration to a specific value, then assign different Ducky keys to run the same macro with different values (i.e. "whole note", "half note", "quarter note", etc. down the left column, "dotted whole", "dotted half" etc. down the middle column) and then use the right column open for other functions.

And, if both playhead positions are inside a MIDI region (e.g. said region starts at bar 10 and ends at bar 20 but the first PH is at bar 13 and second at bar 17) the macro has to do a Split at Playhead command in the DAW. Thankfully, in GarageBand/Logic there is a built-in keyboard shortcut that does that.

2# - Speaking of built-in keyboard shortcuts, I do remember a music prod website stating that GB/Logic's control-command-up arrow and control-command-down arrow (I could be wrong here, maybe it's a hyperkey or option-command) controls master volume by a decibels or a few dbs or something like that.

Also, be careful with the trigger string. 1/1 could be the beginning of 1/16 , how is KM supposed to know when you're done typing?

I'm aware of the conflict between 1/1 and 1/16.

Also, remember that the keystrokes in the trigger string will still be processed by the app before KM does anything with them. If you've just selected a note on a MIDI grid and you type 1 / , is Logic Pro going to do anything in response to those keystrokes?

I hope not!

These buttons are on a Samsung Galaxy View owned by Christophe Beck, a Canadian film composer working in Santa Monica. He has KM too. Only difference is, he's on Cubase, not Logic or GB or DP or whatever.

His buttons are in a phone/tablet app called Lemur. I have it on my phone as well and I've set up basic controls for GarageBand. They're sending MIDI signals to KM (MIDI CC trigger). The blue note length buttons are what I'm talking about in #5. The pink Cut At Locators button is in #6. There's a lot of other buttons here.

I remember some popular dude here on the forum posted a Logic macro library that has the gray Add 8va and Add 8vb buttons. I also have those on my touch interface. Basically how it works for me is if I'm in piano roll/editor, and I press one of the Add 8va/8vb buttons, KM alerts me and tells me to keep the playhead right where I want the octave doubling to start, and it copies the selected notes, pastes it (now I have MIDI doubles) and types a built-in keystroke that transposes the selected notes however I want.

Originally I did actually use the blue note length buttons but for quantizing. Then I remembered I don't quantize a lot because I do a lot of manual mouse editing instead of usually recording MIDI input (my OCD). Now they're blank macros. They do nothing until I figure out #5.

This is my main buttons tab. The pp, p, mp, mf, f and ff buttons are fixed note velocity commands and are programmed in KM with simple mouse click actions. The Reset MIDI is a application preferences thing. Reset NK2 opens a file that writes data to my my external fader surface and just rewrites the data onto the fader surface. The rest are basic built-in keyboard shortcuts. Some of my macros really just don't do anything and that's why I came here to figure out how to make use of them.

Then I suggest you make a new thread focusing specifically on #5. Put GarageBand and/or Logic in the title to attract those users, as they may have dismissed a "Bunch of questions..." as being outside their wheelhouse.

Make a start yourself, find where you're stuck, post your macro and explain the problem -- you'll get a lot more help when people have something concrete to focus on.

As a starting point -- when doing it "by hand", how would you change a selected note into a quarter, half, or whole note? Write down each and every step -- that's your "pseudocode" -- then start translating those steps into KM actions.

1 Like

Firstly, I would use relative midi from KM to control the volume slider, via Logic's Controller Assignments window. Secondly, if you want to do something repeatedly while you hold a hotkey, take a look at THIS as a starting point.

Side-note, if you have an endless encoder, you can try using this rather than KM; a nicer experience, perhaps. Personally, I use a nObcontrol with a Stream Deck and I think it's an awesome combo.

Here's a quick macro that sets the selected note's duration to 1/16th, which should get you started:

Selected Note - Set Length to 16th.kmmacros (44 KB)

Macro screenshot

Forget about Logic "remembering" where the playhead has been and do this instead:

Either set your locators to the length you'd like to crop the region to or use the marquee tool to make your selection. Then use Logic's Crop Region outside Locators/Marquee Selection function. Personally, I prefer the marquee tool, as I have it bound to my right mouse button, so it's just a single click-drag-release and then one hotkey.

1 Like

That Set Length to 16th macro is exactly what I'm looking for, but does it work in GarageBand? Of course I would have to change the AppleScript a bit but do the rest of the actions work on GB?

I've never used Garage Band myself, but if it has midi transform operations, the concept is the same. As @Nige_S says, figure out the steps and convert them to KM actions.

That AppleScript won't be of much use to you as it's pointing to a specific menu which, even if it exists in Garage Band, is unlikely to be called in the same way. You'll have to write a new script. There are various tools for getting UI element properties. Perhaps download the trial of UI Browser.

UI Browser to be retired 10/22