74: Stream Deck: Going Large

3 Likes

Controlling Audio with Stream Deck and Keyboard Maestro

David and Rose talked about some tools you can use for controlling audio via Keyboard Maestro and/or Stream Deck.

I just wanted to share some other ideas and tips.

Ears

Ears app icon sm

Ears is an app that I have not heard anyone talking about, but I think itā€™s very handy:

Ears - Instant Audio Switcher for macOS

It will let you set defaults for various input and output devices, but the feature that I like the most is that it shows a notification when the device changes.

It also has command-line and AppleScript support. (If you use Ears for this you donā€™t need SwitchAudioSource which I mention below)

The app is a ā€œpay what you wantā€ model ($2/$5/$10) but is free to use, thereā€™s apparently a nag-screen somewhere if you use it for free, but I never saw it because I bought it as soon as I tried it.

switchaudio-osx aka ā€œSwitchAudioSourceā€

https://github.com/deweller/switchaudio-osx/ (which you can install via brew install switchaudio-osx) is called SwitchAudioSource when itā€™s installed.

I donā€™t have an XLR mic, so I donā€™t know if it works with that, but the nice thing is that it makes it very easy to set input and output.

	SwitchAudioSource -t input -s 'AirPods Pro'

	SwitchAudioSource -t output -s 'CalDigit Thunderbolt 3 Audio'

I have used this to make some Keyboard Maestro macros that will set my input and output to either be my Bose headphones or my CalDigit.

Control Volume Levels with AppleScript

It is easy to forget that there are three different volume settings in macOS:

  1. Input
  2. Output
  3. Alerts

The third is for things like system beeps and notifications. Whenever I am on a Zoom call or recording audio, I always want to make sure that is set to zero so I am not getting distracted by them (and so they are not playing over the Zoom call).

Also, when I am podcast recording, I want to make sure that my input level is always the same, so I am getting a consistent recording.

When I have my headphones on, I want to make sure that the volume is not too loud (which sometimes happens if I am listening via HomePods or even the speakers attached to my Mac.

Again, you can set this using Ears as mentioned above, but did you also know that it is very easy to control volume levels with AppleScript? Just choose a number between 0-100:

	set volume alert  volume 0
	set volume input  volume 70
	set volume output volume 85

You can also do this in a shell script:

	osascript -e 'set volume alert volume 0'

You can even do 2 or 3 at once:

	osascript \
	-e 'set volume alert volume 0' \
	-e 'set volume input volume 70' \
	-e 'set volume output volume 85'

Of course, Keyboard Maestro can do either AppleScript or shell scripts, so the choice is yours.

I hope this is useful to others!

5 Likes

Thanks @Tjluoma for the helpful resources. I stumbled upon Ears this week.

I had a need to route sound in and out of the Zoom app. Hard to find existing AppleScript routines for this, so with the assistance of Script Debugger I cobbled together some UI scripting. Note that Zoom doesnā€™t always name the input and output devices exactly the same as the macOS.

-- set Zoom Speaker
tell application "zoom.us" to activate
tell application "System Events"
	keystroke "," using command down
	delay 1.0
	tell pop up button 1 of scroll area 2 of splitter group 1 of window "Settings" of application process "zoom.us"
		delay 0.1
		perform action "AXShowMenu"
		delay 0.2
		get every menu item of menu 1
		click menu item "Same as System" of menu 1
	end tell
end tell

-- set Zoom Speaker Volume
tell application "zoom.us" to activate
tell application "System Events"
	keystroke "," using command down
	delay 0.2
	tell UI element 7 of scroll area 2 of splitter group 1 of window "Settings" of application process "zoom.us"
		set value to 50
	end tell
end tell

-- set Zoom Mic
tell application "zoom.us" to activate
tell application "System Events"
	keystroke "," using command down
	tell pop up button 2 of scroll area 2 of splitter group 1 of window "Settings" of application process "zoom.us"
		delay 0.1
		perform action "AXShowMenu"
		delay 0.2
		get every menu item of menu 1
		click menu item "Same as System" of menu 1
	end tell
end tell

-- set Zoom Mic volume
tell application "zoom.us" to activate
tell application "System Events"
	keystroke "," using command down
	delay 0.2
	set theCheckBox to checkbox 2 of scroll area 2 of splitter group 1 of window "Settings" of application process "zoom.us"
	tell theCheckBox
		if (its value as boolean) then click theCheckBox
		delay 0.2
	end tell
	tell UI element 17 of scroll area 2 of splitter group 1 of window "Settings" of application process "zoom.us"
		set value to 30
	end tell
end tell

ā€¦and of course, if Zoom changes the layout in their Audio Settings window, this will break.

Wow! :slight_smile: Perfect timing! I just got a stream deck XL (due to all the praise it got on the podcast. Elgato should seriously sponsor you guys haha).

2 Likes

A tiny tip for more useful ā€˜Foldersā€™ on Stream Deck

I have a lot of apps categorized by area of intent into folders with simple ā€˜Openā€™ actions for quickish access to them. Having to then back out of the folder again makes it 3 button presses and that much more friction.

Screen Shot 2021-04-24 at 10.29.16 AM

Turn these into multi-action (Thereā€™s even a shortcut right there when you right click a simple button) that perform the app launch (or other action) and then have it switch profiles back to ā€˜homeā€™ or wherever is appropriate.

3 Likes

Has anyone encountered an issue using KM Link (as recommended in this podcast) that it is non-responsive to additional button-presses when KM is currently executing a macro that was launched via KM Link? I want to use my ā€œCancel All Macrosā€ Stream Deck button to cancel any malfunctioning macro but this doesnā€™t seem to work. Any tips here? Do I need to run Cancel All Macros via the official integration?

Rosemary and David talked about a GitHub repository for Stream Deck Icons.

Does anybody have the link?

1 Like

Thanks so much!

Looks like GitHub may have a limit on the # of files allowedā€¦It is currently displaying this message:

Sorry, we had to truncate this directory to 1,000 files. 2,357 entries were omitted from the list.

Yeah thatā€™s a thing with Github. The files are there but it wonā€™t display all as the list would be huge.
You can access to all of them by either cloning the repository with Git or by downloading the Zip under the green Code button.

Maybe we should consider sorting the icons into folders so one can more easily pick and choose the icons they want directly online.

So my take away from this excellent episode was:

I would like to use buttons to switch contexts between one customer engagement and another. (A context here is really a set of files, open in a set of apps. Each context is a separate customer engagement.)

In my line of work customers appear about one a month. And then go and maybe return a year or two later - but effectively as a new engagement.

So my need is

  1. to automate the setting up of a new button in an empty spot. This new button obviously runs scripts - via KM or otherwise.
  2. To automate the freeing up of a button.

Anyone have any thoughts on how to automate the creation and tearing down of buttons? (Creating whatā€™s ā€œbehind the buttonā€ is what I have already, more or less.)

Other than that, I would have liked a little about what you do when you have multiple StreamDecks. I donā€™t think that got a mention. (Not a big omission, though.) I have a 2 x 3 plus a 3 x 5 - and I doubt Iā€™ll be replacing them with a 4 x 8.

I would like to make people aware of a Mac app that I have written. It is available for free and essentially allows you to create a virtual Elgato Stream Deck as a window on your monitor. The user creates in a window a grid of ā€œbuttonsā€ that invoke Keyboard Maestro scripts. The application is called KM_GridPalettes.

This application allows you to create multiple palettes that you can freely move between. Palettes are analogous to ā€œprofilesā€ in the Elgato Stream Deck world. KM_GridPalettes provides much of the functionality of the Elgato Stream Deck, and itā€™s potentially useful for those who do not want to pay for or do not have the room on their desk for the physical device. Before purchasing an Elgato Stream Deck, you might give this app a whirl and see if the whole Elgato world makes sense for you.

This application is like any other on the Macintosh. It can be minimized to the dock to be moved out of the way. It can be controlled by Keyboard Maestro itself and, indeed, the Elgato Stream Deck. It would be quite possible to use simultaneously palettes from Keyboard Maestro, palettes from KM_GridPalettes, and a physical Elgato Stream Deck.

The user can move among palettes (profiles) using the application itself or using Keyboard Maestro. Palettes can be created containing up to 100 buttons. Up to 100 pallets (profiles) can be designed which are all accessible when the application is running. This provides a basically unlimited number of buttons.

KM_GridPalettes requires ownership of Keyboard Maestro. All actions invoked by the palettes are mediated through Keyboard Maestro. This is not much of a limitation in view of the power of that application. Enthusiastic users of the Elgato Stream Deck are themselves likely primarily working through Keyboard Maestro. And the other functions they are invoking with their devices could, in many cases, be accessed via Keyboard Maestro.

Owning an Elgato Stream Deck does not obviate the use of the program. It would be possible to be running both simultaneously. Someone who uses an Elgato Stream Deck with their desktop machine, but occasionally uses a laptop offsite, might consider duplicating profiles from their Stream Deck into KM_GridPalettes. In this way, they could access the same basic functionality on their portable device.

The website is KM_GridPalettes. Here you can download the application itself, and there are a couple of YouTube videos that explain how palettes are constructed using the application. Take a look!

One example: A palette constructed to control a Zoom session. Note with the cursor overlying the Mute All button that there is a text description below.

210424Zoom

Second Example: Graphics for the buttons in the palette are created as 64 pixel images. These can be created in most any graphics program as PNG or JPEG files. Examples show importation of Emoji, application icons, use of text tools in the graphics program as the foundation of the look of each button.

210424TextExample

5 Likes

You need to take a look at the manifest.json files in the ~/Library/Application Support/com.elgato.StreamDeck/ProfilesV2/*.sdProfile directories. If you want to programmatically create/modify profiles or their contents, you want to work with these folder structures and JSON files.

But, I would also consider parameterising your Keyboard Maestro calls so that, for example, you can have a StreamDeck button set a Keyboard Maestro variable and then reference that variable in your macros to drive any variations in functionality (e.g. file paths).

1 Like

I started doing that with Hazel, but things got a bit tricky and muddled. Iā€™m rather swamped this weekend but do plan to look at it during the week! Iā€™d definitely recommend downloading all the images though.

Early last year, before Toolbox Pro allowed me the full icon generation access I ended up tapping into, I did put together a pretty popular post on various places you could get Streamdeck icon sets from.

Hereā€™s the link if you happen to want even more icons to choose from.

2 Likes

Hey Rose,
I did my take on sorting the files and created a PR for it.
Feel free to take a look and decide if you think thatā€™s a good way of sorting the icons :smiley:

2 Likes

This repo alone may be what pushes me over to get Working Copy for my iPhone and iPad.

1 Like

I know automators is very apple centric, but from a Windows user perspective, is a Streamdeck as useful as we have no keyboard maestro.

1 Like

Absolutely. I work on a PC during the working day and switch over to my Mac for personal stuff at other times. I use the same Stream Deck with both operating systems. It is mainly a trigger, and so in terms of the actual automation that something like Keyboard Maestro provides, then it is a case of using a Windows tool instead.

As well as the inbuilt opening URLs, etc. I also use my Stream Deck to do things like trigger AutoHotkey scripts and even trigger XYplorer (an automatable file manager) script via a command line call. Thereā€™s pretty much always a way to trigger a good tool from the Stream Deck.

I would also note that there are quite a few automation plugins that are Windows only, Iā€™d highly recommend several automation related plugins by the ever popular BarRaiderā€™s - Advanced Launcher, Super Macro, WinTools and Windo Mover & Resizer. Youā€™ll find that these may well do a lot of the things you might write automations for outside of the Stream Deck, but are perhaps easier with these tools.

Hope that helps.

1 Like

Hey Rose - thanks for the shoutout regarding the HomeControl app on this episode. Iā€™m famous! Also thanks to Jerry, who first posted about the app in another thread on the forums.

Streamdeck showing my ZOOM mute/unmute status, regardless of active app:
There are a number of meetings where I am listening along in a zoom, but the zoom window itself is covered as Iā€™m actually multitasking in another program* to stay productive. That usually means I canā€™t see the Mute icon in the bottom left corner of the Zoom meeting. Most zoom commands on the streamdeck are only helpful if the Zoom app is active, not another app (like Outlook).

Last year, I created a keyboard maestro macro that is enabled if zoom is running, whether it is the active application or not. It uses AppleScript to check to see if I am muted on Zoom every 30 seconds. (It checks the Meeting Menu for the existence of the ā€œUnmute Audioā€ option. If that exists, I know I am muted).

It updates the top left button on my streamdeck with a MUTED icon. if not, it replaces it with an UNMUTED icon.

This way, I can always check my mute status, just by looking down at my Streamdeck, regardless of what Iā€™m really doing during the Zoom meeting.

The button, if pressed, will activate zoom and toggle mute/unmute. Very helpful for ā€œstaying productiveā€, haha! If anyone interested, hereā€™s the link to the KM Macro:

*If someone I work with reads this, I disavow any knowledge of this post

6 Likes