BTcreative

Project goal

I had a raspberry pi zero from a failed back up server project and an old usb sound card. This card is a creative 24 live 5.1 surround sound blaster. I decided I would set up a bluetooth receiver to feed audio into my old 5.1 surround sound system. I also like to listen to music when I am gaming. I don’t do this very often but I would like to be able to control the music from my phone including its volume. Sending it via bluetooth into the audio in (the spdif in this case) on the PC seems like a flexible way of doing this. So I thought I would put the two together and get a little more use out of the sound card. So the receiver should:

  • Accept audio from my phone at the highest quality possible.
  • Push audio via the analog out to amp and my PC (via an audio splitter)

Hardware

Software

  • Ubuntu Server
  • Pipewire

Why Ubuntu Server and Pipewire

There are plenty of guides out there for bluetooth speakers, audio recievers which use Raspbian. The issue with most of these is that they don’t appear to use the HD audio. The ones that do either require you to create an account such as with Balena . I didnt particularly didn’t want to do that I wanted to see if I could set up a high quality audio myself. Further investigation I found plenty of guides for bluetooth speakers however I could not see they supported HD audio just pushing the audio through pulse. Although one of the guides was useful for managing the bluetooth pairing.

I eventually found a site that recommended pipewire and pipeplumber which supports HD audio out of the box. This is the method I settled on. However Wireplumber is not easily accessible from Raspbian. It requires a back port and I could not get it to work. So I tried the Ubuntu server and these libraries were available. (although It created additional steps later)

The sites I used can be found at the end this article.

Install

I installed Ubuntu server from using the Raspberry Pi Imager with SSH, wifi login etc. Then I updated and upgraded Ubuntu:

sudo apt update && sudo apt upgrade

From reference 1 in the resources section I installed the pipewire and wireplumber

sudo apt install pipewire wireplumber libspa-0.2-bluetooth

Now I did follow the rest of the guide to get pairing up and running but it didn’t seem to work. so I installed bluetooth

sudo apt install bluetooth

Then I ran bluetooth (type bluetoothctl) from the command line select pair from my bluetooth menu on my phone requested paring and then in the terminal accepted the paring when prompted. I then entered trusted into the terminal and then exited bluetooth by typing exit in the terminal. Trusted means no passcode required next time you pair the phone to the pi.

I tested the audio by plugging in a headphone and played some music on my phone. This worked however the volume was low. Some searches found the archwiki page for Pipewire which had the solution . I had to install the ASLA utilities to get the alsa mixer up so I could increase the volume and save it. This was done by:

sudo apt-get install alsa-utils

Then open the mixer by typing alsamixer. Then amend the volume and type

sudo alsactl store

This will store the volume after reboot. Or it should have done. The volume kept resetting so I had to do follow the guidance here.

Unattended updates

Now I won’t be logging in often in over SSH. If only to pair other devices. So I set unattended updates:

sudo apt install unattended-upgrades
sudo apt install apt-config-auto-update

Test the system will update:

sudo unattended-upgrades –dry-run –debug

If this works okay enable the service (As this is Systemd):

sudo systemctl start unattended-upgrades

This will allow updates without me specifically having to login and run them.

Autologin

I followed this guide to allow autologin otherwise the bluetooth will not connect up:

Autologin no GUI or headless – ubuntu command line

Revelations Digital outputs

I have been running this set up for the last 3 months. What has been the biggest surprise was the sound quality. Now for years I have always read if you can use a digital output you should it is always better. However this setup using the analog outputs to my Denon receiver has much better sound quality than when I have used the Denon’s optical input. I am not an expert in this area but I know what I like. So why is this the case. It could be that optical or spdif output is outdated but I think it is more than this. Again I am not an expert but I can only speculate. So I think what is happening is the DAC on the creative sound card is much better that the DAC in the Denon receiver. I tried the same with the PC connecting the PC’s Asus card to the Denons external 7.1 inputs the result was again improved quality. Dialog in TV was clearer, I hear notes on music I didn’t know were there.

So I guess the lesson is to not always take everything at face value.

Resources

  1. Using a raspberry pi as a bluetooth speaker with pipewire and wireplumber
  2. Autologin no GUI or headless – ubuntu command line
  3. Archwiki page for pipewire
  4. https://dev.to/luisabianca/fix-alsactl-store-that-does-not-save-alsamixer-settings-130i#:~:text=Open%20a%20terminal%20and%20run%20alsamixer%20to%20verify,store%20Make%20the%20script%20executable%3A%20chmod%20%2Bx%20alsa-save.sh
  5. https://ostechnix.com/ubuntu-automatic-login/