This is a neat way to use the PI, if you want to avoid BT all together and have access to a web browser on the PI you could also login to Spotify.com and use your phone / watch to manage what is playing but have the output set to the web browser on the PI. This assumes you use Spotify of course =)
I have a similar setup in my workshop and it has been solid for years.
Better yet would be to use spotifyd[0] for this. I tried to set this up with my RPi a while ago but was defeated by Linux audio. Instead I just bought a Sonos. Oh, well.
You don't even need a graphical user interface, a web browser or the official Spotify app to accomplish this either - you can use open source projects that use the official Spotify API to create an extra Spotify speaker you can control from Spotify on another phone or PC.
There are loads of these projects, often in docker containers you can launch with a single command:
I've several speakers integrated with various Spotify API based solutions around my home running on various RPi hardware. Some of these projects do even more, like add Airplay streaming too.
Interesting! Combine this with the product(s) from hifi berry and you can relatively cheaply turn any high quality speaker into a standalone. Who needs Sonos.
Check out HiFiBerryOS with their DSP hat and a calibration mic.
Pi + DSP Hat + AIYIMA A07 + decent speakers + Roon (or other) = A fantastic and inexpensive sound system. You could spend 50x as much and not get as good sounding system.
All of those use reverse engineered APIs, particularly for playback. Spotify's APIs only support playback through a Web browser (that supports their DRM).
Actually I kept wanting to use my phone (which has a headphone jack) as a bluetooth receiver for audio from the PC, and remember attempting to spelunk into the bluez stack (for use with lineageos) and getting frustrated quickly.
There's some niche usecases (e.g. lengthy video editing on a PC while wanting to move around listening to music on your phone - airfoil (wifi) technically works but at the time was a bit laggy).
Pi's can also be used as servers and receivers for the open-source Logitech Media Server software. I've been successfully using it for synchronized multi-room audio. It has support for both local music and streaming services.
I am using this. LMS is running on the network. UI is material-ui (works great on mobile as well). Spotty as Spotify plugin.
I can play music directly from my mobile Spotify (so supports Spotify Connect). I can see all my Squeezebox players there, combines synced players flawlessly.
Also plays local files. And also directly from youtube.
I have about 9 players on different rooms and could not be more happy with the setup.
If you would like to know any specific details, just ask. Happy to elaborate.
Currently I have multiple different Squeezebox players (Boom, Radio, Receiver, Touch), then on mobile Squeezeplay app (Android) for mobile usage (sometimes quite handy, when somewhere else than home, nice way to have own music library with me via VPN with same UI as home).
Also Chrome speakers are players from LMS point of view.
Squeezeboxes are rather durable, probably will use those for many more years. Have been also collecting little replacement player stock :)
Wanted to evaluate esp32 -based player mainly for hacking purposes, but havent found yet time to work on those.
somewhat unrelated but I recently looked for a pi and it was sold out or the price tag was 10x the regular price everywhere, mostly because of the chip shortage. Am I looking in the wrong places?
From the parent link you can find the pilocator Twitter account, and your can set that to notify your phone whenever there is new inventory. In the U.S., Adafruit has been doing big drops the last few Wednesdays and Thursdays, but you need your account and 2FA set up ahead of time.
Part of me wants to buy a $200 pi on Amazon, wait 29 days, and then return it. I enjoy the thought of a scalper having his inventory unavailable until price normality returns.
Also, some retailers have just the pi out of stock, but have it in stock if you get a bundle with a case, etc. That's how I got an 8GB one a few weeks ago.
I've had good luck with the Le Potato boards for RPi style applications. They are in stock and ~$55USD. Generally compatible with RPi4 cases and accessories.
The shortage is insane, and seems as if someone is trying to cripple supply for small autonomous computers that could be used for UAVs and guided munitions - isn't that a possibility, actually?
Seems it's more due to a number of scalpers who use(d) automated scripts to make bulk purchases from online vendors in order to sell at a markup on sites like amazon.
That's why the legit vendors like Adafruit now set a quantity limit and also require registration (with phone number IIRC) to buy them.
I’m all for hacking with the Pi, god knows I’ve a tendency of buying them for every automation idea I may have, even if only an embarrassingly small percentage is actually ever implemented.
However, for this use case, I’d recommend one of those Bluetooth “pen drives” with a P2 conector. I’ve used one powered by a phone charger connected to a stereo for over a decade. It’s cheep and works as well as Bluetooth possibly can (pairing sucks, range too, etc)
As a bluetooth speaker, perhaps yeah. To me, the title described a capability clearly. I might already have, for example, a KodiTV media rpi. Now I know I can add more features to this system easily.
General purpose computing is great. We can keep exploring & expanding what we do; being limited only by imagination is excellent. We could add public announcement capabilities, could have the rpi connected to webconference software, could set up music-playing daemons or internet radio (somewhat covered by KodiTV). This article was a clear way to state what capability is possible. And it's mostly all built-in to the latest greatest free desktop technology, requiring only a little glue to make the bluetooth connection seamless:
> It provides Bluetooth® A2DP support with optional codecs (SBC-XQ, LDAC, aptX, aptX HD, aptX-LL, FastStream) out of the box. At the same time, WirePlumber automatically creates the connection between the A2DP source and the audio chipset when a remote device, like a phone or a laptop, connects. This makes the configuration very easy, as PipeWire will work out of the box. We will only need to set up BlueZ to make the system headless.
Any recommendations? I got one from AliExpress for my car and when it plays the navigation instructions it seems to mess up the order of the received data packets, so it says "100 in meters..." instead of "In 100 meters..."
I’ve had decent luck with shairport-sync (I think the name was) for Airplay audio. Only relevant for mac/ios, which I happen to use. Video playback and streaming airplay audio syncs up though, totally unlike windows with bluetooth audio, which I discovered in the past. I use a USB sound card with an older «dumb speaker» of good but analog quality.
I do the same, and think it’s a great setup. I have a few around the house attached to older (nice) dumb speakers.
But really, the extra USB audio adapter is a must here. The internal Pi audio hardware, I found to be very noisy. The USB DACs I bought were also super cheap (<$10). You can scale this up in cost as much as you’d like.
Volumio is pretty good. I used the free version. I've moved to Roon and it is on another level. Check it out if you would like to rediscover your music collection.
Is Spotify connect still working [will it keep on working]? I thought they'd have [were about to] drop the old API implemented by librespot (et al.) in favor of a pure web API?
I don't know exactly what volumio are doing. But librespot itself does currently still work. Who knows for how long (I doubt Spotify themselves know what they are doing). Librespot is transitioning to the new API, that API has already been implemented by other ports e.g. Librespot-java (and psst). It's not a pure Web API. It's a messy mix.
I use my Linux machine as a Bluetooth speaker with nice big speakers plugged in. Literally required 0 extra software. Just pair and then in my iPhone, hit the little (i) button and selected "speaker."
In times past, was it not easier to share audio output devices on Linux computers with normal networking or Bluetooth?
I never much cared for audio applications but I can distinctly remember it being trivial to use my Ubuntu PC as an audio device for pretty much anything else. Dread to think of the Bluetooth delay though.
A few years ago I already experimented with this[1]. However I'm still wondering why the bluez api does not let you set the playback position[2]... it is pretty awesome to not only use raspberry as bluetooth receiver but also use GPIO-Buttons or IR remote to send commands to the connected bluetooth devices (play, pause, next, etc.), but without the ability of setting a playback position that feels kind of incomplete - I would have loved to implement the "rewind 30s" button :-)
That's quite... overpowered for what it does, considering that the majority of BT speakers are usually based around a dedicated SoC with a few hundred MHz of CPU and at most several MB of RAM.
given the shortage of Pi's available on the market right now, and the fact that you can get Bluetooth adapters for speakers on Amazon for a few bucks, it's probably not applicable anymore for real world usage.
But, it's a cool writeup and a nice learning process that is documented well.
Is there a book that explains all this dbus, glib, gstreamer mumbo-jumbo? Despite knowing a lot about classic Unix stuff and Python, I don't think I could write something like this by cobbling advice from a bunch of random webpages.
I'm not sure there is. They're all separate projects, that just happen to be the standard linux tech stack everyone(Except the people who don't) agree on.
It would be cool to write a guide to Linux programming that went over all the stuff you should know to do it the modern way.
dbus is a message bus that lets apps communicate. But it's object oriented and corba-ish and really complicated. It's wonderful if you don't have to think about it and are just copying and pasting. If you have to actually think about it , it becomes just OK. I'm still a big fan though.
Also, it's not really a pure message bus, it also does stuff like RPC calls. It's not just an MQTT type thing.
Gstreamer is a node based audio framework. It is the second best way to handle media as far as I'm concerned, the best being to not do so at all and use existing stuff because media always seems to be a nightmare in new ways every time.
You mostly never touch any actual media. You just set up nodes with code.
glib is a utility library that has to to with the GTK and gnome people , like gstreamer. It tries to give C the things that other languages I'd rather be using have. I'd still rather be using them instead.
There's also gobj. They have this object thing for C and they can auto generate bindings for python with introspection. This is how gstreamer works in python.
Unfortunately it is totally possible to make resources leaks and such using those bindings, autocomplete won't work, you may get unhelpful error messages, or just annoying unpythonic things, and you will probably need GDB to debug any segfaults, should you want to do anything very complicated.
I tried running the script (audio receiver) on two desktop Linux laptops running PipeWire and bluez, but my other computers (acting as an audio source) would not pick up the receiver advertising A2DP (0000110d-0000-1000-8000-00805f9b34fb), and the receiver's terminal prints neither "AuthorizeService" nor "Service rejected" (indicating that Agent isn't taking effect). What did I do wrong?
Would only suggest using the Pi's HDMI output to an "HDMI audio extractor", feeding out toslink/spdif to something else, and avoid having the Pi DAC involved with it's 3.5mm output. Keep the signal digital across the cheap components until it gets to a high quality DAC that feeds the speakers.
I have a similar setup in my workshop and it has been solid for years.
reply