Unable to set aptX codec on High Sierra I got new headphones, namely Sony wh-1000xm4.
Audio quality is terrible versus if played from a samsung phone.
I have downloaded x-code developer tools including Bluetooth explorer.
Through Audio Options I can select Force use of aptX, but that doesn't do much after viewing in graphing utility.
If I open microphone settings in audio I can drop the codec to SBO, but there is no way to have aptX.
I have set higher quality audio as in this answer in the sony app but it hasn't changed anything.
Is this a persistent issue for all bluetooth devices with mac?
Alternatively, is there another codec setting that can be enabled so the audio sounds normal?
Turns out most of the issue is due to mac books having a weak bluetooth chip.  In order to free some bandwidth I have used wireless receivers for mouse and keyboard rather than connecting to laptop directly. Now the only device connected to my laptop via Bluetooth are the headphones.
For users of Logitech, the Unifying receiver operates on the frequency similar to that of the USB 3.0 so mouse movements where delayed, sometimes quite a lot. Not having a dedicated port for USB 2.0 only I used a MALE/FEMALE USB extender which is plugged to the USB hub so that the Unifying receiver does not sit close to the USB 3.0 cables.
This has pretty much fixed the Bluetooth issue. Though sometimes when reconnecting headphones appear on the list of devices but not on the list of audio outputs.
To fix that:

kill bluetoothd process from the activity monitor or run sudo launchctl stop com.apple.bluetoothd
followed by sudo launchctl start com.apple.bluetoothd (though this is done automatically after some time)

Few times I'm pretty sure I have had some sort of interference between phone and mac fighting for access, turning off Bluetooth on my phone stopped mac connection from cutting out so I tend to keep it off too.