Using Keyboard Maestro to control volume of individual apps

Hi, so I am a total noob to scripting. Basically i wanna create hotkey macros to set volume up/down for individual apps and assign those macros to a midi. Kinda like the PcPanel. Is there any way i can accomplish this?

I've never heard of PcPanel and I don't plan to get it, but if the problem is setting individual volume settings for different apps, here's the code I would write to solve that issue.

This macro isn't really what you are asking for, but I thought it was an interesting idea you had and I thought my solution was also interesting. I don't have a MIDI device right now so I'm not going to write a MIDI solution.

Individual App Volumes Macro (v11.0.2)

Individual App Volumes.kmmacros (4.7 KB)

Hi thank you so much. Maybe I wasn’t very thorough in my question.I wanna adjust the volume of every application independently. What I want to do is assign a knob for the volume of an application. So 16 knobs mean I could adjust the volume of 16 applications separately

Yes, I knew you probably wanted something like that, although I didn't know you had 16 knobs. For a non-MIDI solution my solution isn't bad.

Do any of your apps generate their audio simultaneously? You didn't mention if that is true. If so, finding a solution where each knob controls each app independently while each app generates audio output simultaneously could be tricky, because it could depend on the app, and you haven't listed your apps. If your apps are not generating audio simultaneously, then my approach is actually pretty handy. The problem with my approach is the setting the volume for each app is done by the bar in the KM macro. What I could do is modify my macro so that it remembers the audio setting for each app and recalls that value whenever you switch back to the app. But that's not quite what you want either.

The good folks at Rogue Amoeba have given us SoundSource for this very purpose :slight_smile:

SoundSource has robust Shortcuts support


As for SoundSource, that's a cool app, but I just wrote a KM macro (a pair of macros) that can memorize the current setting of any macOS app when the app is closed or minimized and automatically restore the last volume of that app when the app is launched or restored. It seems to work. I've been using it for only 2 minutes so I'm not yet sure if there are any problems with it.

Here is the macro which memorizes the volume of any app:

And here is the macro which restores the volume of any app:

So far, it works really well. I think I may keep it permanently.

OOPS, I already see an issue, I have to replace the word "Finder" by "Any Application." If you got this far, you can make that change (in both of the macros above) yourself.

You're still setting the overall system volume though. The OP wants the APP volumes set independently from each other, that's what SoundSource does

Yes, but who wants to download software when we can do it easily with KM? Besides, some apps from that company require KERNEL modifications to macOS. That's not an easy thing to do. And it's scary. I've done it myself, which is how I know it's not easy. And in any case, SoundSource is very likely doing the same thing that my app does, which is saving the volumes of each app in a storage location. Besides, the OP didn't say whether he needs the apps to be generating volume simultaneously, which means SoundSource may be unneeded.

I think your solution is wonderful and very well thought out!

I believed that the OP wanted to be able to control each app's volume independently, but I might be wrong. I'll let the OP chime in on that.

Also, Rogue Amoeba has been around for over 20 years (founded by Paul Kafasis). Their reputation is stellar.

1 Like

Nitpick: This memorises/sets the system volume level for apps, which is not the same thing -- and certainly not what SoundSource does.

Yes, any Rogue Amoeba apps that use the ACE system extension (not a kernel extension any more) require you to reduce your machine's security a little, but those extensions still have to be notarised by identified developers and still require user approval to be installed. So more a a faff to install than a ditching of OS security.

1 Like

Yes, and we're still waiting for the OP to answer the question about whether he needs that functionality, or whether he doesn't need apps generating sound at the same time, in which case my solution may be fine.

OP did say:

(Emphasis mine.)

...but I guess they could mean "set the overall system volume to a certain level, dependent on which app is active at the time".

But mention of PcPanel, an hardware controller which allows you to adjust individual app volumes independently system volume, suggests not.

Hey I have soundsource but unfortunately It doesn't support macros like i want, and adjusting volume via their sliders is a bit clunky

Hi basically i want what soundsource does using keyboard maestro

As I mentioned earlier SoundSource can be scripted via Shortcuts, you can call a shortcut from KM

As stated above, SoundSource uses ACE system extensions to perform its capabilities. KM will never do anything like that, because KM's philosophy is to limit itself to publicly available APIs from Apple. You can, however, use KM to send commands to SoundSource, but it sounds to me like you don't want to do that. I don't think KM can directly copy the functionality of apps that use private APIs or require kernel extensions or anything like that.

Based on what I've seen from Rogue Amoeba, (who make SoundSource) every time Apple updates their macOS operating system, all their apps become "incompatible" and require updated to be able to work with the newest macOS. KM doesn't experience those problems because it intentionally limits itself to features that are guaranteed not to change in updates to macOS.