, , , , ,

Sonos / Spotify Vinyl Emulator

Reading Time: 3 minutes

For his very first Raspberry Pi project, Mark Hankinson has created a solution. “I listen to a lot of music through streaming services,” he tells us, “but I never really felt like I had a ‘collection’ – it was a stream of tracks chosen for me by an algorithm, rather than me making real choices. I can’t remember the last time I listened to an album all the way through. Like a lot of people, that led me to the idea of building a vinyl collection, but the idea of buying something I could already listen to through streaming seemed wasteful.”

Aiming to replicate the ‘collection’ aspects and tactile, screen-free nature of vinyl, Mark came up with an intriguing solution involving the use of cardboard album art with NFC tags. When placed on a box containing an NFC reader connected to a Raspberry Pi, the card triggers playback of the relevant music via Spotify on a Sonos sound system.

Each NFC tag can be easily programmed with an identifier for a Spotify playlist, an Apple Music album, or a TuneIn radio station, etc. “My script loops endlessly waiting until it gets an NFC input, then works out what kind of input that is and passes it to the Sonos API to do something with.”

  • Build instructions are on Hackster

  • The code is on Mark’s GitHub

  • It uses Jishi’s node-sonos-http-api package for the Sonos API

  • A sister project displays album art on a HyperPixel Square

  • Mark is working on a super-simple online logging tool called Scrap

Raspberry Pi is secreted in the box along with an NFC reader

Create the album art

Rather than using full-size album sleeves, Mark elected to use mini versions. “I’ve got about 100, which I got printed for £25 and look great. I decided to go with 4-inch square photo cards as they’re easy to handle, but really there’s no limit to what you can do because the tags are so tiny and inexpensive.”

For that extra touch of nostalgia, he even has NFC tags for his favourite playlists stuck to old cassette tape boxes so that they resemble eighties‑style mix tapes!

An impressive debut Raspberry Pi project for Mark, it took him just a few days to get the whole system up and running. “Luckily, a lot of the building blocks (a Python library to interface with NFC and an API to interface with Sonos) already existed, so really all I was doing was wrapping them together,” he says, modestly. “There are also some similar projects created several years ago to do things through a Raspberry Pi with RFID: this is an older technology than NFC, a lot bulkier and not as flexible, but they were still really useful to see how others have approached the issues.”

Fancy a bit of Belle and Sebastian? Just place the album art card on the box to play it on the Sonos speaker

Playing Sonos tracks from RFID tags

Mark says the system could easily be adapted to use a sound system other than Sonos. “It just depends on whether there is an API available for whichever speaker setup you have running. The PyChromecast library looks pretty helpful for Google, for instance. But that will all be a project for someone else to build! I would be delighted to incorporate their code into the GitHub repo if someone does build it.”

Mark has set up a forum on reddit (r/vinylemulator) for people to post their implementations, and says it’s great to see what some people have done with this code. “One person hid the tags inside Disney toys so that his daughter can play her favourite music from different films. Another built a mini record player out of Lego to hide the reader, and put the tags on tiny Lego discs.”

Facebook Comments

Recreate Q*bert’s cube-hopping action | Wireframe #42

Mitmachen: Die Summer of Play Trophäen Challenge geht in die nächste Runde!