{"id":13410072,"url":"https://github.com/kyleneideck/BackgroundMusic","last_synced_at":"2025-03-14T15:31:46.742Z","repository":{"id":37319197,"uuid":"52422583","full_name":"kyleneideck/BackgroundMusic","owner":"kyleneideck","description":"Background Music, a macOS audio utility: automatically pause your music, set individual apps' volumes and record system audio.","archived":false,"fork":false,"pushed_at":"2024-12-22T13:11:29.000Z","size":2496,"stargazers_count":16971,"open_issues_count":498,"forks_count":692,"subscribers_count":150,"default_branch":"master","last_synced_at":"2025-03-11T12:44:57.697Z","etag":null,"topics":["audio","audio-utility","cpp","macos","objective-c"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kyleneideck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-24T07:19:32.000Z","updated_at":"2025-03-11T06:01:20.000Z","dependencies_parsed_at":"2024-02-20T12:28:43.202Z","dependency_job_id":"e5ec0f9d-e387-4825-a0e3-ecb6d1f9b765","html_url":"https://github.com/kyleneideck/BackgroundMusic","commit_stats":{"total_commits":370,"total_committers":41,"mean_commits":9.024390243902438,"dds":0.2324324324324324,"last_synced_commit":"e6375b0919dd9ca5c9edfc7fe9319f367e1e0d07"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyleneideck%2FBackgroundMusic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyleneideck%2FBackgroundMusic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyleneideck%2FBackgroundMusic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyleneideck%2FBackgroundMusic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyleneideck","download_url":"https://codeload.github.com/kyleneideck/BackgroundMusic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243600653,"owners_count":20317311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","audio-utility","cpp","macos","objective-c"],"created_at":"2024-07-30T20:01:04.798Z","updated_at":"2025-03-14T15:31:46.736Z","avatar_url":"https://github.com/kyleneideck.png","language":"C++","readme":"\u003c!-- vim: set tw=120: --\u003e\n\n![](Images/README/FermataIcon.png)\n\n# Background Music\n##### macOS audio utility\n\n\u003cimg src=\"Images/README/Screenshot.png\" width=\"340\" height=\"443\" /\u003e\n\n[Overview](#overview)\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;[Auto-pause music](#auto-pause-music)\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;[Application volume](#application-volume)\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;[Recording system audio](#recording-system-audio)\u003cbr/\u003e\n[Download](#download)\u003cbr/\u003e\n[Run / Configure](#run--configure)\u003cbr/\u003e\n[Build and Install](#installing-from-source-code)\u003c/br\u003e\n[Uninstall](#uninstall)\u003cbr/\u003e\n[Troubleshooting](#troubleshooting)\u003cbr/\u003e\n[Related Projects](#related-projects)\u003cbr/\u003e\n[License](#license)\u003cbr/\u003e\n\n# Overview\n\n+ Automatically pause/unpause your music player when other audio sources are playing/stopped\n+ Per-application volume control\n+ Record system audio\n+ No restart required to install\n\n##### *Note: Background Music is still in alpha.*\n\n## Auto-pause music\n\n**Background Music** automatically pauses your music player when a second audio source is playing and unpauses the player when the second source has stopped.\n\nThe auto-pause feature currently supports following music players:\n\n+ [iTunes](https://www.apple.com/itunes/)\n+ [Spotify](https://www.spotify.com)\n+ [VLC](https://www.videolan.org/vlc/)\n+ [VOX](https://vox.rocks/mac-music-player)\n+ [Decibel](https://sbooth.org/Decibel/)\n+ [Hermes](http://hermesapp.org/)\n+ [Swinsian](https://swinsian.com/)\n+ [GPMDP](https://www.googleplaymusicdesktopplayer.com/)\n\nAdding support for a new music player is usually straightforward.\u003csup id=\"a1\"\u003e[1](#f1)\u003c/sup\u003e If you don't know how to program, or just don't feel\nlike it, feel free to [create an issue](https://github.com/kyleneideck/BackgroundMusic/issues/new). Otherwise, see\n[BGMMusicPlayer.h](BGMApp/BGMApp/Music%20Players/BGMMusicPlayer.h).\n\n## Application volume\n\n**Background Music** provides a volume slider for each application running your system. You can boost quiet applications above their maximum volume.\n\n## Recording system audio\n\nYou can record system audio with **Background Music**. With **Background Music** running, launch **QuickTime Player** and select **File \u003e 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.\n\nYou can record system audio and a microphone together by creating an [aggregate\ndevice](https://support.apple.com/en-us/HT202000) that combines your input device (usually Built-in Input) with\nthe **Background Music** device. You can create the aggregate device using the **Audio MIDI Setup** utility under\n***/Applications/Utilities***.\n\n# Download\n\n**Requires macOS 10.13+**.\n\nYou can download the current version of **Background Music** using the following options. We also have [snapshot builds](https://github.com/kyleneideck/BackgroundMusic/releases).\n\n### Option 1\n\nDownload **version 0.4.3**:\n\n\u003ca href=\"https://github.com/kyleneideck/BackgroundMusic/releases/download/v0.4.3/BackgroundMusic-0.4.3.pkg\"\u003e\u003cimg\nsrc=\"Images/README/pkg-icon.png\" width=\"32\" height=\"32\" align=\"absmiddle\" /\u003e\nBackgroundMusic-0.4.3.pkg\u003c/a\u003e (771 KB)\n\n\u003e \u003csub\u003eMD5: 8c3bfe26c9cdf27365b9843f719ef188\u003c/sub\u003e\u003cbr/\u003e\n\u003e \u003csub\u003eSHA256: c1c48a37c83af44ce50bee68879856c96b2f6c97360ce461b1c7d653515be7fd\u003c/sub\u003e\u003cbr/\u003e\n\u003e \u003csub\u003ePGP:\n\u003e [sig](https://github.com/kyleneideck/BackgroundMusic/releases/download/v0.4.3/BackgroundMusic-0.4.3.pkg.asc),\n\u003e [key (0595DF814E41A6F69334C5E2CAA8D9B8E39EC18C)](https://bearisdriving.com/kyle-neideck.gpg)\u003c/sub\u003e\n\n### Option 2\n\nInstall using [Homebrew](https://brew.sh/) by running the following command in **Terminal**:\n\n```bash\nbrew install --cask background-music\n```\n\n# Run / Configure\n\nJust run `Applications \u003e Background Music.app`! **Background Music** sets itself as your default output device under\n`System Settings \u003e Sound` when it starts up (and sets it back on Quit).\n\n### Launch at Startup (Optional)\n\nAdd **Background Music** to `System Settings \u003e General \u003e Login Items`.\n\n# Installing from Source Code\n\n**Background Music** usually takes less than a minute to build. You need [Xcode](https://developer.apple.com/xcode/download/) version\n10 or higher.\n\n### Option 1\n\n1. Open **Terminal**.\n2. Copy and paste the following command into **Terminal**:\n\n```shell\n(set -eo pipefail; URL='https://github.com/kyleneideck/BackgroundMusic/archive/master.tar.gz'; \\\n    cd $(mktemp -d); echo Downloading $URL to $(pwd); curl -qfL# $URL | gzcat - | tar x \u0026\u0026 \\\n    /bin/bash BackgroundMusic-master/build_and_install.sh -w \u0026\u0026 rm -rf BackgroundMusic-master)\n```\n\n\u003cdetails\u003e\u003csummary\u003eMore info...\u003c/summary\u003e\n\nThis 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\ninclude a checksum), and will ensure that a half-downloaded copy of `build_and_install.sh` doesn't run.\n\n\u003c/details\u003e\n\n### Option 2\n\n1. Clone or [download](https://github.com/kyleneideck/BackgroundMusic/archive/master.zip) the project.\n2. If the project is in a zip, unzip it.\n3. Open **Terminal** and [change the directory](https://github.com/0nn0/terminal-mac-cheatsheet#core-commands) to the\n   directory containing the project.\n4. Run: `/bin/bash build_and_install.sh`.\n\nThe script restarts the system audio process (coreaudiod) at the end of the installation, so pause any applications\nplaying audio if you can.\n\nTo manually build and install, see [MANUAL_INSTALL.md](https://github.com/kyleneideck/BackgroundMusic/blob/master/MANUAL-INSTALL.md).\n\n# Uninstall\n\nTo uninstall **Background Music** from your system, follow these steps:\n\n1. Open **Terminal**.\n2. To locate `uninstall.sh`, run: `cd /Applications/Background\\ Music.app/Contents/Resources/`.\n3. Run: `bash uninstall.sh`.\n\nIf you cannot locate `uninstall.sh`, you can [download the project](https://github.com/kyleneideck/BackgroundMusic/archive/master.zip) again.\n\nTo manually uninstall, see [MANUAL_UNINSTALL.md](https://github.com/kyleneideck/BackgroundMusic/blob/master/MANUAL-UNINSTALL.md).\n\n# Troubleshooting\n\nIf Background Music crashes and your audio stops working, open `System Settings \u003e Sound` and change your\nsystem's default output device to something other than the **Background Music device**. If it already is, then\nchange the default device and then change it back again.\n\nMake sure you allow \"microphone access\" when you first run Background Music. If you denied it, go to\n`System Settings \u003e Security \u0026 Privacy \u003e Privacy \u003e Microphone`, find Background Music in the list\nand check the box next to it. Background Music doesn't actually listen to your microphone. It needs\nthe permission because it gets your system audio from its virtual input device, which macOS counts\nas a microphone. (We're working on it in [#177](/../../issues/177).)\n\nIf the volume slider for an app isn't working, try looking in `More Apps` for entries like `Some\nApp (Helper)`. For some meeting or video chat apps, you may need to do this to change the current\nmeeting volume.\n\n## Known issues and solutions\n\n- **Setting an application's volume above 50% can cause [clipping](https://en.wikipedia.org/wiki/Clipping_(audio)).**\n\n    - Set your volume to its maximum level and lower the volumes of other applications.\n\n- **Only 2-channel (stereo) audio devices are currently supported for output.**\n\n- **VLC pauses iTunes or Spotify when playing, and stops Background Music from unpausing your music afterward.**\n\n    - Under VLC's preferences, select **Show All**. Navigate to **Interface \u003e Main interfaces \u003e macosx** and change *Control external music players* to either *Do nothing* or *Pause and resume iTunes/Spotify*.\n\n- **Skype pauses iTunes during calls.**\n\n    - To disable this, uncheck *Pause iTunes during calls* on the **General** tab of **Skype**'s preferences.\n\n- **Plugging in or unplugging headphones when Background Music isn't running causes silence in the system audio.**\n    - Navigate to **System Settings \u003e 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.\n\n- **[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.**\n    - Chrome's audio will still play, but **Background Music** won't be aware of it.\n\n- **Some applications play notification sounds that are only just long enough to trigger an auto-pause.**\n    - 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.\n\nMany other issues are listed in [TODO.md](/TODO.md) and in [GitHub\nIssues](https://github.com/kyleneideck/BackgroundMusic/issues).\n\n# Related projects\n\n- [Core Audio User-Space Driver\n  Examples](https://developer.apple.com/library/mac/samplecode/AudioDriverExamples/Introduction/Intro.html)\n  The sample code from Apple that BGMDriver is based on.\n- [Soundflower](https://github.com/mattingalls/Soundflower) - \"MacOS system extension that allows applications to pass\n  audio to other applications.\"\n- [WavTap](https://github.com/pje/WavTap) - \"globally capture whatever your mac is playing—-as simply as a screenshot\"\n- [eqMac](http://www.bitgapp.com/eqmac/), [GitHub](https://github.com/nodeful/eqMac2) - \"System-wide Audio Equalizer for the Mac\"\n- [llaudio](https://github.com/mountainstorm/llaudio) - \"An old piece of work to reverse engineer the Mac OSX\n  user/kernel audio interface. Shows how to read audio straight out of the kernel as you would on Darwin (where most the\n  OSX goodness is missing)\"\n- [mute.fm](http://www.mutefm.com), [GitHub](https://github.com/jaredsohn/mutefm) (Windows) - Auto-pause music\n- [Jack OS X](http://www.jackosx.com) - \"A Jack audio connection kit implementation for Mac OS X\"\n- [PulseAudio OS X](https://github.com/zonque/PulseAudioOSX) - \"PulseAudio for Mac OS X\"\n- [Sound Pusher](https://github.com/q-p/SoundPusher) - \"Virtual audio device, real-time encoder and SPDIF forwarder for\n  Mac OS X\"\n- [Zirkonium](https://code.google.com/archive/p/zirkonium) - \"An infrastructure and application for multi-channel sound\n  spatialization on MacOS X.\"\n- [BlackHole](https://github.com/ExistentialAudio/BlackHole) - \"a modern macOS virtual audio driver that allows applications to pass audio to other applications with zero additional latency.\"\n\n### Non-free\n\n- [Audio Hijack](https://rogueamoeba.com/audiohijack/), [SoundSource](https://rogueamoeba.com/soundsource/) - \"Capture\n  Audio From Anywhere on Your Mac\", \"Get truly powerful control over all the audio on your Mac!\"\n- [Sound Siphon](https://staticz.com/soundsiphon/), [Sound Control](https://staticz.com/soundcontrol/) - System/app audio recording, per-app volumes, system audio equaliser\n- [SoundBunny](https://www.prosofteng.com/soundbunny-mac-volume-control/) - \"Control application volume independently.\"\n- [Boom 2](https://www.globaldelight.com/boom/) - \"The Best Volume Booster \u0026 Equalizer For Mac\"\n\n## License\n\nCopyright © 2016-2024 [Background Music contributors](https://github.com/kyleneideck/BackgroundMusic/graphs/contributors).\nLicensed under [GPLv2](https://www.gnu.org/licenses/gpl-2.0.html), or any later version.\n\n**Background Music** includes code from:\n\n- [Core Audio User-Space Driver\n  Examples](https://developer.apple.com/library/mac/samplecode/AudioDriverExamples/Introduction/Intro.html), [original\n  license](LICENSE-Apple-Sample-Code), Copyright (C) 2013 Apple Inc. All Rights Reserved.\n- [Core Audio Utility\n  Classes](https://developer.apple.com/library/content/samplecode/CoreAudioUtilityClasses/Introduction/Intro.html),\n  [original license](LICENSE-Apple-Sample-Code), Copyright (C) 2014 Apple Inc. All Rights Reserved.\n\n----\n\n\u003cb id=\"f1\"\u003e[1]\u003c/b\u003e However, if the music player doesn't support AppleScript, or doesn't support the events Background\nMusic needs (`isPlaying`, `isPaused`, `play` and `pause`), it can take significantly more effort to add. (And in some\ncases would require changes to the music player itself.) [↩](#a1)\n\n\n","funding_links":[],"categories":["Utilities","TODO scan for Android support in followings","C++","\u003ca name=\"cpp\"\u003e\u003c/a\u003eC++","Applications","Entertainment","语音识别与合成_其他","其它实用工具","Uncategorized","MacOS","Table of Contents","objective-c","Audio \u0026 Music","Sound"],"sub_categories":["Packages","Audio","Music","网络服务_其他","系统相关工具","Uncategorized","System Related Tools","🎵 Audio (36)","Other","System","What It Does"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyleneideck%2FBackgroundMusic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyleneideck%2FBackgroundMusic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyleneideck%2FBackgroundMusic/lists"}