Cracking The Spotify Code

If you’ve used Spotify, you might have noticed a handy little code that it can generate that looks like a series of bars of different heights. If you’re like [Peter Boone], such an encoding will pique your curiosity, and you might set out to figure out how they work.

Spotify offers a little picture that, when scanned, opens almost anything searchable with Spotify. Several lines are centered on the Spotify logo with eight different heights, storing information in octal. Many visual encoding schemes encode some URI (Uniform Resource Identifier) that provides a unique identifier for that specific song, album, or artist when decoded. Since many URIs on Spotify are pretty long (one example being spotify :show:3NRV0mhZa8xeRT0EyLPaIp which clocks in at 218 bits), some mechanism is needed to compress the URIs down to something more manageable. Enter the media reference, a short sequence encoding a specific URI, generally under 40 bits. The reference is just a lookup in a database that Spotify maintains, so it requires a network connection to resolve. The actual encoding scheme from media reference to the values in the bars is quite complex involving CRC, convolution, and puncturing. The CRC allows the program to check for correct decoding, and the convolution enables the program to have a small number of read errors while still having an accurate result. Puncturing is just removing bits to reduce the numbers encoded, relying on convolution to fill in the holes.

[Peter] explains it all in his write-up helpfully and understandably. The creator of the Spotify codes stopped by in the comments to offer some valuable pointers, including pointing out there is a second mode where the lines aren’t centered, allowing it to store double the bits. [Peter] has a python package on Github with all the needed code for you to start decoding. Maybe you can incorporate a Spotify code scanner into your custom Spotify playing mini computer.

Building A Custom Linux Single Board Computer Just To Play Spotify

If you want to hook up an existing stereo or amplifier to Spotify, there’s a fair few options on the market. You can even just order a Raspberry Pi and be done with it. [Evan Hailey] went his own way, however, and built his own Spotify Box from scratch.

[Evan] even made this tidy wooden enclosure, learning yet more along the way!
Housed inside a tidy little wooden enclosure of his own creation, the Spotify Box can turn any amplifier into a remote-controlled Spotify player via Spotify Connect. Pick the songs on your smartphone, and they’ll play from the Spotify Box as simple as that.

The project is based on the Allwinner V3S, a system-on-chip with a 1.2GHz ARM-Cortex-A7 core, 64MB of DDR2 RAM, and an Ethernet transceiver for good measure. There’s also a high-quality audio codec built in, making it perfect for this application. It’s thrown onto a four-layer PCB of [Evan’s] own design, and paired with a Wi-Fi and BlueTooth transceiver, RJ-45 and RCA jacks, a push-button and some LEDs. There’s also an SD card for storage.

With a custom Linux install brewed up using Buildroot, [Evan] was able to get a barebones system running Spotifyd while communicating with the network. With that done, it was as simple as hooking up the Spotify Box to an amp and grooving out to some tunes.

Along the way, [Evan] learned all about compiling drivers and working with embedded Linux, as well as how to take a bare SoC and build it into a fully-functional single-board computer. When someone else says they “made” a Spotify player, he presumably gets to clear his throat.

If you fancy retro computers, consider interfacing Spotify with your classic Mac instead!

[Thanks to Jay Carlson for the tip!]

Otters Deliver A High Power Stationary Audio Experience

Our favorite raft of otters is back at it again with another display of open source audio prowess as they bring us the OtterCastAmp, the newest member of the OtterCast family of open source audio multitools. If you looked at the previous entry in the series – the OtterCastAudio – and thought it was nice but lacking in the pixel count or output power departments then this is the device for you.

The Amp is fundamentally a very similar device to the OtterCastAudio. It shares the same Allwinner S3 Cortex-A application processor and runs the same embedded Linux build assembled with Buildroot. In turn it offers the same substantial set of features and audio protocol support. It can be targeted by Snapcast, Spotify Connect or AirPlay if those are your tools of choice, or act as a generic PulseAudio sink for your Linux audio needs. And there’s still a separate line in so it source audio as well.

One look at the chassis and it’s clear that unlike the OtterCastAudio this is not a simple Chromecast Audio replacement. The face of the OtterCastAmp is graced by a luscious 340×800 LCD for all the cover art your listening ear can enjoy. And the raft of connectors in the back (and mountain of inductors on the PCBA) make it clear that this is a fully fledged class D amplifier, driving up to 120W of power across four channels. Though it may drive a theoretical 30W or 60W peak across its various outputs, with a maximum supply power of 100W (via USB-C power delivery, naturally) the true maximum output will be a little lower. Rounding out the feature set is an Ethernet jack and some wonderfully designed copper PCB otters to enjoy inside and out.

As before, it looks like this design is very close to ready for prime time but not quite there yet, so order at your own risk. Full fab files and some hints are linked in the repo mentioned above. If home fabrication is a little much it looks like there might be a small manufacturing run of these devices coming soon.

You Otter Be Able To Stream That Audio: Open Hardware Eclipses Chromecast Audio

When Google halted production of the Chromecast Audio at the start of 2019, there was a (now silent) outcry. Fans of the device loved the single purpose audio streaming dongle that delivered wide compatibility and drop-dead simplicity at a rock bottom $35 price. For evidence of this, look no further than your favorite auction site where they now sell for significantly more than they did new, if you can even find an active listing. What’s a prolific hacker to do about this clear case of corporate malice? Why, reinvent it of course! And thus the Otter Cast Audio V2 was born, another high quality otter themed hack from one of our favorite teams of hardware magicians [Lucy Fauth, Jana Marie Hemsing, Toble Miner, and Manawyrm].

USB-C and Ethernet, oh my!

The Otter Cast Audio is a disc about the shape and size of standard Chromecast (about 50mm in diameter) and delivers a nearly complete superset of the original Chromecast Audio’s features plus the addition of a line in port to redirect audio from existing devices. Protocol support is more flexible than the original, with AirPlay, a web interface, Spotify Connect, Snapcast, and even a PulseAudio sink to get your Linux flavored audio bits flowing. Ironically the one thing the Otter Cast Audio doesn’t do is act as a target to Cast to. [Jan] notes that out of all the protocols supported here, actual Cast support was locked down enough that it was difficult to provide support for. We’re keeping our fingers crossed a solution can be found there to bring the Otter Cast Audio to complete feature parity with the original Chromecast Audio.

But this is Hackaday, so just as important as what the Otter Cast Audio does is how it does it. The OtterCast team have skipped right over shoehorning all this magic into a microcontroller and stepped right up to an Allwinner S3 SOC, a capable little Cortex A7 based machine with 128 MB of onboard DDR3 RAM. Pint sized by the bloated standards of a fully interactive desktop, but an absolutely perfect match to juggling WiFi, Bluetooth, Ethernet, and convenient support for all the protocols above. If you’re familiar with these hackers’ other work it won’t surprise you that what they produced here lives up to the typical extremely high quality bar set by such wonders as this USB-C adapter for JBC soldering iron handles and this TS-100 mainboard replacement.

It sounds like a small production run might be on order in the future, but until then production files optimized for a particularly popular Chinese manufacturer are provided, with complete BOM and placement files. It sounds like turnkey production costs from that manufacturer are a shockingly reasonable $10 (total) per unit with most components, and come to a still-reasonable $22 with the remaining self-sourced components manually installed.

For a demo of the finished goods, check out the tweet embedded after the break.

Continue reading “You Otter Be Able To Stream That Audio: Open Hardware Eclipses Chromecast Audio”

Raspberry Pi Zero Powers Spotify Streaming IPod

Even those critical of Apple as a company have to admit that they were really onto something with the iPod. The click wheel was a brilliant input device, and the simplicity of the gadget’s user interface made it easy to get to the music you wanted with a minimum of hoop jumping. Unfortunately it was a harbinger of proprietary software and DRM, but eventually there were a few open source libraries that let you put songs on the thing without selling your soul to Cupertino.

Of course, modern users expect a bit more than what the old hardware can deliver. Which is why [Guy Dupont] swapped the internals of his iPod Classic with a Raspberry Pi Zero W. This new Linux-powered digital audio player is not only capable of playing essentially any audio format you throw at it, but can also tap into streaming services such as Spotify. But such greatness doesn’t come easy; to pull this off, he had to replace nearly every component inside the player with the notable exception of the click wheel itself. Good thing the Classics were pretty chunky to begin with.

In addition to the Pi Zero running the show, he also had to fit a 1000 mAh battery, its associated charging and boost modules, a vibration motor for force feedback, and a 2″ LCD from Adafruit. The display ended up being almost the perfect size to replace the iPod’s original screen, and since it uses composite video, only took two wires to drive from the Pi. To interface with the original click wheel, [Guy] credits the information he pulled from a decade-old Hackaday post.

Of course with a project like this, the hardware is only half the story. It’s one thing to cram all the necessary components inside the original iPod enclosure, but by creating such an accurate clone of its iconic UI in Python, [Guy] really took things to the next level. Especially since he was able to so seamlessly integrate support for Spotify, a feature the Apple devs could scarcely have imagined back at the turn of the millennium. We’re very interested in seeing the source code when he pushes it to the currently empty GitHub repository, and wouldn’t be surprised if it set off a resurgence of DIY iPod clones.

We’ve seen modern hardware grafted onto the original iPod mainboard, and over the years a few hackers have tried to spin up their own Pi-based portable music players. But this project that so skillfully combines both concepts really raises the bar.

Continue reading “Raspberry Pi Zero Powers Spotify Streaming IPod”

Small Spotify Remote Broadens Musical Horizons

When was the last time you tried listening to a new genre of music, or even explored a sub-genre of something you already like? That’s what we thought. It’s good to listen to other stuff once in a while and remind ourselves that there’s a whole lot of music out there, and our tastes are probably not all that diverse. As a reminder, [sorghum] made a spiffy little Spotify remote that can cruise through the musical taxonomy that is Every Noise at Once and control any Spotify-enabled device.

There’s a lot to like about this little remote, which is based upon a LilyGo TTGO ESP32 board with on-board display. The circuitry is basically that and a rotary encoder plus a tiny LiPo battery. Can we talk about the finish on those prints? Yes, those are both printed enclosures. Getting that buttery smooth finish took two grits of wet/dry sandpaper plus nine grits of polishing cloths.

As you can see in the brief demo after the break, there are several ways to discover new music. [sorghum] can surf through all kinds of Japanese music for example, or surf by the genre’s ending word and listen to metalcore, deathcore, and grindcore from all over the globe. For extra fun, there’s a genre-ending randomizer so you can discover just how many forms of *core there are.

Want everyone in the room to know what you’re listening to? Behold the Spotify split-flap display.

Continue reading “Small Spotify Remote Broadens Musical Horizons”

Rock Out While You Knock Out Germs

We don’t know about you, but we’re pretty tired of singing two rounds of “Happy Birthday” or counting Mississippi to 20 each time we wash our hands. It’s difficult to do it without thinking about the reason why, and that’s not good for positivity. If you’d rather have your spirits lifted every time you hit the sink, you need a better soundtrack.

[Deeplocal] made a soap dispenser that gathers one of your top 20 tunes from Spotify and plays it for 20 seconds while you lather. The best part is that the songs don’t start at 0:00 — the code is written to use the preview clip of each one, so you get the algorithmically-determined best part.

Scrubber is a pretty simple build that uses a Raspberry Pi Zero W and a speaker bonnet powered by a LiPo, but we dig it just the same. The switch is adaptable to pretty much any soap dispenser — just stick two pieces of copper tape where they’ll make contact when the pump is pushed down, and solder wires to them. Check out the demo after the break.

We’ve often wondered how much more water we’re using with all the increased hand-washing out there. Adjusting to this apocalypse is arduous for all of us, but the environment is still a concern, so try to remember to turn the water off while you’re not using it. Is anyone out there working on an easy way to adapt home faucets to add motion or foot control? Because that would be awesome right about now.

The nice thing about Scrubber is that you can focus on washing your hands and doing so properly. If you’d rather watch a digital hourglass to pass the time, light up your lockdown lavatory lifestyle with LEDs.

Continue reading “Rock Out While You Knock Out Germs”