I have recently set up a Raspberry Pi 4 with the Picroft stable 2020-09-07 enclosure. I have successfully completed some initial tests with a ReSpeaker 4-Mic array as the audio input and a portable bluetooh speaker using the aux-in.
I have now set up the speaker as a bluetooth speaker using the tutorial from https://peppe8o.com/fixed-connect-bluetooth-headphones-with-your-raspberry-pi/ and I can successfully play audio through bluetooth with
$ aplay -D bluealsa /usr/share/sounds/alsa/Front_Center.wav
I was quite pleased with this, as I’m aware that bluetooth can be just a tad bit finicky.
The challenge I’m having is how to set it up as the default audio output device, so that all output, including Mycroft’s, is sent there.
To be clear, I don’t think this is Picroft specific and I could have posted on other forums, but as I’m using the Picroft enclosure, I thought this was a reasonable place to start. For instance, I also have this problem with the only other piece of software I have installed - Spotifyd. I regularly work with Linux, but audio and bluetooth are two areas that I haven’t delved in.
My search results have been suggesting different contents for my /home/pi/.asoundrc but I haven’t been successful so far.
I’ve checked https://mycroft-ai.gitbook.io/docs/using-mycroft-ai/troubleshooting/audio-troubleshooting but the results are confusing:
“pactl info” returns “analog-stereo” as my sink:
(.venv) pi@picroft:~ $ pactl info
Server String: /run/user/1000/pulse/native
Library Protocol Version: 32
Server Protocol Version: 32
Is Local: yes
Client Index: 32
Tile Size: 65496
User Name: pi
Host Name: picroft
Server Name: pulseaudio
Server Version: 12.2
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.platform-bcm2835_audio.analog-stereo
Default Source: alsa_input.platform-soc_sound.multichannel-input
“pactl list sinks short” only returns that option:
(.venv) pi@picroft:~ $ pactl list sinks short
0 alsa_output.platform-bcm2835_audio.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
However, if I run “alsamixer”, I select “F6: Select sound card”, it only lists “(default)”, “bcm2835 Headphones” and “seed-4mic-voicecard”. However, I can also select “enter device name” and type “bluealsa”. I can see the 4 levels of my bluetooth speaker “A2DP”, “SCO”, capture “SCO” and “Battery”:
Below are the steps I have completed as part of my bluetooth audio setup.
Does anybody have any suggestions to redirect the default audio output to the bluealsa device? Thank you.
usermod -G bluetooth -a pi # Pulseaudio is already installed apt-get install bluealsa nano /lib/systemd/system/bluetooth.service # Replace # ExecStart=/usr/lib/bluetooth/bluetoothd # With # ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap nano /lib/systemd/system/bthelper@.service # Replace #Type=simple #ExecStart=/usr/bin/bthelper %I # With #Type=simple #ExecStartPre=/bin/sleep 2 #ExecStart=/usr/bin/bthelper %I bluetoothctl # Within the new prompt #power on #agent on #default-agent #scan on #pair F4:4E:FD:88:7A:47 #trust F4:4E:FD:88:7A:47 #connect F4:4E:FD:88:7A:47 # To reconnect manually #bluetoothctl connect F4:4E:FD:88:7A:47 nano /etc/rc.local # Replace #fi # #exit 0 # With #fi # ##Reconnect to bluetooth speaker #bluetoothctl connect F4:4E:FD:88:7A:47 # #exit 0 # I can then play if I can output to Alsa device bluealsa #aplay -D bluealsa:DEV=F4:4E:FD:88:7A:47,PROFILE=a2dp /usr/share/sounds/alsa/Front_Center.wav nano /home/pi/.asoundrc #Add #defaults.bluealsa.interface "hci0" #defaults.bluealsa.device "F4:4E:FD:88:7A:47" #defaults.bluealsa.profile "a2dp" #defaults.bluealsa.delay 10000 # I can then play without specifying bluealsa parameters #aplay -D bluealsa /usr/share/sounds/alsa/Front_Center.wav