Skip to content

Instantly share code, notes, and snippets.

@dvf
Last active December 10, 2024 12:27
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.

@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

@Notdutra
Copy link

any update on somethings that works on sequoia?

@furu00
Copy link

furu00 commented Jul 30, 2024

same problem here

@ujkuo
Copy link

ujkuo commented Aug 15, 2024

Same problem for Sonoma here. Try sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true and sudo defaults read bluetoothaudiod shows

"Enable AAC codec" = 0;
    "Enable AptX codec" = 1;

It still returns 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. Any solution?

@stepchud
Copy link

stepchud commented Sep 4, 2024

I'm on Sonoma 14.5. Is there a new domain now?

➜  ~ sudo defaults read bluetoothaudiod
2024-09-04 09:03:23.653 defaults[76291:151876843]
Domain bluetoothaudiod does not exist
➜  ~ sudo defaults domains
.GlobalPreferences_m, AppSSODaemon, applessdstatistics, com.apple.ASPCarryLog, com.apple.AppleMultitouchMouse, com.apple.AppleMultitouchTrackpad, com.apple.BTServer, com.apple.CloudKit, com.apple.CoreBluetooth.cloud, com.apple.CoreBrightness, com.apple.CoreGraphics, com.apple.CrashReporter, com.apple.CrashReporterSupportHelper, com.apple.GEO, com.apple.MobileAsset, com.apple.MobileSoftwareUpdate, com.apple.UserAccountUpdater, com.apple.WirelessRadioManager.debug, com.apple.airplay, com.apple.airport.airportd, com.apple.awdd.persistent, com.apple.bg.system.task, com.apple.cloudd, com.apple.cmio.registerassistantservice, com.apple.contextstored, com.apple.coreaudio.careporting, com.apple.coreaudio.careporting.audioreg, com.apple.corecaptured, com.apple.coreduetd, com.apple.das.fairscheduling, com.apple.dasd.datacollectiontasks, com.apple.driver.AppleBluetoothMultitouch.mouse, com.apple.driver.AppleBluetoothMultitouch.trackpad, com.apple.driver.AppleHIDMouse, com.apple.dt.Xcode, com.apple.dt.xcodebuild, com.apple.duetactivityscheduler, com.apple.duetactivityscheduler.policydatacollection, com.apple.duetactivityscheduler.trial, com.apple.findmy.findmybeaconingd, com.apple.gamepolicyd, com.apple.icloud.findmydeviced, com.apple.icloud.findmydeviced.notbackedup, com.apple.icloud.searchpartyd, com.apple.idleassetsd, com.apple.installandsetup.systemmigrationd, com.apple.mediaremote, com.apple.mediaremoted, com.apple.osanalytics.internal, com.apple.osanalyticshelper, com.apple.powerd.bdc, com.apple.powerd.coresmartpowernap.state, com.apple.powerui.notification, com.apple.security.ctkd-db, com.apple.siri.sirisuggestions, com.apple.smartcharging.topoffprotection, com.apple.symptomsd-diag, com.apple.systempreferences, com.apple.systemstats.microstackshot, com.apple.tailspin, com.apple.universalaccess, com.apple.wifi.WiFiAgent, com.apple.xpc.activity2, memoryanalyticsd, sharedfilelistd, systemmigrationd

fwiw I was able to get some byte rate improvement on my Sony WF-1000XM4 following these instructions by switching the Bluetooth Connection Quality setting on my Android Headphone app from from "Prioritize Stable Connection" to "Prioritize Sound Quality". Fingers crossed that it's good enough to improve the microphone quality in video meetings. I'm getting complaints and these are supposed to be "high-end" headsets.

# BEFORE
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
# AFTER
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

@stepchud
Copy link

stepchud commented Sep 4, 2024

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

well the link doesn't work because there are too many pages 😭 😂
this seems to be the only option currently available on Sonoma 14.5, is to use the Sony Headphones Connect app on your phone to control that quality setting.

@victorphamdeveloper
Copy link

victorphamdeveloper commented Oct 26, 2024

sigh, this no longer works. using the sennheiser momentum 4, which does not support AAC but only aptX. I probably need to buy a sony headphone to try

@FishZe
Copy link

FishZe commented Nov 3, 2024

I'm on Sonoma 14.4, sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true not works.

17:29:33.220607+0800	bluetoothd	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

@garcon26
Copy link

garcon26 commented Dec 8, 2024

sigh, this no longer works. using the sennheiser momentum 4, which does not support AAC but only aptX. I probably need to buy a sony headphone to try叹息,这不再起作用了。使用森海塞尔Momentum 4,不支持AAC,仅支持aptX。我可能需要买一个索尼耳机来尝试

I recently purchased the Sennheiser Momentum 4 headphones. it work with the 44.1 AAC LC codec on my MacBook Air M3. My system’s version is 15.1.1.

@garcon26
Copy link

garcon26 commented Dec 8, 2024

sigh, this no longer works. using the sennheiser momentum 4, which does not support AAC but only aptX. I probably need to buy a sony headphone to try叹息,这不再起作用了。使用森海塞尔Momentum 4,不支持AAC,仅支持aptX。我可能需要买一个索尼耳机来尝试

Perhaps you could try connecting your Mac using a cable and configure the MIDI setup to support a maximum sampling rate of 96 kHz.

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