forked from lagerimsi-ds/debian-buster_bluetooth_aptX-LDAC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbluetooth-aptx-ldac.sh
More file actions
82 lines (54 loc) · 2.23 KB
/
bluetooth-aptx-ldac.sh
File metadata and controls
82 lines (54 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# this script compiles the libraries and bluetooth modules to be able to use aptX and LDAC codecs via bluetooth
# on debian buster (10)
####
#
# Based on the great projects of EHfive (https://github.com/EHfive):
# https://github.com/EHfive/pulseaudio-modules-bt
# https://github.com/EHfive/ldacBT
#
####
# install preqisites on normal debian buster (10) install
sudo apt install bluez-hcidump pkg-config cmake fdkaac libtool libpulse-dev libdbus-1-dev libsbc-dev libbluetooth-dev git
temp_compile_dir=$(mktemp -d)
cd "$temp_compile_dir"
# compile libldac
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 ../
cd ..
sudo make DESTDIR=$DEST_DIR install
# backup original libraries
MODDIR=`pkg-config --variable=modlibexecdir libpulse`
sudo find $MODDIR -regex ".*\(bluez5\|bluetooth\).*\.so" -exec cp {} {}.bak \;
# compile pulseaudio-modules-bt
cd "$temp_compile_dir"
git clone https://github.com/EHfive/pulseaudio-modules-bt.git
cd pulseaudio-modules-bt
git submodule update --init
git -C pa/ checkout v`pkg-config libpulse --modversion|sed 's/[^0-9.]*\([0-9.]*\).*/\1/'`
mkdir build
cd build
cmake ..
make
sudo make install
# configure pulseaudio to use LDAC in high quality
read -p "Do you want to force using LDAC-codec in high quality? y/n [n] " answer
if [ "$answer" = "y" ]
then
sudo sed -i.bak 's/^load-module module-bluetooth-discover$/load-module module-bluetooth-discover a2dp_config="ldac_eqmid=hq ldac_fmt=f32"/g' /etc/pulse/default.pa
fi
# restart pulseaudio and bluetooth service
pulseaudio -k
sudo systemctl restart bluetooth.service
# User messages and infos
echo ''
echo '#################################'
echo '#################################'
echo -E "To test which codec is used for your device, disconnect your device, start this command: sudo hcidump | grep -A 10 -B 10 'Set config', then reconnect your device."
echo -E "Check the line with 'Media Codec - non-A2DP (xyz)' below 'Set config'"
echo -E "To configure the codec manually check the options for /etc/pulse/default.pa here: https://github.com/EHfive/pulseaudio-modules-bt#configure"
sudo rm -R "$temp_compile_dir"