Bluetooth Audio and OS X

May 20, 2013 by Christopher Silvertooth

***  This currently does not work with Mavericks.  It is an Apple thing ***

 

So I just got a brand new pair of Bose Headphones courtesy of my parents for my birthday.  These are the new Bluetooth enabled Bose AE2W’s that can connect up to your iPhone and Mac at the same time (mega cool).

So I connected the cans up to my Mac quickly and started listening to some tunes.  Unfortunately my excitement quickly turned to disgust.  I am a pretty picky audio guy ( I won’t get into BT audio quality vs Direct)  and immediately noticed some tiny popping noises in the background of my music.  Most people probably won’t notice but I am somewhat OCD about these things.  I can deal with the slight loss in quality for convenience but popping sounds I won’t put up with.

So I start investigating.  I connect the Bose up to my iPhone and play the same songs I have on my Mac and don’t notice the problem.  So I do a bunch of googling and find that many people are having the same issues.

So I attempt many of their suggestions and each one seems to have slightly different results.  I have finally been able to lock in the correct settings for my Bose AE2W’s and have been listening without any noticeable popping or choppy music for an hour.

Here is my hypothesis as to what is going on based on research and testing:

As noted by many others, Apple artificially sets all bluetooth audio devices to a very low Bitpool Min rate.  This is the quality of the sound sent to your bluetooth device.  It ends up that when you send any sound to a bluetooth device the sound is compressed and the Bitpool min compresses the sound considerably resulting in terrible audio quality.

The part that really makes it suck more than normal isn’t necessarily the high compression, though that contributes, it is the fact that Apple’s bluetooth implementation will cycle the Bitpool trying to achieve the highest quality possible.  That sounds great right?  It will automatically keep attempting to get the highest quality sound out of your bluetooth audio device and why wouldn’t I want that eh?  The problem is it seems that every time the bitpool changes attempting to get a higher quality it creates the little pops in sound that are terribly annoying.

You can see this affect by doing the following in the terminal:


sudo touch /var/log/bluetoothAudio.log
sudo chmod 777 /var/log/bluetoothAudio.log
tail -f /var/log/bluetoothAudio.log

Here is a some sample output from the previous commands:


Mon May 20 16:36:18 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1363 Lowering bitpool:37 outstanding:6 packetsLate:0 mBitpoolDecrease:5
Mon May 20 16:36:18 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1262 [recalculate] TXDelta: 0.009333 (MTU:672.000000 Se:86.000000 Ne:64.000000 Tx:0.010667 Nx:512.000000)
Mon May 20 16:36:32 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1379 Raising bitpool:38 outstanding:0 packetsLate:0 mPacketsOverThreshold:0 mBitpoolAdjustMode:Slow totalEaseToIncreaseBitpool:740
Mon May 20 16:36:32 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1262 [recalculate] TXDelta: 0.009333 (MTU:672.000000 Se:88.000000 Ne:64.000000 Tx:0.010667 Nx:512.000000)
Mon May 20 16:36:47 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1379 Raising bitpool:39 outstanding:0 packetsLate:0 mPacketsOverThreshold:0 mBitpoolAdjustMode:Slow totalEaseToIncreaseBitpool:760
Mon May 20 16:36:47 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1262 [recalculate] TXDelta: 0.009333 (MTU:672.000000 Se:90.000000 Ne:64.000000 Tx:0.010667 Nx:512.000000)
Mon May 20 16:36:49 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1363 Lowering bitpool:34 outstanding:6 packetsLate:0 mBitpoolDecrease:5
Mon May 20 16:36:49 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1262 [recalculate] TXDelta: 0.010667 (MTU:672.000000 Se:80.000000 Ne:64.000000 Tx:0.010667 Nx:512.000000)
Mon May 20 16:37:03 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1379 Raising bitpool:35 outstanding:0 packetsLate:0 mPacketsOverThreshold:0 mBitpoolAdjustMode:Slow totalEaseToIncreaseBitpool:680
Mon May 20 16:37:03 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1262 [recalculate] TXDelta: 0.010667 (MTU:672.000000 Se:82.000000 Ne:64.000000 Tx:0.010667 Nx:512.000000)
Mon May 20 16:37:18 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1379 Raising bitpool:36 outstanding:0 packetsLate:0 mPacketsOverThreshold:0 mBitpoolAdjustMode:Slow totalEaseToIncreaseBitpool:700
Mon May 20 16:37:18 201 [BluetoothAudioAgent:945] AVStreamEndpoint.m:1262 [recalculate] TXDelta: 0.010667 (MTU:672.000000 Se:84.000000 Ne:64.000000 Tx:0.010667 Nx:512.000000)

In the above you can see the bitpool being lowered up and down. These seem to correspond to the annoying pops or choppiness in the audio.

The solution.

Connect your bluetooth audio device. Then run the following command in the terminal:

defaults read com.apple.BluetoothAudioAgent

The output should tell you your negotiated Bitpool as well as the Negotiated Bitpool Max. I am not certain if this is different based on each device but in my case it is 53 for the Bose Headphones. You can see this below.

{
 "Apple Bitpool Max (editable)" = 64;
 "Apple Bitpool Min (editable)" = 50;
 "Apple Initial Bitpool (editable)" = 30;
 "Negotiated Bitpool" = 30;
 "Negotiated Bitpool Max" = 53;
 "Negotiated Bitpool Min" = 2;
 "Stream - Flush Ring on Packet Drop (editable)" = 0;
 "Stream - Max Outstanding Packets (editable)" = 30;
 "Stream Resume Delay" = "0.75";
}
}

In order to minimize or negate the popping and choppy audio I set my Apple Bitpool Min, Initial Bitpool, and Initial Bitpool Min to the following values of 35, 53, and 35 respectively.  Below are the commands:


defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 35

defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 53

defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 35

These settings should maximize your quality and keep the Apple Bluetooth service from minimizing the constant cycling through your bitpool rates.

Cheers,

Chris

**UPDATED**  Added Applescript Application for easy changing.  This has been tested in 10.8 or higher and might work with 10.7

Bluetooth Audio Quality Changer v1.0

apple / Mac Fixes / random thoughts

Comments

  1. Steve says:

    Smart Kid to find BT problem and the fix

  2. Johan says:

    Thank you so much for this!

  3. ZAX says:

    Changed the last hours a few times and without success all settings around the BluetoothAgent (fighting with dropouts). Looks like your tool fixed my issues. First time that i can use my new Bose AE2w without any interference. Thank your for that. Great work.

  4. Rob says:

    both ways worked initially, however it would never consistently play the same quality no matter how many times I tried to change the settings, It would have 100% quality for the first few seconds, then it would quickly switch back to the popping low quality audio.. Any help?

    • Christopher Silvertooth says:

      Bluetooth makes me want to bang my head against the wall. It could be just about anything. Are you on WiFi? If so switch to a different frequency if you can or plug in via ethernet. Could also be that your doing disk or cpu intensive tasks. These will both contribute to quality issues. If you reboot and start nothing but itunes and try playing does it stay at a high quality?

  5. Joshua Fein says:

    I see that bluetoothd consumes 2-4% cpu (on a 2.5ghz mac mini). Very high cpu usage! This indicates to me that the bluetooth dongle is doing most of the work in software, making it sensitive to being interrupted by other tasks.

  6. Steve says:

    Very cool. Well described with a solution in place. Thanks so much. This really helped me out!

  7. Dude, awesome tip. I was really annoyed with that continuing pop. This solution solved my problem on the Macbook Pro (OSX 10.8.4).

    Thanks for it.

  8. [...] been messing with Bluetooth audio settings to try to keep my Bluetooth speakers from popping by changing settings via defaults write, but I’m afraid I’ve made the problem [...]

  9. Jeff says:

    ” I set my Apple Bitpool Min, Initial Bitpool, and Initial Bitpool Min to the following values of 35, 53, and 35 respectively.”

    This is not what the commands just below that sentence show.

    • Christopher Silvertooth says:

      Not sure why it wouldn’t set it. Can you send me the output? Also, this does not work in Mavericks as Apple has completely changed/hidden the ability to make these changes.

      Chris

      • Ramesh says:

        When I use the exact commands on the page I can see the quality changes to be better!

        But with the description ” I set my Apple Bitpool Min, Initial Bitpool, and Initial Bitpool Min to the following values of 35, 53, and 35 respectively” is incorrect. If I follow that and use the script it can get confusing.

  10. Bryn says:

    Hmm, in Mavericks it can’t find the settings area.

    $ defaults read com.apple.BluetoothAudioAgent
    2013-12-03 15:25:18.947 defaults[22888:507]
    Domain com.apple.BluetoothAudioAgent does not exist

    Anyone else seen this? Any idea how to change the quality settings in Mavericks.

    • Christopher Silvertooth says:

      I noticed this as well. It seems with Mavericks Apple has changed bluetooth. I looked all over for the settings files but haven’t found them yet. If you locate them please let me know so I can update this program.

      Thanks,

      Chris

      • Ramesh says:

        Jeff is right, the commands don’t match description ” I set my Apple Bitpool Min, Initial Bitpool, and Initial Bitpool Min to the following values of 35, 53, and 35 respectively.”

        • Christopher Silvertooth says:

          I will try and test this soon. Unfortunately I don’t have an 10.8 install so I need to create a VM to see what is going on. Thanks for the feedback.

          Chris

          • Justin says:

            Ramesh isn’t talking about Mavericks.

            The code you posted at the end does not contain the same settings in the sentence above it, you have have your variables mixed around somewhere.

            In the last sentence you have:
            Apple Bitpool Min: 35
            Initial Bitpool: 53
            Initial Bitpool Min: 35

            However in the code you have:
            Apple Bitpool Min: 35
            Initial Bitpool Min: 53
            Initial Bitpool: 35

            So you have Initial Bitpool and Initial Bitpool Min values mixed up somewhere.

          • Christopher Silvertooth says:

            Thanks for that catch. I will try and update as soon as possible. Been slammed lately so I apologize for the delay.

            Cheers,

            Chris

  11. Richard Tucker says:

    *Bump*
    same issue MBA OS X 10.9 Mav
    Jambox
    don’t have com.apple.BluetoothAudioAgent
    Thanks
    Richard

  12. Bert says:

    Same problem here on Mavericks :(

  13. Alex says:

    Thank you, problem solved with my BT bluedio.

    Just to let you know that in 10.9.3 i think they solved the issue. i had to go back to mountain lion due the consume of memory in mavericks in my case i have 8 GB in ram and i had the beach ball al the time, in lion or SL never happened.

    Regards.

Leave a Reply

Your email address will not be published. Required fields are marked *