I have paired my Bluetooth headset with my Ubuntu 12.04 laptop with a Bluetooth chip inside:
lsusb | grep Bluetooth
Bus 003 Device 003: ID 045e:0745 Microsoft Corp. Nano Transceiver v1.0 for Bluetooth
The device has been paired, and with the help of blueman
, I've connected it to PulseAudio as a sink. Audio does come across in A2DP mode, but is terribly choppy and skips to the point of being not much better than nothing.
I read around and saw that there was a fix involving adjusting the nice
priority of the PulseAudio server. Since by default, PulseAudio runs on a per-user basis, I added the following to my /etc/security/limits.conf
:
* hard rtpio 0
* soft rtpio 0
@audio hard rtpio 20
@audio soft rtpio 20
pulse hard rtpio 20
pulse soft rtpio 20
I then added myself to the audio
group to be able to schedule priority for the pulseaudio
process. It seems that pulseaudio
is now running with a priority of -11
:
ps -eo pri,ni,cmd | grep [p]ulse
30 -11 /usr/bin/pulseaudio --start --log-target=syslog
This should mean that PulseAudio is running with a priority of -11, which is good.
However, even after restarting, I still get the terrible choppy audio.
How should I proceed? I'm trying to make this Bluetooth headset I purchased usable.
Note: I've tried pairing this device with an Android tablet right next to my laptop and it works fine, so it's not wireless congestion, it seems to be directly correlated to Linux somehow.
As none of the other answers worked on my system (Ubuntu 18.04 LTS on a 2012 MacBook Air), I found my solution on the german ubuntuusers wiki. English summary of the german instructions:
The choppy output might be caused by the A2DP implementation, and how it buffers sound before encoding it. For me, changing this buffer's size solved the choppy sound problem. You need to perform three steps:
Find necessary info about the bluetooth device (while it is connected!)
The output should be something like
We see that the buffers have currently 0 latency. In the next step, you will need the
NAME
andPORT
of your output. In this example, these arebluez_card.28_11_A5_84_B6_F9
andspeaker-output
, respectively.Set the buffer size (latency) of your card to a suitable value with this command pattern:
The latency unit of the following command is microseconds, so I'm using a 50 millisecond buffer for my command here:
Restart your bluetooth service to apply your change
As there is usually no documentation about this, you may have to experiment with higher or lower buffer values. Many people people posted their working latencies in the comments to this answer. Check them out for guidance on the latency value.
Edit the ALSA configuration file
Add the line
to the end of the file, and restart the
bluetooth
service:You can open the search bar (CTRL-D in unity, Windows-Key in Gnome) type in "Pulse" or "Volume". Open the GUI tool "Pulseaudio Volume Control", its icon looks like knob or gauge.
There you can select your Bluetooth speaker. Click on Advanced, set the Latency value just like proposed in the other answers . 45 ms or 50 ms seems to work for them, but I haven't found a good value that works for me.
A screenshot is attached. My Bluetooth Speaker is called SRS-BTX300. You don't need to restart bluetooth after changing the latency value.
Chris_128 answer worked for me but for newbies I'll add a bit detail.
For the NAME and PORT for the command below:
You will get it after you have result from typing:
The NAME will be "bluez_card.5C_FB_7C_0D_0F_EE" and the PORT will be "headset-output"
So for my case my command is
Restart your bluetooth service
Had the same issue with Ubuntu 18.04 running as dual boot in MacBook Mini. Tried changing the ALSA configuration as mentioned by @ConfirmAndCreateThisAccount.
But it didn't work.
So i installed Blueman using the below command
Then i disconnected the bluetooth device from the system bluetooth settings & re-paired using Blueman. Now everything is fine. Even the Play/Pause controls work.
The fix worked for me, although I did find that I had to REM the line before it. See below:
I solved my problem by changing the wifi connection I am using from using the 2.4 ghz connection (same as bluetooth) to a 5 ghz connection. My router and laptop are able to use both.