Way to Toggle Master outputs with MIDI?

Hello, I recently bought a generic midi controller to use with Ardour and am slowly customizing the knobs + buttons.

Something that doesn’t seem straightforward that I would like to accomplish is to be able to toggle the output of the Master mixer channel. See screenshot


I’m on linux (ubuntu studio) and I have two soundcards (via pipewire): one that I have connected to a stereo, and one connected to my headphones. I’d like to be able to easily toggle the output from 1+2 to 3+4, and vice-versa to switch between stereo and headphones.

I’m wondering if this can be accomplished with a script? And then how to control the script via Midi, if possible. Any links would be appreciated, as well.

If there’s another way to do what I’ve described (like mute/solo with separate output’s I’d be happy with that too).


Edit: I just did this with a
main bus → headphones
main bus → master

separate toggle mute + volume ftw!

There may also be a way to do that with the monitor controller. The monitor section is made for that, controlling outputs and volume separately from the level of the master bus (which sets the level of the generated media files on export).


what you describe is doable via LUA scripting, then you can register your script as session action script and that can in turn be triggered via different means (menu entry, keyboard shortcut, OSC, MIDI learning)

There are dozens of example scripts in Ardour’s GIT repo

I did a small video some time ago on how to set this all up (for use with OSC but the core is the same) … It might give you ideas for you MIDI controler :wink:

1 Like

Keep in mind that connection changes are not realtime safe, so don’t do this during recording, otherwise you may get clicks, or dropouts.

The established solution is to keep both headphones and speakers connected, and use a volume controller or A-B switch plugin (or application).

In your case it may even make sense to do that outside Ardour, in Pipewire. This way you do not have to set it up for each new session. Perhaps run Carla, that can also provide MIDI bindings, and load 2 simple amp/gain plugins, or depending on your setup an A/B switch or crossfade plugin.


thanks for the replies and the link to the lua scripts (!)

re: carla. i was originally routing everything in carla but i found it too buggy, and the midi (especially for simple stuff like the volume of plugins) is incredibly frustrating. crashed all the time too.

i’m sticking to ardour - hasn’t crashed on me yet, and the routing is dead easy.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.