The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Instruction Guide Moode 9: Add AAC bluetooth codec support
#1
Moode 9 already has built-in support for a wide range of common bluetooth codecs (SBC, aptX, aptX-HD both as source and sink; LDAC just as source) via bluez-alsa. Moode version 9.0.4 includes bluez-alsa in version 4.2.0.

AAC support (e.g. widely used by Apple devices) is missing, however, since the necessary codec library libfdk-aac2 is marked as "non-free" in Debian Bookworm so that it is not allowed to distribute binaries linking against it.

The following guide shows how to manually add the missing AAC codec support (both as source and sink) by building a modified version of Moode's bluez-alsa package. The resulting .deb files are finally installed via apt like any other normal package. They can easily be copied to other (fresh or existing) installations of Moode to directly install them there without the need to rebuild every time. Note also that there should not be any 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 is performed directly in Moode using ssh access, e.g. on a fresh installation:

1) After logging into Moode via ssh, we start with installing the necessary build dependencies:

Code:
# update package repository
sudo apt update

# install necessary build dependencies
sudo apt install dh-exec python3-docutils libasound2-dev libbluetooth-dev libfreeaptx-dev libsbc-dev liblc3-dev libldacbt-enc-dev libldacbt-abr-dev libmp3lame-dev libmpg123-dev libspandsp-dev libsystemd-dev libfdk-aac2 libfdk-aac-dev


2) Then we download the bluez-alsa source package 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.2.0/debian


3) Two files need to be modified here - rules and changelog (e.g. using nano <filename>):

- File rules:

Add a flag for the AAC codec at the end of the CONFIGURE_FLAGS section so that it reads:

Code:
CONFIGURE_FLAGS := \
        --with-libfreeaptx \
        --enable-aptx \
        --enable-aptx-hd \
        --enable-faststream \
        --enable-lc3-swb \
        --enable-ldac \
        --enable-mp3lame \
        --enable-mpg123 \
        --enable-msbc \
        --enable-ofono \
        --enable-systemd \
        --enable-manpages \
        --enable-debug \
        --enable-cli \
        --enable-aac


- File changelog:

Edit the version string in the first line of the file to distinguish it from the version provided by Moode, e.g. by adding "+aac" to the end of the version string, resulting in:

Code:
bluez-alsa (4.2.0-2moode1+aac) UNRELEASED; urgency=medium


4) Build the modified package:

Code:
# change back to the directory bluez-alsa-4.2.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.2.0/ should now contain a set of modified .deb packages. The following two files are the important ones, as only these two are necessary for the final installation step (which could as well be performed on a separate Moode installation - just copy these two to the new destination):

Code:
bluez-alsa-utils_4.2.0-2moode1+aac_arm64.deb
libasound2-plugin-bluez_4.2.0-2moode1+aac_arm64.deb


5) Install the modified .deb packages via apt and finally reboot:

Code:
# install modified packages from local source
sudo apt install ./bluez-alsa-utils_4.2.0-2moode1+aac_arm64.deb ./libasound2-plugin-bluez_4.2.0-2moode1+aac_arm64.deb

# reboot
sudo reboot


The AAC codec should now be used automatically when a supported bluetooth device is connected.


Final notes:

- You can easily check which codecs are supported by bluez-alsa using the command

Code:
bluealsa-cli status


- After connecting a bluetooth device you can also check which codec is actually in use using the command

Code:
bluealsa-cli -v list-pcms


- As the modification was installed as a package, it can easily be uninstalled by reinstalling Moode's original version (currently version 4.2.0-2moode1).

Code:
sudo apt install bluez-alsa-utils=4.2.0-2moode1 libasound2-plugin-bluez=4.2.0-2moode1


Best regards
Jens
Reply


Messages In This Thread
Moode 9: Add AAC bluetooth codec support - by jenzd - 07-17-2024, 12:26 PM

Forum Jump: