Last active
March 16, 2024 04:42
-
-
Save sydragos/cd52a0bbba3e0dfc840167be7fadc5bb to your computer and use it in GitHub Desktop.
Adding Additional Bluetooth Codec Support to Moode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Inspired by https://steveblock.com/moode-bluetooth-codecs/ | |
# and his post at https://moodeaudio.org/forum/showthread.php?tid=3683 | |
# with an extra sprinkle of https://github.com/anonymix007/libldacdec | |
# and built with latest dependencies on moOde 8.3.2 on rpi zero W | |
# | |
# Currently having issues with LDAC itself | |
LDAC_INCLUDE_DIR=/usr/include/ldac | |
LDAC_LIB_DIR=/usr/lib | |
export LDAC_ABR_CFLAGS="-I$LDAC_INCLUDE_DIR" | |
export LDAC_ABR_LIBS="-L$LDAC_LIB_DIR -lldacBT_abr" | |
export LDAC_DEC_CFLAGS="-I$LDAC_INCLUDE_DIR" | |
export LDAC_DEC_LIBS="-L$LDAC_LIB_DIR -lldacdec" | |
export LDAC_ENC_CFLAGS="-I$LDAC_INCLUDE_DIR" | |
export LDAC_ENC_LIBS="-L$LDAC_LIB_DIR -lldacBT_enc" | |
# Install dependencies | |
sudo apt update && sudo apt install -y git libsndfile1 libsndfile1-dev \ | |
cmake libavcodec-dev libsamplerate0 libsamplerate0-dev \ | |
libasound2-dev libbluetooth-dev libsbc-dev libopenaptx-dev | |
# Build FDK-AAC | |
cd ~ ; git clone https://github.com/mstorsjo/fdk-aac.git && \ | |
cd fdk-aac && autoreconf --install --force && \ | |
mkdir build && cd build/ && \ | |
../configure --prefix="/usr" --disable-shared && \ | |
make && sudo make install | |
# Build openaptx | |
cd ~ ; git clone https://github.com/Arkq/openaptx.git && \ | |
cd openaptx && mkdir build && cd build/ && \ | |
cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_DOC=OFF -DWITH_FFMPEG=ON -DWITH_SNDFILE=ON .. && \ | |
make && sudo make install | |
# Build LDAC | |
cd ~ ; git clone https://github.com/EHfive/ldacBT.git && \ | |
cd ldacBT && git submodule update --init && \ | |
mkdir build && cd build/ && \ | |
cmake -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_LIBDIR=/usr/lib -DLDAC_SOFT_FLOAT=OFF .. && \ | |
make && sudo make install | |
# Build ldacdec | |
cd ~ ; git clone https://github.com/anonymix007/libldacdec.git && \ | |
cd libldacdec && make libldacdec.so && sudo make install | |
# Build BlueZ-ALSA | |
cd ~ ; git clone https://github.com/Arkq/bluez-alsa.git && \ | |
cd bluez-alsa && autoreconf --install --force && \ | |
mkdir build && cd build/ && \ | |
../configure --enable-ofono --enable-aac --enable-aptx --enable-aptx-hd \ | |
--enable-debug --enable-cli --with-libopenaptx --enable-ldac && \ | |
make && sudo make install | |
echo "Reboot and test using: 'sudo reboot' and 'bluealsa -h'" | |
echo "Will also need to add ' -c aptX -c aptX-HD -c LDAC' to ExecStart inside /etc/systemd/system/bluealsa.service" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment