Posts: 73
Threads: 14
Joined: Mar 2021
Reputation:
11
05-16-2023, 09:16 PM
(This post was last modified: 06-19-2023, 11:21 PM by jenzd.)
Edit: Updated on 06/20/2023 to reflect version 8.3.3 of Moode which already has built-in support for aptX and aptX-HD.
Starting with version 8.3.3, Moode already has built-in support for the bluetooth codecs SBC, aptX, aptX-HD (each for receive & playback) and LDAC (playback only) which is provided by the bluez-alsa package. Moode version 8.3.3 includes bluez-alsa in version 4.1.0.
The following guide shows how to additionally include support for the bluetooth codec AAC (receive & playback) by building a modified version of the included bluez-alsa package. Note that this guide is based on section 5 "Build packages" of Moode's "Master development guide". The modification is finally installed as a normal package, so there should be no side effects on future in-place updates of Moode other than that the modified package might be upgraded to a newer (unmodified) bluez-alsa version.
The build process can be performed directly in Moode using ssh access, e.g. on a fresh installation.
1) After logging into Moode via ssh, we start with installing some additional building tools and dependencies:
Code: # update the package repository
sudo apt update
# install build tools for deb packages
sudo apt install build-essential fakeroot devscripts
# install missing build dependencies for the bluez-alsa package
sudo apt install dh-exec libasound2-dev libbluetooth-dev libsbc-dev pandoc python3-docutils
# install codec libraries and development files for LDAC, AAC and aptx
sudo apt install libldacbt-abr2 libldacbt-abr-dev libldacbt-enc2 libldacbt-enc-dev libfdk-aac2 libfdk-aac-dev libopenaptx0 libopenaptx-dev
2) Then we download Moode's source package for bluez-alsa to the current directory and change into its configuration directory:
Code: # download bluez-alsa source package
apt source bluez-alsa
# change to its configuration directory
cd bluez-alsa-4.1.0/debian
3) Two files need to be modified here (e.g. using "nano <filename>"):
- File "rules":
Add a flag for the additional AAC codec at the end of the CONFIGURE_FLAGS section, so that it reads
Code: CONFIGURE_FLAGS := \
--enable-ldac \
--enable-libopenaptx \
--enable-ofono \
--enable-systemd \
--enable-manpages \
--enable-debug \
--enable-cli \
--enable-aptx \
--enable-aptx-hd \
--with-libopenaptx \
--enable-aac
instead of the default parameters
Code: CONFIGURE_FLAGS := \
--enable-ldac \
--enable-libopenaptx \
--enable-ofono \
--enable-systemd \
--enable-manpages \
--enable-debug \
--enable-cli \
--enable-aptx \
--enable-aptx-hd \
--with-libopenaptx
- File "changelog":
Edit the version of the package in the first line of the file to distinguish it from the original version provided by moode, e.g. by adding "+aac" at the end of the version string, resulting in "4.1.0-2moode2+aac" instead of the default "4.1.0-2moode2".
3) Build the modified package:
Code: # change back to the directory bluez-alsa-4.1.0/
cd ..
# build the modified package
dpkg-buildpackage -us -uc
# change back to the parent directory
cd ..
If the build process was successful, the parent directory of "bluez-alsa-4.1.0" should contain a set of modified deb packages.
4) Install the modified deb packages to replace the preinstalled versions of "bluez-alsa-utils" and "libasound2-plugin-bluez" and finally reboot:
Code: # install modified packages from local source
sudo apt install ./bluez-alsa-utils_4.1.0-2moode2+aac_arm64.deb ./libasound2-plugin-bluez_4.1.0-2moode2+aac_arm64.deb
# reboot
sudo reboot
The additional codec should now be used automatically when a supported bluetooth device is connected.
You can easily check which codec is in use with the command:
Code: # check codec of connected bluetooth device
bluealsa-cli --verbose list-pcms
Final note: In case you want to remove the modification again, just reinstall the unmodified versions provided by Moode from the package repository (currently version 4.1.0-2moode2).
Code: sudo apt install bluez-alsa-utils=4.1.0-2moode2 libasound2-plugin-bluez=4.1.0-2moode2
Posts: 13,394
Threads: 304
Joined: Mar 2018
Reputation:
542
Nice :-)
The challenge is to find a way to make the capabilities easily available to everyone.
Posts: 159
Threads: 19
Joined: Mar 2020
Reputation:
3
05-18-2023, 01:06 PM
(This post was last modified: 05-18-2023, 01:07 PM by romain.)
(05-16-2023, 09:16 PM)jenzd Wrote: By default Moode 8 already has built-in support for the bluetooth codecs SBC (receive & playback) and LDAC (playback only) which is provided by the bluez-alsa package. At the time of writing Moode version 8.3.2 includes bluez-alsa in version 4.0.0.
The following guide shows how to additionally include support for the bluetooth codecs AAC, aptX and aptX-HD (each for receive & playback) by building a modified version of the included bluez-alsa package. Note that this guide is based on section 5 "Build packages" of Moode's "Master development guide". It follows a slightly different route than the previous guide by scblock which showed how to build & install everything directly from the source code without building a package (see https://moodeaudio.org/forum/showthread.php?tid=3683). In the current approach, the modification is finally installed as a normal package instead. There should be no side effects on future in-place updates of Moode other than that the modified package might be upgraded to a newer (unmodified) bluez-alsa version.
The build process can be performed directly in Moode using ssh access, e.g. on a fresh installation.
1) After logging into Moode via ssh, we start with installing some additional building tools and dependencies:
Code: # update the package repository
sudo apt update
# install build tools for deb packages
sudo apt install build-essential fakeroot devscripts
# install missing build dependencies for the bluez-alsa package
sudo apt install dh-exec libasound2-dev libbluetooth-dev libsbc-dev pandoc python3-docutils
# install codec libraries and development files for LDAC, AAC and aptx
sudo apt install libldacbt-abr2 libldacbt-abr-dev libldacbt-enc2 libldacbt-enc-dev libfdk-aac2 libfdk-aac-dev libopenaptx0 libopenaptx-dev
2) Then we download Moode's source package for bluez-alsa to the current directory and change into its configuration directory:
Code: # download bluez-alsa source package
apt source bluez-alsa
# change to its configuration directory
cd bluez-alsa-4.0.0/debian
3) Two files need to be modified here (e.g. using "nano <filename>"):
- File "rules":
Add flags for the additional codecs in the CONFIGURE_FLAGS section, so that it reads
Code: CONFIGURE_FLAGS := \
--enable-ldac \
--enable-ofono \
--enable-manpages \
--enable-debug \
--enable-cli \
--enable-aac \
--enable-aptx \
--enable-aptx-hd \
--with-libopenaptx
instead of the default parameters
Code: CONFIGURE_FLAGS := \
--enable-ldac \
--enable-ofono \
--enable-manpages \
--enable-debug \
--enable-cli
- File "changelog":
Edit the version of the package in the first line of the file to distinguish it from the original version provided by moode, e.g. by adding "+codecs" at the end of the version string, resulting in "4.0.0-2moode1+codecs" instead of the default "4.0.0-2moode1".
3) Build the modified package:
Code: # change back to the directory bluez-alsa-4.0.0/
cd ..
# build the modified package
dpkg-buildpackage -us -uc
# change back to the parent directory
cd ..
If the build process was successful, the parent directory of "bluez-alsa-4.0.0" should contain a set of modified deb packages.
4) Install the modified deb packages to replace the preinstalled versions of "bluez-alsa-utils" and "libasound2-plugin-bluez" (and reboot finally)
Code: # install modified packages from local source
sudo apt install ./bluez-alsa-utils_4.0.0-2moode1+codecs_arm64.deb ./libasound2-plugin-bluez_4.0.0-2moode1+codecs_arm64.deb
# reboot
sudo reboot
The additional codecs should now be used automatically when a supported bluetooth device is connected.
Final note: In case you want to remove the modification again, just reinstall the unmodified versions provided by Moode from the package repository.
Hello,
I followed your clear guide however when I connect my aptX HD/LDAC capable POCO F5 Pro to moOde it defaults to AAC codec. I removed AAC from the rules source file, repackaged bluez-alsa-utils and reinstalled it and it defaults to SBC.
Note, that my phone successfully negotiates the LDAC codec with my SMSL SU-9 PRO DAC.
Did I miss something to get LDAC or AptX HD instead of ACC or SBC by default ?
Thanks in advance,
Romain
Posts: 1,274
Threads: 24
Joined: Jun 2022
Reputation:
42
(05-18-2023, 01:06 PM)romain Wrote: (05-16-2023, 09:16 PM)jenzd Wrote: By default Moode 8 already has built-in support for the bluetooth codecs SBC (receive & playback) and LDAC (playback only) which is provided by the bluez-alsa package. At the time of writing Moode version 8.3.2 includes bluez-alsa in version 4.0.0.
The following guide shows how to additionally include support for the bluetooth codecs AAC, aptX and aptX-HD (each for receive & playback) by building a modified version of the included bluez-alsa package. Note that this guide is based on section 5 "Build packages" of Moode's "Master development guide". It follows a slightly different route than the previous guide by scblock which showed how to build & install everything directly from the source code without building a package (see https://moodeaudio.org/forum/showthread.php?tid=3683). In the current approach, the modification is finally installed as a normal package instead. There should be no side effects on future in-place updates of Moode other than that the modified package might be upgraded to a newer (unmodified) bluez-alsa version.
The build process can be performed directly in Moode using ssh access, e.g. on a fresh installation.
1) After logging into Moode via ssh, we start with installing some additional building tools and dependencies:
Code: # update the package repository
sudo apt update
# install build tools for deb packages
sudo apt install build-essential fakeroot devscripts
# install missing build dependencies for the bluez-alsa package
sudo apt install dh-exec libasound2-dev libbluetooth-dev libsbc-dev pandoc python3-docutils
# install codec libraries and development files for LDAC, AAC and aptx
sudo apt install libldacbt-abr2 libldacbt-abr-dev libldacbt-enc2 libldacbt-enc-dev libfdk-aac2 libfdk-aac-dev libopenaptx0 libopenaptx-dev
2) Then we download Moode's source package for bluez-alsa to the current directory and change into its configuration directory:
Code: # download bluez-alsa source package
apt source bluez-alsa
# change to its configuration directory
cd bluez-alsa-4.0.0/debian
3) Two files need to be modified here (e.g. using "nano <filename>"):
- File "rules":
Add flags for the additional codecs in the CONFIGURE_FLAGS section, so that it reads
Code: CONFIGURE_FLAGS := \
--enable-ldac \
--enable-ofono \
--enable-manpages \
--enable-debug \
--enable-cli \
--enable-aac \
--enable-aptx \
--enable-aptx-hd \
--with-libopenaptx
instead of the default parameters
Code: CONFIGURE_FLAGS := \
--enable-ldac \
--enable-ofono \
--enable-manpages \
--enable-debug \
--enable-cli
- File "changelog":
Edit the version of the package in the first line of the file to distinguish it from the original version provided by moode, e.g. by adding "+codecs" at the end of the version string, resulting in "4.0.0-2moode1+codecs" instead of the default "4.0.0-2moode1".
3) Build the modified package:
Code: # change back to the directory bluez-alsa-4.0.0/
cd ..
# build the modified package
dpkg-buildpackage -us -uc
# change back to the parent directory
cd ..
If the build process was successful, the parent directory of "bluez-alsa-4.0.0" should contain a set of modified deb packages.
4) Install the modified deb packages to replace the preinstalled versions of "bluez-alsa-utils" and "libasound2-plugin-bluez" (and reboot finally)
Code: # install modified packages from local source
sudo apt install ./bluez-alsa-utils_4.0.0-2moode1+codecs_arm64.deb ./libasound2-plugin-bluez_4.0.0-2moode1+codecs_arm64.deb
# reboot
sudo reboot
The additional codecs should now be used automatically when a supported bluetooth device is connected.
Final note: In case you want to remove the modification again, just reinstall the unmodified versions provided by Moode from the package repository.
Hello,
I followed your clear guide however when I connect my aptX HD/LDAC capable POCO F5 Pro to moOde it defaults to AAC codec. I removed AAC from the rules source file, repackaged bluez-alsa-utils and reinstalled it and it defaults to SBC.
Note, that my phone successfully negotiates the LDAC codec with my SMSL SU-9 PRO DAC.
Did I miss something to get LDAC or AptX HD instead of ACC or SBC by default ?
Thanks in advance,
Romain
Maybe I am wrong but, doesn't it depend on the BT-hardware what protocols are indeed supported? Does the chip on the Pi actually support aptX and LDAC?
Posts: 6,010
Threads: 176
Joined: Apr 2018
Reputation:
234
(05-17-2023, 01:52 AM)Tim Curtis Wrote: Nice :-)
The challenge is to find a way to make the capabilities easily available to everyone.
There's also the question of the legal situation w.r.t. distribution of the result. See the Patents and copyright relating to Bluetooth codecs page on the bluez-alsa Wiki.
Regards,
Kent
Posts: 6,010
Threads: 176
Joined: Apr 2018
Reputation:
234
05-19-2023, 11:52 AM
(This post was last modified: 05-19-2023, 11:53 AM by TheOldPresbyope.
Edit Reason: fixed typo: AAC -> LDAC
)
(05-18-2023, 01:06 PM)romain Wrote: Hello,
I followed your clear guide however when I connect my aptX HD/LDAC capable POCO F5 Pro to moOde it defaults to AAC codec. I removed AAC from the rules source file, repackaged bluez-alsa-utils and reinstalled it and it defaults to SBC.
Note, that my phone successfully negotiates the LDAC codec with my SMSL SU-9 PRO DAC.
Did I miss something to get LDAC or AptX HD instead of ACC or SBC by default ?
Thanks in advance,
Romain
This issue is discussed in bluez-alsa issue #581. Apparently this build links to a library which supports aptX encoding but not decoding (issue #581 discusses LDAC, actually, but the situation is the same). I don't know if such a library exists for Linux in general and Raspberry Pi OS in particular.
Regards,
Kent
Posts: 13,394
Threads: 304
Joined: Mar 2018
Reputation:
542
05-19-2023, 11:57 AM
(This post was last modified: 05-19-2023, 11:57 AM by Tim Curtis.)
(05-18-2023, 01:32 PM)Nutul Wrote: (05-18-2023, 01:06 PM)romain Wrote: (05-16-2023, 09:16 PM)jenzd Wrote: By default Moode 8 already has built-in support for the bluetooth codecs SBC (receive & playback) and LDAC (playback only) which is provided by the bluez-alsa package. At the time of writing Moode version 8.3.2 includes bluez-alsa in version 4.0.0.
The following guide shows how to additionally include support for the bluetooth codecs AAC, aptX and aptX-HD (each for receive & playback) by building a modified version of the included bluez-alsa package. Note that this guide is based on section 5 "Build packages" of Moode's "Master development guide". It follows a slightly different route than the previous guide by scblock which showed how to build & install everything directly from the source code without building a package (see https://moodeaudio.org/forum/showthread.php?tid=3683). In the current approach, the modification is finally installed as a normal package instead. There should be no side effects on future in-place updates of Moode other than that the modified package might be upgraded to a newer (unmodified) bluez-alsa version.
The build process can be performed directly in Moode using ssh access, e.g. on a fresh installation.
1) After logging into Moode via ssh, we start with installing some additional building tools and dependencies:
Code: # update the package repository
sudo apt update
# install build tools for deb packages
sudo apt install build-essential fakeroot devscripts
# install missing build dependencies for the bluez-alsa package
sudo apt install dh-exec libasound2-dev libbluetooth-dev libsbc-dev pandoc python3-docutils
# install codec libraries and development files for LDAC, AAC and aptx
sudo apt install libldacbt-abr2 libldacbt-abr-dev libldacbt-enc2 libldacbt-enc-dev libfdk-aac2 libfdk-aac-dev libopenaptx0 libopenaptx-dev
2) Then we download Moode's source package for bluez-alsa to the current directory and change into its configuration directory:
Code: # download bluez-alsa source package
apt source bluez-alsa
# change to its configuration directory
cd bluez-alsa-4.0.0/debian
3) Two files need to be modified here (e.g. using "nano <filename>"):
- File "rules":
Add flags for the additional codecs in the CONFIGURE_FLAGS section, so that it reads
Code: CONFIGURE_FLAGS := \
--enable-ldac \
--enable-ofono \
--enable-manpages \
--enable-debug \
--enable-cli \
--enable-aac \
--enable-aptx \
--enable-aptx-hd \
--with-libopenaptx
instead of the default parameters
Code: CONFIGURE_FLAGS := \
--enable-ldac \
--enable-ofono \
--enable-manpages \
--enable-debug \
--enable-cli
- File "changelog":
Edit the version of the package in the first line of the file to distinguish it from the original version provided by moode, e.g. by adding "+codecs" at the end of the version string, resulting in "4.0.0-2moode1+codecs" instead of the default "4.0.0-2moode1".
3) Build the modified package:
Code: # change back to the directory bluez-alsa-4.0.0/
cd ..
# build the modified package
dpkg-buildpackage -us -uc
# change back to the parent directory
cd ..
If the build process was successful, the parent directory of "bluez-alsa-4.0.0" should contain a set of modified deb packages.
4) Install the modified deb packages to replace the preinstalled versions of "bluez-alsa-utils" and "libasound2-plugin-bluez" (and reboot finally)
Code: # install modified packages from local source
sudo apt install ./bluez-alsa-utils_4.0.0-2moode1+codecs_arm64.deb ./libasound2-plugin-bluez_4.0.0-2moode1+codecs_arm64.deb
# reboot
sudo reboot
The additional codecs should now be used automatically when a supported bluetooth device is connected.
Final note: In case you want to remove the modification again, just reinstall the unmodified versions provided by Moode from the package repository.
Hello,
I followed your clear guide however when I connect my aptX HD/LDAC capable POCO F5 Pro to moOde it defaults to AAC codec. I removed AAC from the rules source file, repackaged bluez-alsa-utils and reinstalled it and it defaults to SBC.
Note, that my phone successfully negotiates the LDAC codec with my SMSL SU-9 PRO DAC.
Did I miss something to get LDAC or AptX HD instead of ACC or SBC by default ?
Thanks in advance,
Romain
Maybe I am wrong but, doesn't it depend on the BT-hardware what protocols are indeed supported? Does the chip on the Pi actually support aptX and LDAC?
AFAIK the codecs are simply executable binaries and don't require a chip w/frmware.
As far as @ romain's issue goes it's not clear what might be going on. Maybe others will test and report their results :-) If I get some spare cycles this week I'll try testing with some Apple devices.
Posts: 13,394
Threads: 304
Joined: Mar 2018
Reputation:
542
(05-19-2023, 11:40 AM)TheOldPresbyope Wrote: (05-17-2023, 01:52 AM)Tim Curtis Wrote: Nice :-)
The challenge is to find a way to make the capabilities easily available to everyone.
There's also the question of the legal situation w.r.t. distribution of the result. See the Patents and copyright relating to Bluetooth codecs page on the bluez-alsa Wiki.
Regards,
Kent
Yes, of course bundling and redistribution is out of the question.
By "easy" I was referring to creating an install/remove script that avoids having to manually enter all the commands.
Posts: 13,394
Threads: 304
Joined: Mar 2018
Reputation:
542
05-19-2023, 12:28 PM
(This post was last modified: 05-19-2023, 12:33 PM by Tim Curtis.
Edit Reason: eta
)
(05-19-2023, 11:52 AM)TheOldPresbyope Wrote: (05-18-2023, 01:06 PM)romain Wrote: Hello,
I followed your clear guide however when I connect my aptX HD/LDAC capable POCO F5 Pro to moOde it defaults to AAC codec. I removed AAC from the rules source file, repackaged bluez-alsa-utils and reinstalled it and it defaults to SBC.
Note, that my phone successfully negotiates the LDAC codec with my SMSL SU-9 PRO DAC.
Did I miss something to get LDAC or AptX HD instead of ACC or SBC by default ?
Thanks in advance,
Romain
This issue is discussed in bluez-alsa issue #581. Apparently this build links to a library which supports aptX encoding but not decoding (issue #581 discusses LDAC, actually, but the situation is the same). I don't know if such a library exists for Linux in general and Raspberry Pi OS in particular.
Regards,
Kent
I forgot about that.
If there is no decoding for LDAC and AptX then what usage scenario if any applies?
ETA: OP states "The following guide shows how to additionally include support for the bluetooth codecs AAC, aptX and aptX-HD (each for receive & playback)"
Very confusing :-0
Posts: 6,010
Threads: 176
Joined: Apr 2018
Reputation:
234
(05-19-2023, 12:28 PM)Tim Curtis Wrote: (05-19-2023, 11:52 AM)TheOldPresbyope Wrote: (05-18-2023, 01:06 PM)romain Wrote: Hello,
I followed your clear guide however when I connect my aptX HD/LDAC capable POCO F5 Pro to moOde it defaults to AAC codec. I removed AAC from the rules source file, repackaged bluez-alsa-utils and reinstalled it and it defaults to SBC.
Note, that my phone successfully negotiates the LDAC codec with my SMSL SU-9 PRO DAC.
Did I miss something to get LDAC or AptX HD instead of ACC or SBC by default ?
Thanks in advance,
Romain
This issue is discussed in bluez-alsa issue #581. Apparently this build links to a library which supports aptX encoding but not decoding (issue #581 discusses LDAC, actually, but the situation is the same). I don't know if such a library exists for Linux in general and Raspberry Pi OS in particular.
Regards,
Kent
I forgot about that.
If there is no decoding for LDAC and AptX then what usage scenario if any applies?
ETA: OP states "The following guide shows how to additionally include support for the bluetooth codecs AAC, aptX and aptX-HD (each for receive & playback)"
Very confusing :-0
In my case, it's useful for driving my Sennheiser headphones which support SBC, AAC, and aptX.
OTOH, I quite like driving them via a Creative Tech USB-BT adapter with built-in aptX support. I can plug it into whatever SBC I'm fiddling with. It presents itself to the OS as an audio device and ALSA is happy.
Had I bought Sony headphones, I'd be pursuing LDAC instead of aptX.
It's nice to have choices.
Regards,
Kent
PS - I figure if I just wait a few more years my hearing will have degraded to the point that none of this will matter. It's be like debating how many angels can dance on the head of a pin.
|