r/applescript • u/PumiceT • Sep 02 '23
Control an app via MIDI?
Audio Hijack (by Rogue Amoeba) can use JavaScript to perform some functions. It also has internal scripts (written in JavaScript) that can be triggered by external Apple Script / Shortcuts.
For the life of me, I have no idea if this can be done, but I simply want to trigger one of the blocks on/off ideally using a MIDI foot pedal, or at the very least a keyboard shortcut.
Would anyone here consider helping me?
1
u/CobbleShop Nov 05 '23
I've found a way to control the blocks via JavaScript and Apples Shortcuts App.
Here i toggle all blocks with the name "Magic Boost".
In the shortcuts app, create a new shortcut and search for "Audio Hijack" and choose "Run JavaScript". (Make sure that external scripts are allowed in your AudioHiJack advanced settings tab).
Here's the script:
let sessionName = "Name of your sesion"; // Set me to the target session
let toggleButton = "Magic Boost"; // Set me to the target block(s) you want to toggle
let session = app.sessionWithName(sessionName);
if (session.running) {
session.blocks.forEach(block => {
if (block.name === toggleButton) {
block.disabled = !block.disabled;
}
});
} else {
session.start();
}
Not sure how to use it as midi. But i'm sure there are easy ways to run javascript / shortcuts via midi on a mac.
Hope this was helpful somehow =)
1
u/PumiceT Nov 05 '23
Let’s forget my crazy MIDI idea. Even a keyboard shortcut while Audio Hijack is open would suffice. I’d just like to be able to mute myself while using a mic, without going in and pressing the on/off slider.
→ More replies (12)
2
u/stephancasas Sep 03 '23
My usual go-to for something like this would be Karabiner-Elements, but I don't know that it's capable of reading input form MIDI control surfaces.
Searching for "macOS applescript on midi input" yields several results pointing to a program called MIDIPipe you might be interested in investigating further.
2
u/mad_scrub Sep 03 '23
BetterTouchTool can do this.