Long-form Lockdown Project: A Random Album Player

Long-form Lockdown Project: A Random Album Player

For the last couple of years, I’ve been trying to combat my shortening attention span, mostly by getting back into longer-form media.

Books, for example: in 2019 I set myself a target of reading a couple of books a month, and actually managed to read 41 in the year. Based on that, my challenge this year is to read 40, and I’m on target for that. I’m trying to mix things up a bit, with classics like Rebecca and Silas Marner rubbing shoulders with modern fun like the Expanse novels.

I also signed up to Letterboxd, a film logger, to encourage myself to watch more films and spend less time on endless episodes of mediocre TV. I signed up about a year ago, and so far I’ve watched 92 films. Not all of them were better than mediocre TV, I’ll admit1, but some of them were brilliant — everything from Brief Encounter to The Death of Mr Lazarescu—and I’m glad I’ve been doing it.

I haven’t really tried to get back to the longer form with music, apart from buying a few albums here and there, but vinyl is expensive and, though I enjoy the experience, it’s not convenient enough that I’m listening to actual records very often.

So, I’m mostly streaming my music. I have a playlist in Spotify that’s basically “every song I’ve heard in the last few years that vaguely intrigued me and I wanted to hear more of”:

When I can be bothered, I’ve typically found the whole album that song is part of and added that to the playlist. But when I want to dip into my “Future Listening” playlist, it’s tough to do it in an album-based way. I can shuffle the playlist, but that juxtaposes L7 with Big Big Train, or Jade Bird and The Damned, in a way that’s too much of a clash.

Other people want “album shuffle” from Spotify, too, but they’re not doing it anytime soon.

So, when I was scratching around for a lockdown project to keep myself sane, I remembered I’d bought a Raspberry Pi (model A+) from a friend a few years back and hadn’t really done anything with it. I dug it out of the cellar, dusted it off, and got to work.

I now have a Python script (of course the Spotify python library is called Spotipy) that runs on the Pi and, when executed, goes through that Future Listening playlist, picks a song at random, finds the album it’s from, and plays the entire album on the Echo stereo pair that sit in my living room.

I also have — only on breadboard so far — a little circuit hooked up (thanks, Gpiozero, you’re very easy to use) so that I can do all this at the touch of a single button.

Right now I can push that little grey button, the LED pulses to let me know everything’s working, and a couple of seconds later an entire album, selected at random from a song on my playlist, plays in my lounge.

There were some trials and tribulations along the way — Spotipy’s OAuth flow assumes that if your Python script has a web browser available, that it’s powerful enough to actually display the Spotify login page in the same decade that you ask for it, which is not true for Chromium on a first generation A+ Raspberry Pi, let me tell you (In the end I just copied the cached credentials over from my Mac after authorising there. Hey, this whole thing’s a hack…)

And it took me so long to get the networking going on the obsolete WiFi dongle I was using that I should probably have just bought a new Pi with WiFi built in. But that’s the kind of thing that comes with the package when you decide to do some ludicrous project to distract yourself from being alone in lockdown during a global pandemic, right?

Anyway, I’m about done with the prototyping, and I have just ordered a cheap little box for the project. And the button I want to use just dropped through my letterbox, too. There’s nothing like a big red button to say “fun project”, is there?

This week, hopefully, I’ll case up my project and pop a little box with a red button on it somewhere convenient in my lounge, and whenever I want to hear a whole album chosen at random, I’ll push the button.

While I’m at it, I might just add a couple of extra buttons and lights because, well, once you’ve got a little box that can do things at the touch of a button, you never know what you’re going to think of next, do you?

And that, in short, is one of many ways I’ve been distracting myself during the current global crisis. (I still have a full-time job, too, which is extraordinarily lucky, but is also quite stressful, so keeping myself busy and not thinking about the day job outside work hours is pretty important for my mental health…)

Check out the next post along if you want to see it all boxed up and working.

  1. I’m looking at you, The Happytime Murders; you could’ve been as good as the Angel episode Smile Time if you’d really tried []
« Eyjafjallajökull | Long-form Lockdown Project: Wired and Boxed »

1 Comment

  1. Long-form Lockdown Project: Wired and Boxed | Gothick.org.uk
    June 5, 2020

    […] silly thing I was working on? Well, my extra buttons and LED holders and a step drill bit and a cheap box arrived (thanks, RS […]