-
Notifications
You must be signed in to change notification settings - Fork 0
/
audio.txt
128 lines (109 loc) · 3.73 KB
/
audio.txt
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
https://www.raspberrypi.org/forums/viewtopic.php?t=138145
https://www.digikey.com/en/maker/blogs/raspberry-pi-3-how-to-configure-wi-fi-and-bluetooth/03fcd2a252914350938d8c5471cf3b63
https://gist.github.com/oleq/24e09112b07464acbda1
http://karuppuswamy.com/wordpress/2015/08/15/configuring-alsa-audio-output-on-analog-and-hdmi-of-raspberry-pi/
https://github.com/Arkq/bluez-alsa
http://denvycom.com/blog/playing-audio-over-bluetooth-on-rasbperry-pi-command-line/
https://forum.armbian.com/topic/6480-bluealsa-bluetooth-audio-using-alsa-not-pulseaudio/
https://www.raspberrypi.org/forums/viewtopic.php?t=194990
https://github.com/nicokaiser/rpi-audio-receiver
https://www.sigmdel.ca/michel/ha/rpi/bluetooth_n_buster_01_en.html
----------------------------------------
#Bluetooth
sudo apt-get -y install bluealsa
#sudo systemctl restart hciuart
#sudo systemctl restart bluetooth
sudo reboot
sudo bluetoothctl
[bluetooth]# scan on
[bluetooth]# devices
[bluetooth]# [NEW] Device 0C:A6:94:99:FA:4A HK Esquire 2
[bluetooth]# scan off
[bluetooth]# pair 0C:A6:94:99:FA:4A
[bluetooth]# trust 0C:A6:94:99:FA:4A
[bluetooth]# connect 0C:A6:94:99:FA:4A
[bluetooth]# info 0C:A6:94:99:FA:4A
[bluetooth]# exit
MAC="0C:A6:94:99:FA:4A"
[ -d /etc/local ] || sudo mkdir /etc/local && sudo chown pi.pi /etc/local
cat << EOF | tee /etc/local/bc.sh
#!/bin/bash
echo -e "connect ${MAC}\nquit" | sudo bluetoothctl
EOF
cat << EOF | tee /etc/local/bd.sh
#!/bin/bash
echo -e "disconnect ${MAC}\nquit" | sudo bluetoothctl
EOF
sudo chmod ugo+x /etc/local/b[cd].sh
echo -e "info 0C:A6:94:99:FA:4A\nquit" | sudo bluetoothctl
------------------------------------
#Configure Audio
cat << EOF | sudo tee /etc/asound.conf
pcm.!default {
type hw
card 0
}
ctl.!default {
type hw
card 0
}
pcm.analog {
type hw
card 0
}
ctl.analog {
type hw
card 0
}
pcm.esquire2 {
type plug
slave.pcm {
type bluealsa
device "0C:A6:94:99:FA:4A"
profile "a2dp"
}
}
ctl.esquire2 {
type bluealsa
}
EOF
sudo reboot
-----------------------------------------------------
/etc/local/bc.sh
sleep 60
Speaker Test to test Left speaker (you should hear smooth noise):
$ speaker-test -t sine -f 440 -c 2 -s 1
Now it is turn of Right speaker
$ speaker-test -t sine -f 440 -c 2 -s 2
$ Verifying .wav file playback
aplay /usr/share/sounds/alsa/Side_Left.wav ; aplay /usr/share/sounds/alsa/Side_Right.wav
aplay -D esquire2 /usr/share/sounds/alsa/Side_Left.wav ; aplay -D esquire2 /usr/share/sounds/alsa/Side_Right.wav
aplay -D bluealsa:HCI=hci0,DEV=0C:A6:94:99:FA:4A,PROFILE=a2dp /usr/share/sounds/alsa/Side_Left.wav ; aplay -D bluealsa:HCI=hci0,DEV=0C:A6:94:99:FA:4A,PROFILE=a2dp /usr/share/sounds/alsa/Side_Right.wav
hcitool dev
amixer -D esquire2 scontrols
amixer -D bluealsa scontrols
alsamixer -D bluealsa:HCI=hci0
amixer -D bluealsa sset "HK Esquire 2 - A2DP" 70%
amixer -D bluealsa sset "HK Esquire 2 - A2DP" 90
amixer -D bluealsa sset "HK Esquire 2 - A2DP" 20%+
amixer -D bluealsa sset "HK Esquire 2 - A2DP" 20%-
amixer scontrols
alsamixer -D hw:0
amixer -D hw sset "PCM" 73%
amixer -c 0 set PCM 2dB+
amixer -D hw -- sset PCM playback -20dB
#if you are wanting to get analog audio working use a "1" if you are using HDMI use a "2". The rule is "0" = auto
# Analog
amixer cset numid=3 1
# HDMI
amixer cset numid=3 2
GUI tool
sudo apt-get install blueman
---------------------------------------
#rebuild bluealsa
sudo apt install --no-install-recommends dh-autoreconf
sudo apt install --no-install-recommends libasound2-dev
sudo apt install --no-install-recommends libbluetooth-dev
sudo apt install --no-install-recommends libdbus-1-dev
sudo apt install --no-install-recommends libglib2.0-dev
sudo apt install --no-install-recommends libsbc-dev