Silence is foo

How to disable System UI Audio Sound Effects

Thursday, October 22, 2020

Taking a screenshot, emptying the trashcan or other notification sounds can be very distracting during presentations, video calls or webinars.

When you hear a notification sound from the presenting side FOMO kicks in. Did I miss something?

Or if you are busy, emptying the trashcan, receiving new email or taking a screenshot these sounds are also heard on the other side.

Time to disable these sound effects.

DaffyDoc

There are two ways to disable the “System UI Sound Effects”:

  • System Preferences, manual set via the GUI
  • User defaults (defaults write), manual set via the CLI or scripted

System Preferences (GUI)

Open the ‘System Preferences’, go to “Sound Effects” tab and uncheck “Play user interface sound effects”.

System Preferences - Sound

User Defaults

defaults or the “command line interface to the user’s defaults” allows you to modify settings from the command line.

If you are used to doing stuff via the GUI this seems uncharted territory. As my partner says “What are you doing in that black screen again?”.

Well that “black screen” (CLI) makes it possible to test things that can be automated in scripts or via keystrokes.

From a terminal we can read the status of the “System UI Sound Effects”:

$ defaults read 'Apple Global Domain' com.apple.sound.uiaudio.enabled
1

The return value ‘1’ means the sound effects are enabled. A value of ‘0’ means the sound effects are disabled.

We can turn the sound effects on or off with a ‘write’.

defaults write 'Apple Global Domain' com.apple.sound.uiaudio.enabled -bool false

This command disables the sound effects, use the value ‘true’ to enable the sound effects.

‘defaults’ command

There are many user settings that can be set via the ‘defaults’ command. Many references can be found to modify settings via ‘defaults write’. Internet is your friend, most of the time …

In my case the internet search results like the one from OSXDaily kept referring to the following command to change the “System UI Sound Effects”:

defaults write com.apple.systemsound "com.apple.sound.uiaudio.enabled" -int 0

This command did not work on my machine in macOS Catalina. It’s not the ‘-int 0’ which is just an alternative for the ‘-bool false’ parameter. No, it’s the domain ‘com.apple.systemsound’.

Of course I tried the suggested ‘domain’ but that didn’t work.

But … the ‘defaults’ command has a ‘find’ option which alows you to search through the settings hierachy.

$ defaults find sound
...
Found 1 keys in domain 'com.apple.systemsound': {
    "com.apple.sound.uiaudio.enabled" = 1;
}
Found 1 keys in domain 'com.googlecode.iterm2': {
    SoundForEsc = 0;
}
Found 2 keys in domain 'Apple Global Domain': {
    "com.apple.sound.beep.flash" = 0;
    "com.apple.sound.uiaudio.enabled" = 1;
}
...

With that I found the ‘Apple Global Domain’.

Karabiner/Goku

In the previous “Keyboard redefined” post I wrote about Karabiner and Goku to create keyboard shortcuts.

I updated my configuration with a template and keyboard shortcut (‘hyper/capslock’ + u) to toggle the “System UI Sound Effects” and show a notification with the current status.

Notification

The full configuration is avaialble at github/tisGoud/goku.

screencapture

If you are just looking for a way to capture the screen without the “shutter” sound you can use screencapture from the command line on macOS with the parameter -x.

The following command captures the screen interactively without the “shutter” sound and the output will open in Preview.

screencapture -ixP

Conclusion

In this time where videoconferencing is the “new normal” shutting of the system sounds should be part of the videoconferencing etiquette.

I now have a way to silence my system with a keyboard shortcut and so can you 😉.