profile
viewpoint
Kyle Neideck kyleneideck Australia

kyleneideck/BackgroundMusic 8092

Background Music, a macOS audio utility: automatically pause your music, set individual apps' volumes and record system audio.

kyleneideck/ANDS-Online-Services 1

Repository of Online Services (currently maintained by the Australian National Data Service)

kyleneideck/course 1

Functional Programming Course

mrjk05/statuswolf 1

Quickly keep track of anything

kyleneideck/approval_frame 0

Down with Plurality-Based Web Polling!

kyleneideck/homebrew-backgroundmusic 0

Custom Homebrew Cask Tap for the Background Music app

kyleneideck/node12-cypress-jenkins-library 0

node12-cypress-jenkins-library

issue commentkyleneideck/BackgroundMusic

Suggestions and feedback. 16 must have "simple" improvements

Thanks for the suggestions. It's always helpful to get feedback about these types of usability issues.

There should be the option not to auto-pause anything. To me it would be useful.

The UI is a bit confusing, but if you click the "Auto-pause [name of music player]" menu item, it becomes unchecked and auto-pause will be disabled. We should try to improve the UI for that, though, to make it clearer.

There should be an option to choose what apps appear in the section with "tiny tiny tiny sliders". Why do I have finder there. Of course I don't want to change finder volume.

That's what I thought as well until someone opened #45 and explained that they want to be able to control the volume for Quicklook. So then I took out the code that was hiding Finder.

But I definitely agree about trying to simplify the list of apps somehow, possibly with favourites or by making the apps that have played audio in the past more prominent.

0record0

comment created time in 5 days

issue commentkyleneideck/BackgroundMusic

Request: 10 band equaliser. Also, is there any way to route BGM output to Roman Kisil's eqMac?

Please help and if possible, integrate BGM with eqMac.

I actually mentioned the idea to Roman a while ago, but I don't think I heard back. I haven't really looked into it, but it should be possible.

It might not be that easy, but if you want to have a go at it, have a look at the BGM_PlayThrough class in BGMApp. It's a huge, messy class (I'm in the middle of refactoring it), but you can probably ignore most of it. CoreAudio calls the functions called the "IO procs" in BGM_PlayThrough when BGMApp receives each buffer of audio data from BGMDriver (InputDeviceIOProc) and when it needs the next audio buffer from BGMApp to play on the real output device (OutputDeviceIOProc). IIRC eqMac does all of its processing in the app, rather than the driver, so you could modify BGMApp so it somehow passes each buffer it receives in InputDeviceIOProc to eqMac for processing and then outputs the processed buffer in OutputDeviceIOProc.

I'm not sure whether it would be easier to set up IPC (inter-process communication) between eqMac and BGMApp to share the audio buffers or to just copy some of eqMac's code into BGMApp.

Feel free to ask if you have any questions or want some help with the code. Also, it'd be great if you could make a PR if you get it working. (Doesn't need to be polished or anything.)

If you don't mind the additional latency and CPU use, you could also just try running both apps at the same time, making sure the "Background Music" device is set as the macOS default device and setting the eqMac device as the output device in BGMApp. You might have to modify eqMac if it doesn't work when its virtual device isn't set as the macOS default device or something like that. Personally, I'd try to avoid doing it this way, but it might work well enough for your purposes.

AshH2O

comment created time in 5 days

issue closedkyleneideck/BackgroundMusic

volume from apps don't change even if i adjust them

(macOS catalina) the only volume i can adjust is the master volume or the internal speakers, nothing else works. fucking waste

closed time in 5 days

chrispatin0

issue commentkyleneideck/BackgroundMusic

Could not find the Background Music virtual audio driver

Do you see a device called "Background Music" in the Sound pane in System Preferences? If not, coreaudiod might not have restarted.

You could try this command: sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod. It should do the same thing as sudo killall coreaudiod, but I don't think sudo killall coreaudiod works on recent versions of macOS anymore. (We should update that error message.) Or if you want to be sure, you could just restart your computer.

If the Background Music device still doesn't show up, try installing the latest snapshot release from the releases page.

GarageMan

comment created time in 5 days

issue commentkyleneideck/BackgroundMusic

It worked but suddenly stop after a day

Yesterday I've tried it using headphones, and it worked like a charm, then I've decided to use my AirPlay server so I can listen to music using external speakers, and suddenly it stop working.

But it never worked with your AirPlay server, right? I just tested it out and the same thing happens for me. The AirPlay device is only shown in Background Music's list when it's selected as the default device in macOS.

Background Music can only work if the "Background Music" device is selected as the default device in macOS, so there's currently no way to use Background Music with AirPlay.

It used to work a long time ago, but then later versions of macOS stopped handling AirPlay devices like normal audio devices and now Background Music can't see them at all.

On the plus side, it looks like Apple has added public APIs for playing to AirPlay devices since the last time I looked into this, so maybe it's possible to add AirPlay support to Background Music now: https://stackoverflow.com/q/61629249. It looks a bit complicated and seems to be designed for apps playing media files rather than continuous audio, but I think it's at least worth looking in to it.

DavideVito

comment created time in 5 days

issue commentkyleneideck/BackgroundMusic

Komplete Audio 6ch 24 bit integer distorted sound

Thanks, everyone. What you're all suspecting is right. Background Music only works with 2-channel devices currently. It shouldn't be too hard to add support for other devices, but it was easier to start with 2-channel and no one's gotten around to extending it yet. I don't think there's a good workaround either.

If anyone's interested in having a go at it and making a PR, let me know and I'll explain in more detail.

loopbender

comment created time in 5 days

issue commentkyleneideck/BackgroundMusic

Does not work at all

I don't remember exactly why, but Chrome doesn't always work yet. I started working on it a while ago, but never got around to finishing it. I think this is the issue for it: #61

Zoom should work, but you have to change the output device to Background Music in Zoom's preferences: #267 #313 #288 #335

yifan121461

comment created time in a month

issue commentkyleneideck/BackgroundMusic

BGM: MacBook Air

@JonathanMbt Those messages all look like quite common ones. I think you might have Console.app set to only display errors. Normally coreaudiod would log much more when it starts up.

badgalxnaty

comment created time in a month

issue commentkyleneideck/BackgroundMusic

Is it possible to restart the BGM Driver?

@theLMGN No worries. I'm really bad about responding on here, too.

Disabling SIP: https://apple.stackexchange.com/questions/208478/how-do-i-disable-system-integrity-protection-sip-aka-rootless-on-macos-os-x

Then to debug coreaudiod, open the Background Music workspace in Xcode, go to Debug > Attach to Process by PID or Name..., enter coreaudiod as the process name and debug it as root. You might have to restart coreaudiod to get it to attach.

Also, if you're on the Big Sur beta, the process name will be different. Actually, then Background Music wouldn't work at all. Hopefully you're still on Catalina.

I haven't tried this process recently, so let me know if it doesn't work out for you or if you have any other questions.

theLMGN

comment created time in a month

issue commentkyleneideck/BackgroundMusic

Please add support for these apps

Have you tried the recommendations in these issues? #267 #313 #288 #335 #210

ElvisBerger

comment created time in a month

issue commentkyleneideck/BackgroundMusic

BGM: MacBook Air

Before both were accessible, even if headphones were plugged in, I could still switch to the built in audio output.

@JonathanMbt Do you mean you could switch from headphones to speakers? "Built-in Audio" is the name of the device, but it has something called a "data source", which is either headphones or speakers. At least, it is for me. Were you able to switch to the speakers and play audio out of them while you had headphones plugged in?

The logs you posted look normal to me. If you search for "coreaudiod", it will only show you those logs and you can copy all of them.

It looks like you've managed to uninstall Background Music, though, so I don't see how Background Music could be causing the issue at this point. I guess it's possible that Background Music could have triggered some sort of bug in macOS. I'm happy to have a look at your full coreaudiod logs and try to help, but I wouldn't say my chances are great.

badgalxnaty

comment created time in a month

issue commentkyleneideck/BackgroundMusic

BGM: MacBook Air

I have already tried all these solutions...except for the last one, I don't know how to retrieve the logs.

@JonathanMbt Where did you get stuck? Does this help? https://support.apple.com/en-au/guide/console/cnslbf30b61a/1.1/mac/10.15

badgalxnaty

comment created time in a month

issue commentkyleneideck/BackgroundMusic

BGM: MacBook Air

Have you tried uninstalling and then restarting your computer? It sounds like you have, but maybe there was a bug in the uninstall script and it didn't get fully uninstalled.

Try following MANUAL-UNINSTALL.md so you can make sure it's uninstalled, and then restarting. The most important step is

Delete Background Music Device.driver from /Library/Audio/Plug-Ins/HAL.

If that doesn't help, it must have triggered a bug in macOS somehow, unless there was a very coincidental hardware failure. Try using Console.app to get the logs for the coreaudiod process and restarting coreaudiod. (Instructions in MANUAL-UNINSTALL.md.) That will give you the logs for coreaudiod starting up, which might help diagnose the problem.

badgalxnaty

comment created time in a month

startedlinrock/blitz-tactics

started time in a month

issue commentkyleneideck/BackgroundMusic

BUG: Failed to set Tascam UH-7000 as output device

Thanks for the report. Does it log anything in Console.app when you try to change the output device? You should be able to find the logs by searching for "Background Music".

If you're using a recent snapshot build, you could try getting debug logs.

Do you get the same error if you set your Tascam UH-7000 as your default device in macOS before you open Background Music or is it only when you change the Background Music output device from a different device to the Tascam UH-7000?

ChrisTheEngineer

comment created time in 2 months

issue commentkyleneideck/BackgroundMusic

How do you remove BGM Audio Devices?

@69420XD https://github.com/kyleneideck/BackgroundMusic#uninstall

69420XD

comment created time in 2 months

issue commentkyleneideck/BackgroundMusic

Is my use case covered with BackgroundMusic?

Set the default audio output via Apple System config to "Headset Device"

The macOS default output device needs to be set to the Background Music device. Otherwise, Background Music can't inspect the audio.

Background Music itself is also configured to use "Internal speakers".

In the Background Music menu, set your headset as the output device.

It's confusing, but there's not much we can do about it because macOS doesn't support any other way to inspect/modify the system audio.

Also, don't forget to set VLC as your music player in Background Music. (It's in the Preferences menu under "Auto-pause".)

nicx

comment created time in 2 months

issue commentkyleneideck/BackgroundMusic

Is my use case covered with BackgroundMusic?

@nicx Apple Music might let you set its output device through its AppleScript API. It probably doesn't, but it could be worth checking. Other than that, the only other option I can think of is to try a different music player. VLC supports changing its output device.

nicx

comment created time in 2 months

issue commentkyleneideck/BackgroundMusic

Is my use case covered with BackgroundMusic?

You're probably already aware of this, but you might be able to make your headset your default output device and configure your music player to use your internal speakers. Then Background Music would be able to pause the music while you're taking a call on your headset. It wouldn't be able to tell when audio is playing on your internal speakers anymore, but if you only care about pausing the music during calls and don't mind other apps using your headset (at least by default), it might be an acceptable workaround.

nicx

comment created time in 2 months

issue commentkyleneideck/BackgroundMusic

Is my use case covered with BackgroundMusic?

It sounds like the problem is probably that Teams is playing the call audio to one of your real audio devices (the headset) rather than playing it to the Background Music device. If that's happening, Background Music has no way to inspect the audio or tell when audio is playing.

If you configured Teams to play the call audio to the Background Music device, Background Music would keep the music paused, but then you'd hear the call audio through your internal speakers instead of your headset.

I think the ideal solution would be for Background Music to publish one virtual device for each real device. That would take a fair amount of effort, though. I'd be happy to merge a PR for it, but it'll probably be a while before I'd be able to work on it myself.

nicx

comment created time in 3 months

issue commentkyleneideck/BackgroundMusic

Save Volume Settings

@CrystalSpore When a process registers with CoreAudio to play audio, CoreAudio sends BGMDriver (the virtual audio driver) the process's bundle ID. CoreAudio calls the process a "client". When you change an app's volume, BGMApp sends the app's bundle ID to BGMDriver and BGMDriver tries to match it to a client.

To save the app volumes (and pans), I think we would need to save mBundleID, mRelativeVolume and mPanPosition for each client that has a volume or pan set in BGMDriver.

Another option would be to save the app volumes in BGMApp and send them to BGMDriver when BGMApp starts up. It's been a while since I last looked at this code, but it looks like setVolume and setPanPosition in BGMAppVolumesController would be good places to save the volumes/pans.

BGMApp currently gets the app volumes from BGMDriver when it starts up, so I think it would need to get them from user defaults instead and send them to BGMDriver.

BGMApp already saves some user data -- see BGMUserDefaults.h -- so it might be easier to save the app volumes in the same way. On the other hand, it sounds like saving the volumes in BGMDriver might end up being a smaller change.

I don't think it really matters from a user's perspective whether they're saved in BGMDriver or BGMApp, so I'd recommend picking the option you think will be easier.

SpikeyMikey

comment created time in 3 months

pull request commentkyleneideck/BackgroundMusic

Update README.md

Thanks, merged your fix.

stenalpjolly

comment created time in 3 months

push eventkyleneideck/BackgroundMusic

Stenal P Jolly

commit sha 6486c8ccf37075b90ea11356bde926f793056202

Update README.md

view details

Kyle Neideck

commit sha 63393054baaa96d9e6e64d8c4ed97343e30d6de0

Merge pull request #349 from stenalpjolly/patch-1 Update README.md

view details

push time in 3 months

PR merged kyleneideck/BackgroundMusic

Update README.md

Updating the "Build and Install" link

+1 -1

1 comment

1 changed file

stenalpjolly

pr closed time in 3 months

issue commentkyleneideck/BackgroundMusic

Request: Indicate which application is generating audio

BGMDriver (the virtual audio driver) gets a list of the 'clients' that have registered with CoreAudio to play audio. It also gets a bundle ID and PID for each client.

BGMDriver knows whether a client is playing audio or not, so it could send the list of clients currently playing audio to BGMApp (Background Music.app). Then BGMApp could try to match the clients to the apps and light up the LEDs for those apps.

I think it actually might even be better not to worry about whether an app is playing or has played audio and just indicate/filter the apps that have a client registered with CoreAudio. In my experience, there usually aren't that many.

BGMApp wouldn't always be able to figure out which app is actually playing the audio from the user's perspective, since it has to go by the processes that it matches to the clients' bundle IDs and PIDs. That's also the main reason that the app volume controls don't work for some apps.

Even with that limitation, I agree that it would definitely help you figure out which volume sliders will actually do anything.

My preference is probably to move apps into a different part of the UI in BGMApp when they match with a CoreAudio client. Maybe we could just put them at the top of the list.

We might also want to consider moving apps from the More Apps menu to the main menu when they match with a client.

carlosedp

comment created time in 3 months

pull request commentkyleneideck/BackgroundMusic

Updated README.md

Merged, thanks!

YohanTz

comment created time in 3 months

push eventkyleneideck/BackgroundMusic

Yohan Tancrez

commit sha dd05f60c1da84df61066a17e9d99ff2ff79d0f0e

Updated README

view details

Kyle Neideck

commit sha c068810953c63fb69775e9291e570d142035a86d

Merge pull request #344 from YohanTz/readme-update Updated README.md

view details

push time in 3 months

startedankitects/anki

started time in 3 months

issue commentkyleneideck/BackgroundMusic

Localization

That would be great. I've only started looking into it a bit so far, just reading the Weblate docs, but it doesn't look like it would be too hard to set up.

I'll have a go at it when I get a chance. That might be a while, though, so anyone else should feel free to make a PR if they want.

KovalevArtem

comment created time in 3 months

issue commentkyleneideck/BackgroundMusic

Is it possible to restart the BGM Driver?

The only thing I can think of is that we recently changed BGMDriver to use CARingBuffer for the ring buffer in

Maybe? However i've had the glitching (especially when Roblox/RobloxStudio crashes) for years.

I guess that rules out that theory then. You could try debugging BGMDriver if it happens again, but it probably wouldn't be easy. IIRC you need SIP disabled to debug coreaudiod (the process BGMDriver runs in).

Eep - that was me. IIRC the context was that previously output was done using timestamp % bufferSize, so there was no concept of what time ranges of audio were defined or undefined resulting in repeating stale audio if a client stopped writing. I'm pretty sure it is still possible to get stale data out of BGM, however it seems much rarer.

CARingBuffer was supposed to fix that.

As far as I've been able to tell, it did fix that.

It's definitely possible that it was just coincidental timing and the glitches I was getting were caused by an unrelated bug or a new OS bug. I get similar glitches when I'm not running Background Music, just not as many. It seems to only happen when starting IO.

coreaudiod was occasionally logging CPU overload errors for BGMDriver, but I tried logging the amount of time BGMDriver was spending in IO operations and it was always well below the IO threads' limits.

Anyway, it sounds like it's a separate issue. I'll open a ticket for it when I get a chance to write it up properly.

I suspect that might have also made BGMDriver's audio more likely to glitch/pop under high load, so I've been thinking about trying to replace CARingBuffer with TPCircularBuffer.

I'm a fan of TPCircularBuffer. However does it materially change anything [apart from introducing objective-c]? Both are lock free. CaringBuffer's cpu load detection is frankly either weird or ingenious...

You're right. It probably wouldn't change anything. It shouldn't, if we're not running into some bug in CARingBuffer.

I did try reverting the CARingBuffer change in BGM_Driver and I think it might have made the glitches less frequent, but it was hard to tell.

I don't think TPCircularBuffer has any Objective-C code, by the way. The parts I read were all C.

theLMGN

comment created time in 3 months

more