Skip to content

Instantly share code, notes, and snippets.

@dvf
Last active July 17, 2024 10:16
Show Gist options
  • Save dvf/3771e58085568559c429d05ccc339219 to your computer and use it in GitHub Desktop.
Save dvf/3771e58085568559c429d05ccc339219 to your computer and use it in GitHub Desktop.
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

UPDATE: It looks like Apple has silently dropped support for aptX, leaving only AAC

You'll need to download Apple's Bluetooth Explorer in order to change codecs.

  1. Head over to Apple's Developer Downloads

  2. Search for additional tools and download Additional Tools for XCode 11.dmg Search for "additional tools"

  3. Open the dmg, and open Bluetooth Explorer Open Bluetooth Explorer

  4. Click on Tools > Audio Options and change your audio codec to the following settings:

    • Enable AAC
    • Force use of aptX
    Change your audio codec
  5. Disconnect your Bluetooth headset, reconnect it, and while some music is playing, inspect your codec. It should now show either AAC or aptX.

    Your codec should now show AAC/aptX

Squeezing the most out of AAC

You can increase the AAC bitrate in Audio Options but be sure to keep an eye on the graphs. The retransmission percentage is roughly equivalent to packet loss, and if you increase the bitrate too high your audio will start cutting out:

The retransmission rate is a function of distance and interference, and you'll need to disconnect/reconnect on each attempt before you find the sweet spot.

@naruto-chelsea
Copy link

SInce updating to Monterey, my beats studio buds stuttering so much and have found no solution for it

@naruto-chelsea
Copy link

I need some help with my Beats studio buds on macbook pro, they stutter way too much when connected. Please somebody help me with this. I'm on macos Monterey 12.5

@justin-caldicott
Copy link

This is a real pita. I recently got some AKG N60 headphones for both music & video calls as they support AptX LL. It seems I need to use a separate USB Bluetooth receiver for them to keep the latency down.

@m0rg5
Copy link

m0rg5 commented Oct 19, 2022

I just got a Macbook air m1 (1st mac in 20yrs) and noticing the degraded quality of my Edifier TWS1 Pro's (Aptx + AAC) is what brought me here. I've tried everything I've found (details at top are deprecated in 12.6), and seen no codec change from SBC.

I just tried toothfairy that has an option - preferences/advanced/
"improve sound quality by disabling audio input from device".

This did indeed stop the mic-input defaulting to headphones on reconnect, but this made no change to the codec.

Monterey 12.6

@m0rg5
Copy link

m0rg5 commented Oct 19, 2022

Has anyone found a solution to this issue? AptX up and running on Monterey?

AptX officially removed from Monterey, but AAC supposedly remains yet I've read that a lot (most?) people with non-Apple bluetooth devices are not able to get AAC working. Looks suspiciously like it might be by design.

@liujunhui2
Copy link

Just for reference, I'm on MacOS Monterrey on an M1 Max, I've never altered the bluetoothaudiod defaults value, and I get this in my console logs when connecting my Bose QC 35's:

A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 221 kbps. 1 frames * (12+644) bytes = 656 per RTP (max=656) every 23.22 ms

Have you tried to turn the mic on? You can have a one person meeting or test your mic in the settings. The codec falls back to mSBC and results in a very bad sound quality.

@m0rg5
Copy link

m0rg5 commented Oct 21, 2022

I haven't ever turned-the-mic-on (it's on by default), I don't need a Mic and happy to leave off to get better audio.
From what I've read, I've assumed this is the issue, yet have tried and failed to disable mic (can only mute it).

This is my first macbook in 20 yrs.

Presuming you're advising I disable the mic - any tips?

@madzul
Copy link

madzul commented Oct 26, 2022

FYI
my Redmi Buds 3 pro working smoothly on my MBA 2018 (Monterey 12.5)
A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 221 kbps. 1 frames * (12+644) bytes = 656 per RTP (max=656) every 23.22 ms

@jonahpearl
Copy link

jonahpearl commented Dec 19, 2022

Any thoughts on how to do this on an iPhone? My iPhone 11 (!!) has decided to only use SBC, I think, and it's truly a painful difference. I have some Bose 700 HPs. I noticed because bluetooth audio sounds much better through my laptop, which, indeed, is using AAC.

Link explaining how to use the Console to see the iphone bluetooth codec: https://www.head-fi.org/threads/howto-find-which-codec-is-used-between-ios-device-and-bluetooth-headphones.835289/

Selected output lines from connecting my headphones to my iphone:

Bad48KHzCodecs: Disabling 48 KHz - Device is NOT in 48 KHz AAC allowlist
Creating HFPAudioDevice for device 78:2B:64:D2:C3:B8 with codec: mSBC
Audio Codec ID SBC for remote SEID 1

However it does then go on to say

Selected preferred codec AVDTP_CODEC_MPEG_AAC (0x2) out of 7 available endpoints
A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 192 kbps. 1 frames * (12+558) bytes = 570 per RTP (max=879) every 23.22 ms

so I wonder if somehow the fact that the phone is viewing it as a "hands-free profile" (HFP) first is somehow overriding the AAC codec that it then tries to set up. Reminds of issues of listening to music and then opening Zoom -- the Zoom audio takes over and suddenly everything sounds terrible.

EDIT: never mind, the audio was on "mono" and that was ruining the quality. But weird that it was sometimes connecting with mSBC 🤷‍♂️

@dseddah
Copy link

dseddah commented Jan 23, 2023

Hi everyone,
I fixed this by using toothfairy (a small utility on the store but a bit expensive). It has an option to maintain the sound quality.

@joesatriani10
Copy link

I tried toothfairy as well for Sennheiser Momentum 4, I just uninstalled after 5 minutes and waiting for my refund cause it didnt do any improvement and just crash my MBP M1 Pro with fresh MacOS Ventura.

@dseddah
Copy link

dseddah commented Jan 25, 2023

I'm sorry for you it didn't work. I'm on monterey, don't know if it plays a role.

Copy link

ghost commented Feb 7, 2023

I tested this on my Noble Mystique and Sony 1000xm4 and I'm not sure why the Sony gets shafted here. I know the Mystique uses AptX and 1000xm4 uses LDAC, but it doesn't matter here anyways.

Noble Mystique:

A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 256 kbps. 1 frames * (12+744) bytes = 756 per RTP (max=879) every 23.22 ms

ACMP4AACBaseEncoder.cpp:650   (0x125244440) @@@@ 'aac ' encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 1, bitrate = 128000, quality (complexity) = 64, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 0 (bits), packetBitSizeMin = 0 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0

ACMP4AACBaseEncoder.cpp:650   (0x125244440) @@@@ 'aac ' encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 5952 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0

Sony 1000xm4:

A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 192 kbps. 1 frames * (12+558) bytes = 570 per RTP (max=656) every 23.22 ms

ACMP4AACBaseEncoder.cpp:650   (0x124b34e40) @@@@ 'aac ' encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 1, bitrate = 128000, quality (complexity) = 64, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 0 (bits), packetBitSizeMin = 0 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0

ACMP4AACBaseEncoder.cpp:650   (0x124b34e40) @@@@ 'aac ' encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 144000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 4464 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0

@LetrixZ
Copy link

LetrixZ commented Mar 13, 2023

I'm on Ventura. I wanted to know if it's possible to disable the mic on the bluetooth headphones. The option in Bluetooth Explorer does nothing.

@i3p9
Copy link

i3p9 commented Mar 13, 2023

@LetrixZ since it's not directly related, i would suggest using something like https://github.com/deweller/switchaudio-osx to programmatically switch to a output device other than your bt headphones, this doesn't outright disables the microphone but switching to output device that's not your bt headphones should switch to a better codec.

@plancha2002
Copy link

Confirming that @eEQK's method works for me on Android (Galaxy S21, Android 12, Sony Headphones Connect v9.0.1) and WH-1000XM3 (XM3 that go over the ears).

Steps:

  1. Connect the headphones to MacBook
  2. Follow this comment and verify that the codec is SBC
  3. Disconnect XM3 from MacBook
  4. Connect XM3 to Android
  5. Open the Sony Headphones Connect app
  6. Navigate to "Sound" and scroll down until you see "Sound Quality Mode"
  7. Update the "Sound Quality Mode" setting to "Priority on Sound Quality"
  8. Let the headphones reconnect to Android
  9. Disconnect from Android
  10. Connect to MacBook
  11. Follow this comment and verify that the codec is AAC-LC

thanks

@cansozbir
Copy link

After using my soundcore life q10 with my macbook pro m1 pro for a few hours, I see this in the console:

Bad48KHzCodecs: Disabling 48 KHz - Device is NOT in 48 KHz AAC allowlist. The log repeats itself, and the sound starts interrupting.

Screenshot 2023-06-15 at 00 23 39

When I first connect it, it clearly mentions that it's using AAC.

What might be the problem? I am considering buying high-end headphones, just to get rid of this stupid problem. Every 1-2 hours I need to restart the headphone. Disconnecting and reconnecting doesn't solve the issue, I need to restart the headphones.

@ApplY3D
Copy link

ApplY3D commented Sep 27, 2023

What about macOS 14 Sonoma?

@noizo
Copy link

noizo commented Oct 2, 2023

What about macOS 14 Sonoma?

Audio Technica ATH-M20xBT
Bluetooth explorer/Audio options can't be launched on M1 chipset with sonoma.

By default i'm getting this in console:
A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 221 kbps. 1 frames * (12+644) bytes = 656 per RTP (max=656) every 23.22 ms

@mrdc
Copy link

mrdc commented Oct 25, 2023

I can confirm that there is no AptX in Ventura, but AAC-LC VBR:

A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 244 kbps. 1 frames * (12+709) bytes = 721 per RTP (max=879) every 23.22 ms

We can try these settings from previous versions of macOS:

"AAC Bitrate" = 128;
"AAC CBR" = 0;
"Apple Bitpool Max" = 64;
"Apple Bitpool Min" = 2;
"Apple Initial Bitpool" = 40; 

@fuomag9
Copy link

fuomag9 commented Nov 12, 2023

I tested this on my Noble Mystique and Sony 1000xm4 and I'm not sure why the Sony gets shafted here. I know the Mystique uses AptX and 1000xm4 uses LDAC, but it doesn't matter here anyways.

Noble Mystique:

A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 256 kbps. 1 frames * (12+744) bytes = 756 per RTP (max=879) every 23.22 ms

ACMP4AACBaseEncoder.cpp:650   (0x125244440) @@@@ 'aac ' encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 1, bitrate = 128000, quality (complexity) = 64, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 0 (bits), packetBitSizeMin = 0 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0

ACMP4AACBaseEncoder.cpp:650   (0x125244440) @@@@ 'aac ' encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 5952 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0

Sony 1000xm4:

A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 192 kbps. 1 frames * (12+558) bytes = 570 per RTP (max=656) every 23.22 ms

ACMP4AACBaseEncoder.cpp:650   (0x124b34e40) @@@@ 'aac ' encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 1, bitrate = 128000, quality (complexity) = 64, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 0 (bits), packetBitSizeMin = 0 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0

ACMP4AACBaseEncoder.cpp:650   (0x124b34e40) @@@@ 'aac ' encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 144000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 4464 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0

I'm on sonoma and my xm4 get 256 for max VBR
telegram-cloud-photo-size-4-5947399884204260734-y

@AlienegraGeek
Copy link

AlienegraGeek commented Nov 13, 2023

I tested this on my Edifier W820NB and output this log
A2DP configured at 44.1 KHz. Codec: SBC, Bitpool: 52 (322 kbps). 5 frames * 117 bytes = 585 per RTP (max=663) every 14.51 ms
ACSBCEncoder.cpp:214 (0x7fd93aa74cc0) Output format: 2 ch, 44100 Hz, sbc (0x00000000) 0 bits/channel, 0 bytes/packet, 0 frames/packet, 0 bytes/frame

@ballo
Copy link

ballo commented Nov 14, 2023

@Eugene-Y
I can't speak for all MacOS versions, but I do this on Monterey:

  1. Disconnect your headphones.
  2. Open the "Console" app (Under "Applications/Utilities").
  3. In the "Search" field, in the upper-right corner, type "Codec", and hit "Enter".

These instructions don't work on Ventura. Console doesn't show anything even before filtering.
It would be better to know the log file I'm supposed to be monitoring so I can use the terminal instead of Apple's silly app

@SerialHobbyAbandoner
Copy link

@ballo
These instructions don't work on Ventura. Console doesn't show anything even before filtering.
It would be better to know the log file I'm supposed to be monitoring so I can use the terminal instead of Apple's silly app

You need to hit "Start" as well before reconnecting your headphones. It works on Sonoma.

@JaviLib
Copy link

JaviLib commented Dec 3, 2023

On Sonoma for modern BT5 headphones (like OneOdio Pro C):

defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80;
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 80;
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 80;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 80;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 80;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 80;
defaults write com.apple.BluetoothAudioAgent "Stream - Flush Ring on Packet Drop (editable)" 0;
defaults write com.apple.BluetoothAudioAgent "Stream - Max Outstanding Packets (editable)" 16;
defaults write com.apple.BluetoothAudioAgent "Stream Resume Delay" "0.75"

defaults write bluetoothaudiod "Enable AAC codec" -bool true
defaults write bluetoothaudiod "AAC Bitrate" -int 320
defaults write bluetoothaudiod "AAC max packet size" -int 644

Don't forget to reset the bluetoothd daemon:

sudo pkill bluetoothd

I hope it helps.

@aljustiet
Copy link

How enable ldac on macOS?

@jank-jank
Copy link

For everyone struggling with Sony headphones, "Sound Quality Mode" can be changed manually without the app. The instruction below is for the MDR-650BT, but also worked for my old MDR-950B1.
https://helpguide.sony.net/mdr/xb650bt/v1/en/contents/TP0001034995.html
Previously connecting to SBC, now successful: A2DP configured at 44.1 KHz. Codec: AAC-LC [...].

@gr3ddy
Copy link

gr3ddy commented Jan 18, 2024

On Sonoma for modern BT5 headphones (like OneOdio Pro C):

defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80;
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 80;
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 80;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 80;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 80;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 80;
defaults write com.apple.BluetoothAudioAgent "Stream - Flush Ring on Packet Drop (editable)" 0;
defaults write com.apple.BluetoothAudioAgent "Stream - Max Outstanding Packets (editable)" 16;
defaults write com.apple.BluetoothAudioAgent "Stream Resume Delay" "0.75"

defaults write bluetoothaudiod "Enable AAC codec" -bool true
defaults write bluetoothaudiod "AAC Bitrate" -int 320
defaults write bluetoothaudiod "AAC max packet size" -int 644

Don't forget to reset the bluetoothd daemon:

sudo pkill bluetoothd

I hope it helps.

But the bitrate value in console hasn't changed🤔

@JaviLib
Copy link

JaviLib commented Jan 18, 2024

But the bitrate value in console hasn't changed🤔

Try by restarting the computer. If that doesn't work it probably means your headphones are not capable of higher bitrates.

Also you could try the increasing the bitpool even more. It probably won't work if the headphones have a limit, but it's worth trying:

defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 320;
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 2;
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 320;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 320;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 320;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 2;
defaults write com.apple.BluetoothAudioAgent "Stream - Flush Ring on Packet Drop (editable)" 0;
defaults write com.apple.BluetoothAudioAgent "Stream - Max Outstanding Packets (editable)" 1;
defaults write com.apple.BluetoothAudioAgent "Stream Resume Delay" "0.75"

defaults write bluetoothaudiod "Enable AAC codec" -bool true
defaults write bluetoothaudiod "AAC Bitrate" -int 320
defaults write bluetoothaudiod "AAC max packet size" -int 644

@gr3ddy
Copy link

gr3ddy commented Jan 20, 2024

But the bitrate value in console hasn't changed🤔

Try by restarting the computer. If that doesn't work it probably means your headphones are not capable of higher bitrates.

Also you could try the increasing the bitpool even more. It probably won't work if the headphones have a limit, but it's worth trying:

defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 320;
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 2;
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 320;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 320;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 320;
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 2;
defaults write com.apple.BluetoothAudioAgent "Stream - Flush Ring on Packet Drop (editable)" 0;
defaults write com.apple.BluetoothAudioAgent "Stream - Max Outstanding Packets (editable)" 1;
defaults write com.apple.BluetoothAudioAgent "Stream Resume Delay" "0.75"

defaults write bluetoothaudiod "Enable AAC codec" -bool true
defaults write bluetoothaudiod "AAC Bitrate" -int 320
defaults write bluetoothaudiod "AAC max packet size" -int 644

I'm using an "Alternative A2DP Driver" on Windows PC and it works properly with higher bitpool values. Anyway, now I'm trying to enable 320kbit/s bitrate for AAC codec.

@porfidev
Copy link

BT Receptor UGREEN-40759P

A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 256 kbps. 1 frames * (12+744) bytes = 756 per RTP (max=879) every 23.22 ms

Enabled:
sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true
sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true

Verify with:
sudo defaults read bluetoothaudiod

@Volderex
Copy link

Volderex commented May 7, 2024

star

@DarthZurath
Copy link

This no longer works on Sonoma. Bluetooth Explorer is crashing and is useless.
sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true is no good either. It does nothing.
Any up to date methods?

@ImExoOdeex
Copy link

same as @DarthZurath, on Sonoma it doesn't work. Using headphones in so bad quality hurts my ears after whole day of using sound card at my pc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment