4 Replies Latest reply on Sep 8, 2019 2:59 PM by clem57

    Route all Pi audio to bluetooth speaker

    colporteur

      Can someone share their experience on how to route all audio available from the Raspbian GUI to a bluetooth speaker?

       

      After establishing a bluetooth connection to a speaker, I can use the audio menu to select the bluetooth device and play audio through the speaker from the default media application (i.e VLC media player). I discovered audio from the browser (i.e. youtube video) still plays out the HDMI port.

       

      My internet search criteria doesn't generate the necessary results. I'm looking for returns that reflect the Buster version of Raspbian with all audio routed to a bluetooth speak. The configs would make the bluetooth speaker the default audio output for a Raspbian full install.

       

      If anyone has an links or commentary that has given them success I would appreciate the input.

       

      Sean

        • Re: Route all Pi audio to bluetooth speaker
          clem57

          I do not have the answer, but I can point you in a direction that will help. In this link, you will find how to realign the default sound. It may be adapted to your situation.

          Clem

            • Re: Route all Pi audio to bluetooth speaker
              clem57

              I think your answer is to send the sound to pulse instead of ALSA. Then the destination is much simpler. Look at https://opensource.com/article/17/1/linux-plays-sound . For a Windows perceptive this article maybe better https://www.learndigitalaudio.com/how-linux-audio-works-vs-windows-audio-2017

              Hope this helps you.

              Clem

              • Re: Route all Pi audio to bluetooth speaker
                colporteur

                The link provided insight into turning of the onboard audio card. The information in the link was stale dated but the configuration changes looked familiar.

                 

                The following change:

                 

                disable audio support /boot/config.txt 
                # Enable audio (loads snd_bcm2835)
                #dtparam=audio=on <--- inserted the octothorpe and perform a reboot.

                 

                Before making this change you will notice a /proc/asound directory. After the change and reboot the directory is not created (i.e. no sound card).

                 

                I then configured the bluetooth device (i.e. speaker) using bluetoothctl

                 

                I was then going to make the following entry

                /home/pi/.asoundrc <---yes there is a period in front of the filename.

                 

                pcm.!default {

                type plug

                slave.pcm {

                type bluealsa

                device "C2:E4:94:97:66:A8"

                profile "a2dp"

                }

                }

                ctl.!default {

                type bluealsa

                }

                 

                but discovered on a reboot after configuring bluetooth the contents were automatically created. The contents for this file I discovered in a post https://www.raspberrypi.org/forums/viewtopic.php?t=231281   on the raspberrypi forum.

                 

                I did notice if this file had a syntax errors (i.e. device "bluealsa:HCI=hci0,DEV=C2:E4:94:97:66:A8") applications errored out and the file contained some hardware entries. Not sure how this developed.

                 

                With this configuration in place I have all audio from the browser (i.e. youtube video) doesn't go out the HDMI but the rather the bluetooth speaker. Exactly what I was looking for. I suspect not having audio hardware on bootup removed any confusion to what the ALSA was required to do. Since no other audio support exists other than bluetooth it configured without a hitch.

                 

                I appreciate the links to resources. It definitely provided the impetus to uncover the solution. A fresh pair of eyes made the difference.

                 

                Sean