Messing Around With Audio
How it started
So I had the following audio setup:
Alexa ----(Bluetooth)---+
+--> Speakers
Computer --(Bluetooth)--+
+<--(USB)-- Mic
+--(3.5mm jack)--> Headphones
And I had the following use cases:
- Listening to music from Spotify
- Watching movies (on the computer)
- Video calls & podcasts
And I thought: the third part just works, and I'm happy with that. But maybe I could improve the setup for music & movies, because wired connections, wired speakers, and decent acoustics could make a difference. By the way, if you didn't know it, Alexa can connect to and disconnect from the Bluetooth speaker using voice commands. And it acts as a Spotify device, so I can control it from my phone using the Spotify app, which makes it quite useful.
The Raspberry Pi part
There are some special devices for listening to Spotify. They receive a network connection (probably, Wi-Fi) and have an output for the speakers. But if you add the movie-watching scenario to this, not all speakers are capable of switching sources, so you can end up needing a special device for that, which is suboptimal, to say the least. I thought: what's the state of computer audio for Raspberry Pi (RaPi), as it could be a good fit? And that's what I've found:
- You can have any RaPi you want, including the Zero 2 W, and use Raspotify to play music and control RaPi with your phone or computer.
- If you want to play a movie and transmit audio to RaPi, you can do it with PulseAudio (a Linux audio system), but you'll get a delay over Wi-Fi. Adding Ethernet, which is required (but I haven't tested it, and there's still a chance you'll get a delay), adds complexity and requires a USB-to-Ethernet adapter, so you end up with a RaPi 3B+ and a HiFi HAT (a board for audio output).
- A HiFi HAT can have a DAC (which stands for digital-to-analog converter), so you can connect it to the speakers via RCA (analog) cables, or you can have an optical output, but you'll need another DAC: either an external one or one integrated into the speakers.
Computer --(Ethernet)--> RaPi --(RCA)--> Speakers
or
Computer --(Ethernet)--> RaPi --(Optical)--> DAC --(RCA)--> Speakers
Could you hear the difference between digital and analog cables? Probably not. Could you hear the difference between an external DAC and one integrated into decent speakers? Probably not. But both options are better than transmitting analog audio from the computer, because the computer's DAC can be worse and the computer can add noise to the analog signal.
RaPi is a side quest because it has a lot of use cases. Could I run an NFS server with a USB HDD? It would work, but for better performance, you'd need a RaPi 4, ideally with an SSD HAT and an SSD for the operating system. So the budget here can grow rapidly, although you could repurpose RaPi for other projects in the future. Another thing to note is that the speakers need a power supply, and RaPi needs one too, but a DAC can work just fine with a USB-C connection to the computer for both audio and power.
How would RaPi switch between the audio sources (computer / Spotify)? It should work fine with PulseAudio, but by default it will mix the channels.
Does an external DAC have any advantages? Yes, kind of: it can make your headphones sound better if they're high-quality ones. It also has a volume knob. It can convert an analog signal from the mic with less distortion than a computer, but I have a mic with an ADC built in, so it's better to connect the mic directly to the PC via USB in this case.
Hybrid variants are also possible: leave RaPi Zero 2 W (Wi-Fi) alone with Spotify and connect it via RCA to the speakers. Then connect the computer to the speakers via optical cable, and switch the sources on the speakers. Then you can listen to music without turning on your computer, which probably saves some energy, but I think a laptop is quite efficient.
RaPi Zero 2 W --(RCA)--+
+--> Speakers
Computer ---(Optical)--+
The PC part
At this point, I thought: do I need a RaPi? It won't give me voice commands, it requires a power supply and a separate budget, and I can do the same with the PC, which I don't turn off; it just sleeps when not in use. And I can control Spotify on the PC remotely with my phone; it's just another Spotify device. The PC is the only sound source, so all I need is a USB-to-optical converter because the speakers do not have a USB port.
How it ended
I haven't decided yet. From a minimalist standpoint, the speakers + PC setup looks favorable, and I don't have to deal with all this RaPi architecture. Switching between outputs on the PC also looks convenient. Good speakers take up some space, though, and I kind of like my cable-free, voice-controlled setup. But better speakers and a wired connection should make a difference for music.
As you probably noticed, I haven't considered soundbars because modern speakers have source switching and all the same input options, and stereo music sounds better. Soundbars occupy a niche for TVs, and they sound accordingly, especially with action movies. It still feels like some devices lack inputs, audio interfaces, or source switches, and you have to think too much about how to combine all this into a working system. It's kind of disappointing.
- Previous
Working CV Is About Consistency