-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stuttering audio and buffer underruns when WiFi is enabled #4
Comments
It looks like the daemon is not sending the audio data fast enough so alsa complains. In general you could try to do the following things in case of underruns:
In your case, the best bet would be option 3, I suppose. |
I am having what appears to be the same issue; from my Galaxy S4 I can pair and play audio but with severe drop outs / noise / crazy things happening with audio playback speed (double speed!). With a Galaxy S5 I can pair and play audio as well with zero drop outs but with a fair amount of static in the background. I have an idle load of 25% with bt_speaker.py being the source. I have uninstalled PulseAudio but have not updated bluez (due to inability to / no straightforward instructions to do so). What can I do to troubleshoot this further / correct the issue? I have Wi-Fi disabled via the taskbar tool to do so. |
Playback with double speed and such may indicate that format negotiation (sampling rate, channels, etc) failed. But I am not sure about that since the arriving stream is encoded anyway. If I can get hand on a device that reproduces the error, maybe I will look into this in the future. |
After some digging and messing around I was able to test with my S3 and have no issues with that device. After attempting to setup a hotspot via wlan0 when I brought the adapter up the dropouts occurred again. Taking down wlan0 reverses that action and also allows my S4 to perform without issues. I'm guessing when I disabled the wlan0 via the GUI it really wasn't disabled because I'm doing all of this via SSH. Using another Wi-Fi adapter via USB works and does not cause drop outs with either handset. |
@lnorton89 I can confirm that behavior regarding wlan0. I am using a Raspberry Pi Zero W. I was also seeing overruns in the journal. I saw your comment and brought down wlan0 while playing music. The dropouts immediately stopped. Now it is playing quite smoothly. Are the WiFi and Bluetooth chips on these boards (RPi 3 & Zero W) sharing a bus or channel? Perhaps that is the cause. Could we attempt to get around this by using a lower sampling rate on the ALSA side? A temporary workaround that would work for my use-case is to have a hook when a bluetooth client connects/disconnects that brings up/down the WiFi. |
Thanks for sharing. Looks like a common problem with the Pi and people fix it by investing in an additional WiFi or Bluetooth dongle. More info: |
I can confirm that using an external wifi adapter resolves the original issue I reported. I'll let @lukasjapan decide if he wants to close the issue. |
I'll leave it open for people to know. Using WiFi and Bluetooth at the same time is a very likely use case. |
Hi @lukasjapan, great project. |
The bt-speaker user probably doesn't have permission to bring down a
network interface. You could give it permission by adding it to the correct
system group.
On Sat, May 20, 2017, 4:33 PM tebo02ar ***@***.***> wrote:
Hi @lukasjapan <https://github.com/lukasjapan>, great project.
You consider add 'ifconfig wlan0 (up|down)' on connect/disconnect events?
I add 'subprocess.Popen('ifconfig wlan0 down', shell=True)' but nothing
happen.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAeq3nlCZHOZvayZl5yo_iZiKPAG69Muks5r73hPgaJpZM4M3zOn>
.
--
Patrick Hammer
|
I'm experiencing the same problem, only with an Anker Bluetooth keyboard, not a speaker. The keyboard works fine until I enable Bluetooth on my brand new Pi 3 model B. Then it stops working. |
I am facing a similar problem on my Pi 2. I use an external wifi adapter but disabling it doesn't fix the problem. |
I am tinkering more into this and I found something weird. I ran the command I have no idea what's happening at the moment. I'll see more into this if I can find anything useful. Can you guys test this out? |
Another thing I noticed that if I remove bt-speaker service and run the python file directly without root, the sound works fine as well. It causes problems only when running as root. Although, stuff like volume control, etc. is not available without root. Going to take a better look. |
As an update, I tried to follow this gist and now everything works perfect for me, including volume control. |
I have same problem with sound (very fast with pauses) (Samsung A5 2017). |
@ElShapovalov Thank you! I tried your suggestion, but I found that changing it to 32768 (2^15, seemed like a good number?) did the trick. I was still getting underruns with 10240. WiFi still on as well! Thank you! Edit: Of course, as I send this message, I started getting underruns again... :( Strangely, after about 2 minutes of perfect playback. I was streaming, but now I am playing a downloaded song via YouTube Music app on Android 5.1.1. Will report back. |
I had same problems (Stuttering audio and buffer underruns) when connecting from sm-t530. I checked 2 different android phones and everything worked smoothly. I can confirm that changing max_len to 10240 did the trick. I'm still getting 1/2 second lag but i guess with raspberry pi zero running bt and wifi it will just be like that. |
For me I had to adapt Now it works flawlessly with a external USB card. |
Confirming that @ScheissSchiesser 's suggestion above to increase the buffer to 32768 works with the wifi interface off ( I found that playing music from iTunes (12.8) from a Mac (Mac OS 10.13) produced the stuttering effect/underrun situation described by others here. |
Hello, how exactly can i edit codecs.py? I have the same issue with audio playing too fast and stopping every 2 seconds. |
I tested this with my phone and it worked fine but when I pair my Amazon echo dot, the playback is interrupted once every one to two seconds. Has anyone else experienced this or know a fix?
I know it's not a signal strength issue because the two are right beside each other. Thanks!
The text was updated successfully, but these errors were encountered: