2016-02-19 05:25:34 +00:00
<!-- vim: set tw=120: -->
![](Images/README/FermataIcon.png)
# Background Music
2019-08-23 21:18:26 +00:00
##### macOS audio utility
2016-02-19 05:25:34 +00:00
2018-10-20 03:40:24 +00:00
< img src = "Images/README/Screenshot.png" width = "340" height = "342" / >
2016-02-19 05:25:34 +00:00
2019-08-21 22:27:23 +00:00
[Overview ](#overview )< br />
[Auto-pause music](#auto-pause-music)< br / >
[Application volume](#application-volume)< br / >
[Recording system audio](#recording-system-audio)< br / >
[Download ](#download )< br />
2019-08-23 21:44:52 +00:00
[Build and Install ](#build-and-install )</ br >
2019-08-21 22:27:23 +00:00
[Uninstall ](#uninstall )< br />
[Troubleshooting ](#troubleshooting )< br />
[Related Projects ](#related-projects )< br />
[License ](#license )< br />
# Overview
2019-08-19 21:16:32 +00:00
**Background Music** gives you control over multiple sources of audio on your desktop without navigating each individual application. It provides the following functionalities:
2016-02-19 05:25:34 +00:00
2019-08-25 17:30:18 +00:00
+ Automatically pause/unpause your music player when other audio sources are playing/stopped
2019-08-23 21:10:22 +00:00
+ Per-application volume control
2019-08-19 21:16:32 +00:00
+ Record system audio
+ No restart required to install
+ Runs entirely in userspace
2016-02-19 05:25:34 +00:00
2019-08-27 02:34:29 +00:00
##### *Note: Background Music is still in alpha.*
2019-08-23 21:18:26 +00:00
2016-02-19 05:25:34 +00:00
## Auto-pause music
2019-08-19 21:16:32 +00:00
2019-08-23 21:10:22 +00:00
**Background Music** automatically pauses your music player when a second audio source is playing, and unpauses the player when the second source has stopped.
2019-08-19 22:44:58 +00:00
The auto-pause feature currently supports following music players:
2016-02-19 05:25:34 +00:00
2019-08-19 21:16:32 +00:00
+ iTunes
+ [Spotify ](https://www.spotify.com )
+ [VLC ](https://www.videolan.org/vlc/ )
+ [VOX ](https://vox.rocks/mac-music-player )
+ [Decibel ](https://sbooth.org/Decibel/ )
+ [Hermes ](http://hermesapp.org/ )
+ [Swinsian ](https://swinsian.com/ )
+ [GPMDP ](https://www.googleplaymusicdesktopplayer.com/ )
2016-02-19 05:25:34 +00:00
2019-08-27 02:34:29 +00:00
Adding support for a new music player is straight-forward.< sup id = "a1" > [1](#f1)< / sup > If you don't know how to program, or just don't feel
like it, feel free to [create an issue ](https://github.com/kyleneideck/BackgroundMusic/issues/new ). Otherwise, see
[BGMMusicPlayer.h ](BGMApp/BGMApp/Music%20Players/BGMMusicPlayer.h ).
2019-08-05 11:31:58 +00:00
2019-08-19 21:16:32 +00:00
## Application volume
2016-02-19 05:25:34 +00:00
2019-08-23 21:10:22 +00:00
**Background Music** provides a volume slider for each application running your system. You can boost quiet applications above their maximum volume.
2016-02-19 05:25:34 +00:00
## Recording system audio
2019-08-23 21:10:22 +00:00
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.
2016-02-19 05:25:34 +00:00
2019-08-19 22:44:58 +00:00
You can record system audio and a microphone together by creating an [aggregate
2016-02-23 08:34:56 +00:00
device](https://support.apple.com/en-us/HT202000) that combines your input device (usually Built-in Input) with
2019-08-19 22:44:58 +00:00
the **Background Music** device. You can create the aggregate device using the **Audio MIDI Setup** utility under
2019-08-21 23:31:45 +00:00
***/Applications/Utilities***.
2016-02-23 08:34:56 +00:00
2019-08-19 21:25:12 +00:00
# Download
2019-08-27 02:34:29 +00:00
**Requires macOS 10.10+**.
> <sub>MD5: 89a74e9379041abfd6a55471f3e61b94</sub><br/>
> <sub>SHA256: 070bef360bff9e52639a4fbf23ee7052b9645004a431af6ad62997cfed99e2d7</sub><br/>
> <sub>PGP:
> [sig](https://github.com/kyleneideck/BackgroundMusic/releases/download/v0.3.1/BackgroundMusic-0.3.1.pkg.asc),
> [key (0595DF814E41A6F69334C5E2CAA8D9B8E39EC18C)](https://bearisdriving.com/kyle-neideck.gpg)</sub>
You can download the current prebuilt version of **Background Music** using the following options. We also have [snapshot builds ](https://github.com/kyleneideck/BackgroundMusic/releases ).
### Option 1
Download **version 0.3.1** :
2019-08-19 21:25:12 +00:00
< a href = "https://github.com/kyleneideck/BackgroundMusic/releases/download/v0.3.1/BackgroundMusic-0.3.1.pkg" > < img
src="Images/README/pkg-icon.png" width="32" height="32" align="absmiddle" />
BackgroundMusic-0.3.1.pkg< / a > (571 KB)
2019-08-27 02:34:29 +00:00
### Option 2
2019-08-19 21:25:12 +00:00
2019-08-27 02:34:29 +00:00
Install using [Homebrew ](https://brew.sh/ ) by running the following command in **Terminal** :
2019-08-19 22:44:58 +00:00
2019-08-19 21:25:12 +00:00
```bash
brew cask install background-music
```
2019-08-19 22:44:58 +00:00
If you want the snapshot version, run:
2019-08-19 21:25:12 +00:00
```bash
brew tap homebrew/cask-versions
brew cask install background-music-pre
```
2019-08-19 22:44:58 +00:00
# Build and install
2019-08-19 21:25:12 +00:00
2019-08-27 02:34:29 +00:00
If you need the latest version of **Background Music** , you can download from the source on github using the following options. Building should take less than a minute. You need [Xcode ](https://developer.apple.com/xcode/download/ ) version
2017-12-26 12:04:20 +00:00
8 or higher.
2016-04-29 03:18:52 +00:00
2019-08-27 02:34:29 +00:00
### Option 1
2016-04-29 03:18:52 +00:00
2019-08-27 02:34:29 +00:00
1. Open **Terminal** .
2. Copy and paste the following command into **Terminal** :
2017-04-09 08:25:27 +00:00
2016-04-29 03:18:52 +00:00
```shell
(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 & & \
2017-02-16 11:46:57 +00:00
/bin/bash BackgroundMusic-master/build_and_install.sh -w & & rm -rf BackgroundMusic-master)
2016-04-29 03:18:52 +00:00
```
2019-08-27 02:34:29 +00:00
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.
2019-08-21 22:27:23 +00:00
2019-08-27 02:34:29 +00:00
### Option 2
If you are not comfortable using the single-line command above, you can manually build and install from the source on github using the following steps:
2016-04-29 03:18:52 +00:00
2019-08-19 22:44:58 +00:00
1. Clone or [download ](https://github.com/kyleneideck/BackgroundMusic/archive/master.zip ) the project.
2. If the project is in a zip, unzip it.
3. Open **Terminal** and [change the directory ](https://github.com/0nn0/terminal-mac-cheatsheet#core-commands ) to the
2016-12-27 18:04:54 +00:00
directory containing the project.
2019-08-19 22:44:58 +00:00
4. Run: `/bin/bash build_and_install.sh` .
2016-04-19 13:00:14 +00:00
2019-08-19 22:44:58 +00:00
The script restarts the system audio process (coreaudiod) at the end of the installation, so you need to pause any
applications playing audio.
2016-02-19 05:25:34 +00:00
2019-08-27 02:34:29 +00:00
To manually build and install, see [MANUAL_INSTALL.md ](https://github.com/kyleneideck/BackgroundMusic/blob/master/MANUAL-INSTALL.md ).
2016-04-28 17:22:38 +00:00
2019-08-19 21:25:12 +00:00
# Uninstall
2016-02-19 05:25:34 +00:00
2019-08-27 02:34:29 +00:00
To uninstall **Background Music** from your system, follow these steps:
1. Open **Terminal** .
2019-08-30 17:59:17 +00:00
2. To locate `uninstall.sh` , run:`cd /Applications/Background\ Music.app/Contents/Resources/`.
2019-08-27 02:34:29 +00:00
3. Run: `sh uninstall.sh` .
If you cannot locate `uninstall.sh` , you can [download the project ](https://github.com/kyleneideck/BackgroundMusic/archive/master.zip ) again.
To manually uninstall, see [MANUAL_UNINSTALL.md ](https://github.com/kyleneideck/BackgroundMusic/blob/master/MANUAL-UNINSTALL.md ).
2016-04-19 15:51:03 +00:00
2019-08-19 21:25:12 +00:00
# Troubleshooting
2016-02-19 05:25:34 +00:00
2019-08-19 22:44:58 +00:00
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
2017-06-25 02:39:34 +00:00
change the default device and then change it back again.
2019-08-19 22:44:58 +00:00
If this does not work, you might have to uninstall. Consider filing a bug report if you do.
2019-08-21 22:27:23 +00:00
## Known issues and solutions
2019-08-19 22:44:58 +00:00
2019-08-27 02:34:29 +00:00
- **Setting an application's volume above 50% can cause [clipping ](https://en.wikipedia.org/wiki/Clipping_(audio )).**
- Set your volume to its maximum level and lower the volumes of other applications.
- **VLC pauses iTunes or Spotify when playing, and stops Background Music from unpausing your music afterwards.**
2019-08-19 22:44:58 +00:00
2019-08-27 02:34:29 +00:00
- 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* .
2019-08-19 22:44:58 +00:00
2019-08-27 02:34:29 +00:00
- **Skype pauses iTunes during calls.**
2019-08-19 22:44:58 +00:00
2019-08-27 02:34:29 +00:00
- To disable this, uncheck *Pause iTunes during calls* on the **General** tab of **Skype** 's preferences.
2019-08-19 22:44:58 +00:00
2019-08-27 02:34:29 +00:00
- **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.
2019-08-19 22:44:58 +00:00
2019-08-27 02:34:29 +00:00
- **[A Chrome bug](https://bugs.chromium.org/p/chromium/issues/detail?id=557620) 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.
2019-08-19 22:44:58 +00:00
2019-08-27 02:34:29 +00:00
- **Some applications play notification sounds that are only just long enough to trigger an auto-pause.**
- Increase the `kPauseDelayNSec` constant in [BGMAutoPauseMusic.mm ](/BGMApp/BGMApp/BGMAutoPauseMusic.mm ). It will increase your music's overlap time over other audio, so don't increase it too much. See [#5 ](https://github.com/kyleneideck/BackgroundMusic/issues/5 ) for details.
2019-08-19 22:44:58 +00:00
### Other issues
Some are in listed in [TODO.md ](/TODO.md ).
2016-02-19 05:25:34 +00:00
2019-08-19 21:25:12 +00:00
# Related projects
2016-02-19 05:25:34 +00:00
- [Core Audio User-Space Driver
Examples](https://developer.apple.com/library/mac/samplecode/AudioDriverExamples/Introduction/Intro.html)
2016-04-23 04:21:02 +00:00
The sample code from Apple that BGMDriver is based on.
2016-02-19 05:25:34 +00:00
- [Soundflower ](https://github.com/mattingalls/Soundflower ) - "MacOS system extension that allows applications to pass
audio to other applications."
- [WavTap ](https://github.com/pje/WavTap ) - "globally capture whatever your mac is playing—-as simply as a screenshot"
2017-12-10 21:49:33 +00:00
- [eqMac ](http://www.bitgapp.com/eqmac/ ), [GitHub ](https://github.com/nodeful/eqMac2 ) - "System-wide Audio Equalizer for the Mac"
2016-02-19 05:25:34 +00:00
- [llaudio ](https://github.com/mountainstorm/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 ](http://www.mute.fm ), [GitHub ](https://github.com/jaredsohn/mutefm ) (Windows) - Auto-pause music
- [Jack OS X ](http://www.jackosx.com ) - "A Jack audio connection kit implementation for Mac OS X"
- [PulseAudio OS X ](https://github.com/zonque/PulseAudioOSX ) - "PulseAudio for Mac OS X"
2016-04-23 04:21:02 +00:00
- [Sound Pusher ](https://github.com/q-p/SoundPusher ) - "Virtual audio device, real-time encoder and SPDIF forwarder for
Mac OS X"
2016-04-18 15:40:40 +00:00
- [Zirkonium ](https://code.google.com/archive/p/zirkonium ) - "An infrastructure and application for multi-channel sound
2016-02-19 05:25:34 +00:00
spatialization on MacOS X."
2016-04-23 04:21:02 +00:00
### Non-free
2016-04-26 11:04:13 +00:00
- [Audio Hijack ](https://rogueamoeba.com/audiohijack/ ) - "Capture Audio From Anywhere on Your Mac"
2017-05-07 05:17:48 +00:00
- [Sound Siphon ](https://staticz.com/soundsiphon/ ), [Sound Control ](https://staticz.com/soundcontrol/ ) - System/app audio recording, per-app volumes, system audio equaliser
2016-04-23 04:21:02 +00:00
- [SoundBunny ](https://www.prosofteng.com/soundbunny-mac-volume-control/ ) - "Control application volume independently."
- [Boom 2 ](http://www.globaldelight.com/boom/index.php ) - "The Best Volume Booster & Equalizer For Mac"
2016-02-19 05:25:34 +00:00
## License
2019-03-11 00:39:04 +00:00
Copyright © 2016-2019 [Background Music contributors ](https://github.com/kyleneideck/BackgroundMusic/graphs/contributors ).
2016-11-12 13:06:58 +00:00
Licensed under [GPLv2 ](https://www.gnu.org/licenses/gpl-2.0.html ), or any later version.
2016-11-12 09:54:04 +00:00
2019-08-19 22:44:58 +00:00
**Background Music** includes code from:
2016-12-28 15:25:44 +00:00
- [Core Audio User-Space Driver
Examples](https://developer.apple.com/library/mac/samplecode/AudioDriverExamples/Introduction/Intro.html), [original
license](LICENSE-Apple-Sample-Code), Copyright (C) 2013 Apple Inc. All Rights Reserved.
- [Core Audio Utility
Classes](https://developer.apple.com/library/content/samplecode/CoreAudioUtilityClasses/Introduction/Intro.html),
[original license ](LICENSE-Apple-Sample-Code ), Copyright (C) 2014 Apple Inc. All Rights Reserved.
2016-11-12 09:54:04 +00:00
----
< b id = "f1" > [1]< / b > 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.) [↩ ](#a1 )