Python Web Proxy Convinces Sonos To Stream YouTube

[Maurice-Michel Didelot] owns a Sonos smart speaker, and was lamenting the devices inability (or plain unwillingness) to stream music from online sources without using a subscription service. YouTube Music will work, but being a subscription product there is a monthly fee, which sucks since you can listen to plenty of content on YouTube for free. [Maurice] decided that the way forward was to dig into how the Sonos firmware accesses ‘web radio’ sources, and see if that could be leveraged to stream audio from YouTube via some kind of on-the-fly stream conversion process.

What? No MP4 support for web radio? Curses!

So let’s dig in to how [Maurice] chose to approach this. The smart speaker can be configured to add various streaming audio sources, and allows you add custom sources for those. The Sonos firmware supports a variety of audio codecs, besides MP3, but YouTube uses the MP4 format. Sonos won’t handle that from a web radio source, so what was there to do, but make a custom converter?

After a little digging, it was determined that Sonos supports AAC encoding (which is how MP4 encodes audio) but needs it wrapped in an ADTS (Audio Data Transport Stream) container. By building a reverse web-proxy application, in python using Flask, it was straightforward enough to grab the YouTube video ID from the web radio request, forward a request to YouTube using a modified version of pytube tweaked to not download the video, but stream it. Pytube enabled [Maurice] to extract the AAC audio ‘atoms’ from the MP4 container, and then wrap them up with ADTS and forward them onto the Sonos device, which happily thinks it’s just a plain old MP3 radio stream, even if it isn’t.

Sonos doesn’t have the best reputation, let’s say, but you can’t deny that there’s some pretty slick tech going on inside. Here’s a neat hack we covered last year, adding Sonos support to an old school speaker, and a nice teardown of a IKEA Sonos-compatible unit, which uses some neat design hacks.

Thanks [mip] for the tip!

Featured image by Charles Deluvio on Unsplash.

RadioGlobe Takes The World Of Internet Radio For A Spin

There’s no denying that the reach and variety of internet radio is super cool. The problem is that none of the available interfaces really give the enormity of the thing the justice it deserves. We long for a more physical and satisfying interface for tuning in stations from around the globe, and [Jude] has made just the thing.

RadioGlobe lets the user tune in over 2000 stations from around the world by spinning a real globe. It works by using two absolute rotary encoders that each have a whopping 1024 positions available. One encoder is stuck into the South Pole, and it reads the lines of longitude as the user spins the globe.

The other encoder is on the left side of the globe, and reads whatever latitude is focused in the reticle. Both encoder are connected to a Raspberry Pi 4, though if you want to replicate this open-source project using the incredibly detailed instructions, he says a Raspberry Pi 3 B+ will work, too.

In the base there’s an LCD that shows the coordinates, the city, and the station ID. Other stations in the area are tune-able with the jog wheel on the base. There’s also an RGB LED that blinks red while the station is being tuned in, and turns green when it’s done. We totally dig the clean and minimalist look of this build — especially the surprise transparent bottom panel that lets you see all the guts.

There are three videos after the  break – a short demo that gives you the gist of how it works, a longer demonstration, and a nice explanation of absolute rotary encoders. Those are just the tip of the iceberg, because [Jude] kept a daily vlog of the build.

Maybe you just long for a web radio that dials in vintage appeal. This antique internet radio has a lot of features, but you wouldn’t know it from the outside.

Continue reading “RadioGlobe Takes The World Of Internet Radio For A Spin”

Build Your Own Stand Alone Web Radio

If you’re the type who enjoys passing idle time by keeping up with podcasts or listening to web stations but don’t always want to occupy your laptop or tablet, this Arduino based radio player will provide a base station for tunes.

The Web Radio project by [Vassilis Serasidis] outlines in a pleasing amount of detail exactly how to wire up a short list of four modules. These including an Ethernet shield, LCD screen, MP3 decoder, and USB serial converter, with an Arduino Mini in order to bookmark and play fourteen of your favorite channels. His hand-soldered board couples everything into one neatly stacked package. The instructional video shows this off and he even explains how to locate your favorite stations on internet-radio.com and copy their port and IP number directly into an example sketch which is provided for use. If you’ve been wanting to build a self contained radio node for your desk free of extra baggage, this is a no-sweat project for both the hardware savvy and those more oriented with code writing.

If you’re going to build your own radio, it’s always cool to disguise your high-tech creation as something more rustic. Check out this project by [Dominic Buchstaller] for a great example of a vintage radio given a second calling.

Continue reading “Build Your Own Stand Alone Web Radio”