No description
Find a file
Kyle Neideck f24a6cb2f1
Try to avoid using the discrete GPU on multi-GPU systems to save power.
Add NSSupportsAutomaticGraphicsSwitching to BGMApp's Info.plist in the
hopes that it will use the integrated GPU when possible. BGMApp doesn't
need to use the fastest GPU, so it's better to save battery power.

Untested because I don't have the right hardware. (I actually have an
iMac with a discrete GPU, but the integrated GPU seems to be disabled.)

See #284 and
<https://developer.apple.com/library/archive/qa/qa1734/_index.html>.
2020-04-21 14:11:42 +10:00
BGM.xcworkspace Support creating .pkg installers using the debug build configuration. 2018-06-05 00:40:21 +10:00
BGMApp Try to avoid using the discrete GPU on multi-GPU systems to save power. 2020-04-21 14:11:42 +10:00
BGMDriver Fix BGMDriver and BGMXPCHelper's version strings for SNAPSHOT builds. 2020-02-09 22:18:52 +11:00
Images Add an option to use a volume icon instead of the Background Music logo. 2019-03-05 00:01:42 +11:00
pkg Fix apps failing to start audio after upgrading Background Music. 2020-04-19 16:43:17 +10:00
SharedSource Fix BGMDriver and BGMXPCHelper's version strings for SNAPSHOT builds. 2020-02-09 22:18:52 +11:00
.editorconfig Add .editorconfig file to fix tab width on GitHub. 2017-12-27 15:22:17 +11:00
.gitignore Add a repackage option (-r) to package.sh. 2020-02-09 20:19:41 +11:00
.travis.yml Limit the installer logs copied into the Travis logs. 2020-02-09 21:31:26 +11:00
build_and_install.sh Add a repackage option (-r) to package.sh. 2020-02-09 20:19:41 +11:00
CONTRIBUTING.md BGMDevice: Only enable volume/mute if the output device also has them. 2017-05-30 23:22:48 +10:00
DEVELOPING.md Add a volume slider for system sounds. 2017-12-26 23:10:57 +11:00
LICENSE Initial commit 2016-02-19 16:25:34 +11:00
LICENSE-Apple-Sample-Code Auto-pause: make the unpause delay proportional to the pause duration. 2016-12-29 02:25:44 +11:00
MANUAL-INSTALL.md Update the command to restart coreaudiod in MANUAL-INSTALL.md. 2019-11-17 16:17:16 +11:00
MANUAL-UNINSTALL.md Update a command MANUAL-UNINSTALL.md to work on macOS Catalina. 2019-10-17 12:40:26 +11:00
package.sh Add a repackage option (-r) to package.sh. 2020-02-09 20:19:41 +11:00
README.md Add known issue to the README: only stereo devices currently work. 2020-04-10 22:21:32 +10:00
TODO.md Rename BGMDevice from "Background Music Device" to "Background Music". 2017-06-25 12:39:34 +10:00
uninstall.sh Split uninstall.sh into an interactive and non-interactive version. 2017-06-17 21:56:42 +10:00

Background Music

macOS audio utility

Overview
      Auto-pause music
      Application volume
      Recording system audio
Download
Build and Install
Uninstall
Troubleshooting
Related Projects
License

Overview

  • Automatically pause/unpause your music player when other audio sources are playing/stopped
  • Per-application volume control
  • Record system audio
  • No restart required to install
Note: Background Music is still in alpha.

Auto-pause music

Background Music automatically pauses your music player when a second audio source is playing and unpauses the player when the second source has stopped.

The auto-pause feature currently supports following music players:

Adding support for a new music player is usually straightforward.1 If you don't know how to program, or just don't feel like it, feel free to create an issue. Otherwise, see BGMMusicPlayer.h.

Application volume

Background Music provides a volume slider for each application running your system. You can boost quiet applications above their maximum volume.

Recording system audio

You can record system audio with Background Music. With Background Music running, launch QuickTime Player and select File > New Audio Recording (or New Screen Recording, New Movie Recording). Then click the dropdown menu () next to the record button and select Background Music as the input device.

You can record system audio and a microphone together by creating an aggregate device that combines your input device (usually Built-in Input) with the Background Music device. You can create the aggregate device using the Audio MIDI Setup utility under /Applications/Utilities.

Download

Requires macOS 10.10+.

You can download the current version of Background Music using the following options. We also have snapshot builds.

Option 1

Download version 0.3.2:

BackgroundMusic-0.3.2.pkg (571 KB)

MD5: 7f34d9e6595566f3ba14e7afc89c86a2
SHA256: 0cd7b488b5ab97a1ecb496e484a6c209c29f35ab503e6f73b45e56719a7aba18
PGP: sig, key (0595DF814E41A6F69334C5E2CAA8D9B8E39EC18C)

Option 2

Install using Homebrew by running the following command in Terminal:

brew cask install background-music

If you want the snapshot version, run:

brew tap homebrew/cask-versions
brew cask install background-music-pre

Installing from Source Code

Background Music usually takes less than a minute to build. You need Xcode version 8 or higher.

Option 1

  1. Open Terminal.
  2. Copy and paste the following command into Terminal:
(set -eo pipefail; URL='https://github.com/kyleneideck/BackgroundMusic/archive/master.tar.gz'; \
    cd $(mktemp -d); echo Downloading $URL to $(pwd); curl -qfL# $URL | gzcat - | tar x && \
    /bin/bash BackgroundMusic-master/build_and_install.sh -w && rm -rf BackgroundMusic-master)
More info...

This command uses `/bin/bash` instead of `bash` in case someone has a nonstandard Bash in their `$PATH`. However, it doesn't do this for `tar` or `curl`. In addition, `build_and_install.sh` doesn't call programs by absolute paths. This command also uses `gzcat - | tar x` instead of `tar xz` because `gzcat` will also check the file's integrity (gzip files include a checksum), and will ensure that a half-downloaded copy of `build_and_install.sh` doesn't run.

Option 2

  1. Clone or download the project.
  2. If the project is in a zip, unzip it.
  3. Open Terminal and change the directory to the directory containing the project.
  4. Run: /bin/bash build_and_install.sh.

The script restarts the system audio process (coreaudiod) at the end of the installation, so pause any applications playing audio if you can.

To manually build and install, see MANUAL_INSTALL.md.

Uninstall

To uninstall Background Music from your system, follow these steps:

  1. Open Terminal.
  2. To locate uninstall.sh, run: cd /Applications/Background\ Music.app/Contents/Resources/.
  3. Run: bash uninstall.sh.

If you cannot locate uninstall.sh, you can download the project again.

To manually uninstall, see MANUAL_UNINSTALL.md.

Troubleshooting

If Background Music crashes and your audio stops working, open System Preferences > Sound and change your system's default output device to something other than the Background Music device. If it already is, then change the default device and then change it back again.

Make sure you allow "microphone access" when you first run Background Music. If you denied it, go to System Preferences > Security & Privacy > Privacy > Microphone, find Background Music in the list and check the box next to it. Background Music doesn't actually listen to your microphone. It needs the permission because it gets your system audio from its virtual input device, which macOS counts as a microphone. (We're working on it in #177.)

If the volume slider for an app isn't working, try looking in More Apps for entries like Some App (Helper). For some meeting or video chat apps, you may need to do this to change the current meeting volume.

Known issues and solutions

  • Setting an application's volume above 50% can cause clipping.

    • Set your volume to its maximum level and lower the volumes of other applications.
  • Only 2-channel (stereo) audio devices are currently supported for output.

  • VLC pauses iTunes or Spotify when playing, and stops Background Music from unpausing your music afterward.

    • Under VLC's preferences, select Show All. Navigate to Interface > Main interfaces > macosx and change Control external music players to either Do nothing or Pause and resume iTunes/Spotify.
  • Skype pauses iTunes during calls.

    • To disable this, uncheck Pause iTunes during calls on the General tab of Skype's preferences.
  • Plugging in or unplugging headphones when Background Music isn't running causes silence in the system audio.

    • Navigate to System Preferences > Sound. Click the Output tab and change your default output device to something other than the Background Music device. Alternatively, press Option + Click on the sound icon within the menu bar to select a different output device. This happens when macOS remembers that the Background Music device was your default audio device the last time you used (or didn't use) headphones.
  • A Chrome bug stops Chrome from switching to the Background Music device after you open Background Music.

    • Chrome's audio will still play, but Background Music won't be aware of it.
  • Some applications play notification sounds that are only just long enough to trigger an auto-pause.

    • Increase the kPauseDelayNSec constant in BGMAutoPauseMusic.mm. It will increase your music's overlap time over other audio, so don't increase it too much. See #5 for details.

Many other issues are in listed in TODO.md and in GitHub Issues.

Related projects

  • Core Audio User-Space Driver Examples The sample code from Apple that BGMDriver is based on.
  • Soundflower - "MacOS system extension that allows applications to pass audio to other applications."
  • WavTap - "globally capture whatever your mac is playing—-as simply as a screenshot"
  • eqMac, GitHub - "System-wide Audio Equalizer for the Mac"
  • llaudio - "An old piece of work to reverse engineer the Mac OSX user/kernel audio interface. Shows how to read audio straight out of the kernel as you would on Darwin (where most the OSX goodness is missing)"
  • mute.fm, GitHub (Windows) - Auto-pause music
  • Jack OS X - "A Jack audio connection kit implementation for Mac OS X"
  • PulseAudio OS X - "PulseAudio for Mac OS X"
  • Sound Pusher - "Virtual audio device, real-time encoder and SPDIF forwarder for Mac OS X"
  • Zirkonium - "An infrastructure and application for multi-channel sound spatialization on MacOS X."
  • BlackHole - "a modern macOS virtual audio driver that allows applications to pass audio to other applications with zero additional latency."

Non-free

  • Audio Hijack - "Capture Audio From Anywhere on Your Mac"
  • Sound Siphon, Sound Control - System/app audio recording, per-app volumes, system audio equaliser
  • SoundBunny - "Control application volume independently."
  • Boom 2 - "The Best Volume Booster & Equalizer For Mac"

License

Copyright © 2016-2020 Background Music contributors. Licensed under GPLv2, or any later version.

Background Music includes code from:


[1] However, if the music player doesn't support AppleScript, or doesn't support the events Background Music needs (isPlaying, isPaused, play and pause), it can take significantly more effort to add. (And in some cases would require changes to the music player itself.)