You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Audio playback on macOS (OS X) lags/skips and is unlistenable with Bluetooth audio devices #72
Category: MPD
Tags: mpd, output, playback
Reproducibility: always
Severity: major
Priority: high
Status: assigned (to jacobvosmaer)
When I have my AirPods or my UE Mini Boom connected to my MacBook Pro via Bluetooth, MPD audio skips/lags - there's a pause in the audio every half second or so. Other audio sources (e.g., iTunes, Spotify, Safari) don't do this, so it doesn't appear to be a systemwide Bluetooth audio issue. I've played around with the buffer size settings in my mpd config file, to no avail.
If I kick the samplerate down, e.g., audio_output_format "22050:*:*", the problem is mostly (but not completely) fixed.
I used to be able to fix this by changing the mixer_type to "hardware" for my audio_output:
audio_output {
type "osx"
name "macOS"
mixer_type "hardware"
}
but this fix isn't working for me anymore.
Steps to Reproduce:
Connect AirPods or other Bluetooth Audio device to MacBook Pro. Play music in MPD. Hear skips.
Current solution:
Use mpd 0.19.x instead of 0.20.x.
Hi, I was playing with my bluetooth stereo just now, and noticed same problem.
After trying legacy versions, I noticed the problem may not be in mpd itself.
Using Music Player Daemon 0.20.9(latest):
when 1) using brew services start mpd, exactly same lag occurs.
2) using mpd ~/.config/mpd/mpd.conf, no more lag at all.
I noticed there is a "--no-daemon" in default plist file, but after trying mpd --no-daemon ~/.config/mpd/mpd.conf directly in console, there is also no lag as it is like with brew service.
my mpd audio_output as below:
audio_output {
type "osx"
name "CoreAudio"
mixer_type "software"
}
Reacted by thumphries, Justin Foley and Eric Boehs
As @ykelvis suggests, this seems to be a problem with the service definition in homebrew. By default, launchd applies some kind of resource limits. Bluetooth appears to cause MPD to blow its IO budget, or something like that.
I fixed this locally by setting ProcessType to Interactive in my MPD plist, lifting all resource limits. I'll head over to homebrew and try to make this the default. You should be able to replicate like so:
Thanks, @thumphries. Is there something this project can do to get better defaults for macOS users? Like ship this file in the source tarball and install it with make install?
Is there something this project can do to get better defaults for macOS users?
I've been using MPD since 2010 (thanks Max!) and on macOS since 2012. The process to get MPD running is easier than it has ever been, Homebrew handles everything, as simple as:
brew install mpd
brew services start mpd
As long as we keep those Homebrew service definitions up to date, I wouldn't worry too much. It's pretty good. This is the first bug I've encountered in 5 years. Perhaps some users are still compiling from source or using Macports, I can't comment on what they may prefer.
FWIW these settings are working pretty well for me (I was consistently having 1 second or so buffering, or pauses)
audio_output {
name "default"
type "ao"
mixer_type "software"
audio_buffer_size "8192"
buffer_before_play "25%"
}
Installed mpd via brew install mpd --with-libao. My setup is a raspberry pi with an external HD of FLAC files which I mount on my laptop using sshfs.
Reacted by Simon R., Justin Foley, Manassarn "Noom" Manoonchai, James Mills, Ben Lawson, смак со смыком, Gregory Parrish, Rolando, Pablo Padilla, anekos and 3 more
Reacted by James Mills, Rolando, Pablo Padilla and MiuKaShi
Reacted by Justin Blinder
Reacted by смак со смыком, Rolando, Pablo Padilla and MiuKaShi
@MaxKellermann I ran into this exact issue this week using MPD 0.20.13 on macOS Sierra (10.12). I run mpd as a service (using launchd) and my plist has the patch from homebrew-core#19410.
I play files locally and I don't have an audio_output configured (mpd defaults to coreaudio automatically). mpd works fine when using the headphone jack of my macbook but is completely unusable with a bluetooth device.
Thanks for the feedback. @Wang-Yue submitted OS X improvements, and I hoped that would have solved the problem. Unfortunately, I cannot help with this (persisting) problem because I have no Mac, and there is no other (regular) volunteer to work on OS X specific MPD issues.
Actually, looking at mpv source code may not be necessary; this sounds like a rather simple problem, because it appears to be trivial to reproduce. Once reproduced, the solution may be obvious. The problem is that the guy who reproduces this and comes up with said simple solution doesn't exist. It will stay that way until such a guy emerges and sends me his patch.
Is this still a problem? I tried it today using latest git master with a bluetooth headset and with a JBL Flip 2 on macOS High Sierra. Playback was completely flawless for both a 44.1khz CD rip and some hires 24 bit 96khz file (ALAC).
I never used spectrum visualization. Just gave it a go and yes, there are skips and hiccups even with the default built-in output device. It is interesting that playback is stable in case the visualizer is not shown in ncmpdcpp.
I do not see however how this is related to playback on bluetooth devices which is the issue here.
Any setup which uses the "fifo" or "pipe" output plugin is unsupported. But the original bug reported did not mention that he used it. I think this bug report has become pretty confusing now that people started posting irrelevant pieces of information.
I suggest closing this issue (because the original reporter never gave feedback), and people who still have problems on OS X shall write new bug reports with complete information.
I had this issue with coreaudio. Running mpd in the foreground or background didn't solve my problem. Changing type "osx" to type "ao" fixes the issue with choppy audio. Ultimately what fixed the issue completely, without having to change the type to "ao" was to use mpd to bypass coreaudio by using the dac device name.
audio_output {
type "osx"
name "xonar Essenceone"
device "Speaker"
format "*:32:2"
mixer_type "software"
dop "yes"
}
To get the DAC device name run the system_profiler SPAudioDataType command
$ system_profiler SPAudioDataType
Audio:
Devices:
Built-in Input:
Default Input Device: Yes
Input Channels: 2
Manufacturer: Apple Inc.
Current SampleRate: 44100
Transport: Built-in
Input Source: Line In
Built-in Output:
Manufacturer: Apple Inc.
Output Channels: 2
Current SampleRate: 44100
Transport: Built-in
Output Source: Digital Out
HDMI:
Manufacturer: Apple Inc.
Output Channels: 8
Current SampleRate: 96000
Transport: HDMI
Output Source: RX-V667
Speaker:
Default Output Device: Yes
Default System Output Device: Yes
Manufacturer: ASUS
Output Channels: 2
Current SampleRate: 44100
Transport: USB
Output Source: Default
I am running macOS 12.4 on both M1 and x86_64 machines. Currently on the
mac mini M1 I am running the following configuration:
audio_output {
type "osx"
name "CoreAudio"
mixer_type "software"
}
On the x86_64 machine, I am running libao:
audio_output {
type "ao"
name "default"
mixer_type "software"
}
In the past, I have had some issues using CoreAudio on the x86_64 machine.
But, I have not had any issues on the M1 machine. The output device is a
USB attached Mackie ProFX6 mixer on the mac mini M1 and the speaker output
on the x86_64 machine.
I run on the current source version from github. I run mpd as a user launch
agent.
On Sun, Jun 19, 2022 at 10:10 PM Manvendra Bhangui ***@***.***> wrote:
I had this issue with coreaudio. Running mpd in the foreground or
background didn't solve my problem. Changing type "osx" to type "ao"
fixes the issue with choppy audio. Ultimately what fixed the issue
completely, without having to change the type to "ao" was to use mpd to
bypass coreaudio by using the dac device name. The command
audio_output {
type "osx"
name "xonar Essenceone"
device "Speaker"
format "*:32:2"
mixer_type "software"
dop "yes"
}
To get the DAC device name run the system_profiler SPAudioDataType command
$ system_profiler SPAudioDataType
Audio:
Devices:
Built-in Input:
Default Input Device: Yes
Input Channels: 2
Manufacturer: Apple Inc.
Current SampleRate: 44100
Transport: Built-in
Input Source: Line In
Built-in Output:
Manufacturer: Apple Inc.
Output Channels: 2
Current SampleRate: 44100
Transport: Built-in
Output Source: Digital Out
HDMI:
Manufacturer: Apple Inc.
Output Channels: 8
Current SampleRate: 96000
Transport: HDMI
Output Source: RX-V667
Speaker:
Default Output Device: Yes
Default System Output Device: Yes
Manufacturer: ASUS
Output Channels: 2
Current SampleRate: 44100
Transport: USB
Output Source: Default
—
Reply to this email directly, view it on GitHub
<#72 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANFT3UFIJI65XDKVYZAJVDVP7OJNANCNFSM4DRCGRTQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
Activity
ykelvis commentedon Jul 7, 2017
Hi, I was playing with my bluetooth stereo just now, and noticed same problem.
After trying legacy versions, I noticed the problem may not be in mpd itself.
Using
Music Player Daemon 0.20.9(latest):when 1) using
brew services start mpd, exactly same lag occurs.2) using
mpd ~/.config/mpd/mpd.conf, no more lag at all.I noticed there is a "--no-daemon" in default plist file, but after trying
mpd --no-daemon ~/.config/mpd/mpd.confdirectly in console, there is also no lag as it is like with brew service.my mpd audio_output as below:
MaxKellermann commentedon Jul 31, 2017
Unfortunately, there is no MPD developer with OS X, thus the OS X plugin is unmaintained and unsupported.
thumphries commentedon Oct 13, 2017
As @ykelvis suggests, this seems to be a problem with the service definition in homebrew. By default, launchd applies some kind of resource limits. Bluetooth appears to cause MPD to blow its IO budget, or something like that.
I fixed this locally by setting
ProcessTypetoInteractivein my MPD plist, lifting all resource limits. I'll head over to homebrew and try to make this the default. You should be able to replicate like so:MaxKellermann commentedon Oct 13, 2017
Thanks, @thumphries. Is there something this project can do to get better defaults for macOS users? Like ship this file in the source tarball and install it with
make install?thumphries commentedon Oct 13, 2017
I've been using MPD since 2010 (thanks Max!) and on macOS since 2012. The process to get MPD running is easier than it has ever been, Homebrew handles everything, as simple as:
As long as we keep those Homebrew service definitions up to date, I wouldn't worry too much. It's pretty good. This is the first bug I've encountered in 5 years. Perhaps some users are still compiling from source or using Macports, I can't comment on what they may prefer.
thumphries commentedon Oct 13, 2017
It's possible the extra work being done by MPD when Bluetooth is enabled is a bug, mind you. I'm just sweeping it under the rug!
jaredculp commentedon Oct 25, 2017
FWIW these settings are working pretty well for me (I was consistently having 1 second or so buffering, or pauses)
Installed
mpdviabrew install mpd --with-libao. My setup is a raspberry pi with an external HD of FLAC files which I mount on my laptop usingsshfs.MaxKellermann commentedon Dec 21, 2017
Was there an improvement with MPD 0.20.13?
lopter commentedon Jan 3, 2018
@MaxKellermann I ran into this exact issue this week using MPD 0.20.13 on macOS Sierra (10.12). I run mpd as a service (using launchd) and my plist has the patch from homebrew-core#19410.
I play files locally and I don't have an audio_output configured (mpd defaults to coreaudio automatically). mpd works fine when using the headphone jack of my macbook but is completely unusable with a bluetooth device.
MaxKellermann commentedon Jan 3, 2018
Thanks for the feedback. @Wang-Yue submitted OS X improvements, and I hoped that would have solved the problem. Unfortunately, I cannot help with this (persisting) problem because I have no Mac, and there is no other (regular) volunteer to work on OS X specific MPD issues.
lopter commentedon Jan 3, 2018
I understand, thank you so much for the follow-up!
lopter commentedon Jan 3, 2018
One more detail I forgot to add: I don't have this issue with mpv, I guess it could be interesting to look at their coreaudio implementation.
MaxKellermann commentedon Jan 3, 2018
Actually, looking at mpv source code may not be necessary; this sounds like a rather simple problem, because it appears to be trivial to reproduce. Once reproduced, the solution may be obvious. The problem is that the guy who reproduces this and comes up with said simple solution doesn't exist. It will stay that way until such a guy emerges and sends me his patch.
coroner21 commentedon Feb 28, 2018
Is this still a problem? I tried it today using latest git master with a bluetooth headset and with a JBL Flip 2 on macOS High Sierra. Playback was completely flawless for both a 44.1khz CD rip and some hires 24 bit 96khz file (ALAC).
shrx commentedon Mar 1, 2018
@coroner21 do you experience any lag if you enable spectrum visualization?
Wang-Yue commentedon Mar 1, 2018
@shrx don't use spectrum visualization on OSX. The socket is not as performant as it is on Linux.
coroner21 commentedon Mar 1, 2018
I never used spectrum visualization. Just gave it a go and yes, there are skips and hiccups even with the default built-in output device. It is interesting that playback is stable in case the visualizer is not shown in ncmpdcpp.
I do not see however how this is related to playback on bluetooth devices which is the issue here.
MaxKellermann commentedon Mar 1, 2018
Any setup which uses the "fifo" or "pipe" output plugin is unsupported. But the original bug reported did not mention that he used it. I think this bug report has become pretty confusing now that people started posting irrelevant pieces of information.
I suggest closing this issue (because the original reporter never gave feedback), and people who still have problems on OS X shall write new bug reports with complete information.
szalishchuk commentedon Jun 4, 2018
mbhangui commentedon Jun 20, 2022
I had this issue with coreaudio. Running mpd in the foreground or background didn't solve my problem. Changing
type "osx"totype "ao"fixes the issue with choppy audio. Ultimately what fixed the issue completely, without having to change the type to "ao" was to use mpd to bypass coreaudio by using the dac device name.To get the DAC device name run the
system_profiler SPAudioDataTypecommanddhocker commentedon Jun 20, 2022