Quantcast
Viewing all articles
Browse latest Browse all 4716

Beginners • Getting audio to play on bluetooth speaker with sudo

Hi all, I'm trying to develop a project that plays audio to a Bluetooth speaker while simultaneously lighting up a NeoPixel light strip.

So far, I've been able to get these functions to run independently in their own scripts - I can output audio on command to the connected Bluetooth speaker in one script, and in another I can alter the colors of the NeoPixel light strip.

The problem is when I try to combine these effects in the same script. I have to use sudo to run the NeoPixels script in order to get it to work, but when I do this the Bluetooth speaker doesn't produce any output. There's no error message - I'm assuming this just means while the Bluetooth speaker is connected to my user profile, it's not connected to the sudo user.

I've looked into this thread here: viewtopic.php?t=334255 where another user asked a similar question, and by making PulseAudio a system-wide service, they were able to fix their issue. I tried the exact steps here, but still to no avail. I can confirm that in my system PulseAudio is running system-wide with

Code:

systemctl --system status pulseaudio.service
How do I ensure that the Bluetooth speaker is connected on a system-wide level, or that sudo outputs its audio to it? And would there be a way to ensure that that happens every time on startup before I auto-run the script?

Statistics: Posted by buttmunky — Thu May 02, 2024 9:42 am — Replies 0 — Views 11



Viewing all articles
Browse latest Browse all 4716

Trending Articles