[HN Gopher] Using a Raspberry Pi as a Bluetooth Speaker with Pip... ___________________________________________________________________ Using a Raspberry Pi as a Bluetooth Speaker with PipeWire Author : mfilion Score : 130 points Date : 2022-09-02 14:58 UTC (8 hours ago) (HTM) web link (www.collabora.com) (TXT) w3m dump (www.collabora.com) | pletnes wrote: | 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. | mbreese wrote: | 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. | pletnes wrote: | Agree, the built-in DAC is so noisy it's more or less | unusable. A USB DAC is not too expensive and can be plugged | into some random laptop, too. | rcarmo wrote: | I do the same with a Pimoroni DAC SHIM (a little PCB you can | slot between the Pi and another connected device) | skykooler wrote: | Is it possible to set this up so that multiple devices can be | paired and stream audio to the same speakers simultaneously? | sandreas wrote: | 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 :-) | | [1]: https://github.com/sandreas/raspberry-bluetooth-receiver | | [2]: https://stackoverflow.com/questions/50190477/bluez-and- | dbus-... | jypepin wrote: | 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? | numpad0 wrote: | 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? | dmicah wrote: | They are in short supply, however you can still pay normal | retail price. Check https://rpilocator.com/ . | kej wrote: | 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. | pengaru wrote: | 2x is current normal due to shortages, 10x is definitely wrong | places. | | You can snipe at 1x from the usual rpi vendors when they come | back in stock, if you make the effort. | Pasorrijer wrote: | 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. | arcbyte wrote: | Please only buy from certified vendors and do not under any | circumstances pay anyone over normal retail price. | Phrenzy wrote: | 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. | doc_gunthrop wrote: | 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. | brk wrote: | 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. | vrnmh wrote: | Using my old 2015 Macbook Pro for this; OCLP allows enabling | airplay receiver for unsupported macs. | NegativeLatency wrote: | I use shairport-sync on my old macs for this, installs with | brew and has a launchd service and everything | mixmastamyk wrote: | 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. | mercwear wrote: | 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. | twicetwice wrote: | 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. | | [0]: https://github.com/Spotifyd/spotifyd | giobox wrote: | 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: | | > https://hub.docker.com/r/flaviostutz/rpi-spotify | | > https://github.com/qSharpy/raspotify-docker-compose | | > https://github.com/Spotifyd/spotifyd | | etc etc. | | 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. | nsteel wrote: | All of those use reverse engineered APIs, particularly for | playback. Spotify's APIs only support playback through a Web | browser (that supports their DRM). | spockz wrote: | 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. | giobox wrote: | I'm actually using HifiBerry! They provide a great OS built | in partnership with B&O that supports Spotify/Airplay with | their devices out of the box: | | https://www.hifiberry.com/hifiberryos/ | Phrenzy wrote: | 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. | giobox wrote: | DSP hat + calibration mic is exactly the approach I went | with, agreed it is an incredible setup for the money. | | > https://www.hifiberry.com/shop/boards/hifiberry-dac- | dsp/ | worik wrote: | The sound output through the 3.5mm jack is notoriously low | quality. | | Use a sound card. | userbinator wrote: | 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. | blantonl wrote: | 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. | rozenmd wrote: | I'd recommend Volumio - gets you Spotify connect for your | raspberry pi, and if you have a NAS, it can index that too | jensgk wrote: | Volumio is ok, but I much prefer moodeaudio.org. It is also | open source. | Phrenzy wrote: | 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. | archi42 wrote: | 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? | nsteel wrote: | 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. | morninglight wrote: | If the goal is to play music from your phone, then buy a phone | with a headphone jack. Problem solved! | | . | seltzered_ wrote: | 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). | NegativeLatency wrote: | It's nice to be able to use my phone normally (put it in my | pocket etc) while playing audio from it on nicer speakers | withinboredom wrote: | 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." | PufPufPuf wrote: | 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. | noman-land wrote: | Please say more about this! I've wanted to do this for ages. | dementik wrote: | 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. | TedDoesntTalk wrote: | What are your players? What kind of device? | dementik wrote: | 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. | aglarech wrote: | If you like it simple max2play is an image for that. | https://www.max2play.com/en/ | jwiz wrote: | Wow, I'd not thought about that in ages. I still have the | original slimp3 around here somewhere.... | AceJohnny2 wrote: | And I have a Squeezebox 3/Classic I've been meaning to drop | off at electronic recycling... but it's such a nice object! | TedDoesntTalk wrote: | I have 4 of them. Need any more? | tambourine_man wrote: | 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) | rektide wrote: | > _However, for this use case,_ | | 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(r) 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._ | netsharc wrote: | 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..." | lowbloodsugar wrote: | Or a hifi-berry amp. I don't use Hifi-berry's distro anymore | though. I use diet-pi. Also Roon. But you don't need Roon for | airplay or casting. ___________________________________________________________________ (page generated 2022-09-02 23:00 UTC)