Building a Yacht Rock Song Title Generator
Since moving to Atlanta and getting a place with a pool, I like to spend the warmer months coding out on the deck with my Jack Russell Terrier, jumping into the water while things build, and then diving back into the code. I’ve found Yacht Rock to be a genre that accompanies this lifestyle quite nicely. The smooth West Coast sounds of the mid ’70s through early ’80s is just the kind of thing you can sing along to when you’re in one mood, and not pay too much attention to when you really need to ruminate on a problem.
When the weather gets cold, I’ve tended to stay in that frame of mind. So I decided to make a fun, little website that pays tribute to these songs by exploring what characterizes them based on their title. Thanks to the folks who originated the term with the Yacht Rock web series, and then the Beyond Yacht Rock podcast, getting the data for this project was a breeze.
Yachtkov is a Yacht Rock song title generator that uses a Hidden Markov Model trained on song titles rating greater than 50 on the Yachtski Scale.
Using Beautiful Soup, I simply pulled the data from the site and fed it into Markovify, which is a high-level tool for working with hidden markov models in Python. Something I like a lot about this language generation tool is that it has configurations for trying to create content that is sufficiently unlike the source data. With short things like song titles, this helps avoid duplicating the source content – meaning you shouldn’t see song titles that are identical to titles in the source data.
This was also an opportunity to work with React Hooks. I used the state and effect hooks to handle asynchronous requests to a simple Flask backend.
The highly throwback look and feel wasn’t just a function of being easy to code; I thinkit pays a solid tribute to what these kinds of songs evince from the moniker of Yacht Rock alone.
I would probably be remiss if I didn’t take a minute to acknowledge that I’ve “been the fool before” with these sorts of projects, albeit in a difference genre of music. You may remember my PyCon 2013 presentation on building a Media Takeout Headline Generator, where I discussed probabilistic language modeling within the context of some of my favorite hip hop artists at the time.
While it should be noted that my car’s still blasting Hip Hop Nation most of the time (don’t get me started on Yacht Rock Radio), a bunch of things have changed since then. And I don’t just mean I’m a little older and wiser.
The MTO Headline Generator generated a bunch of text with Python, and then served up the pre-processed text with PHP. This project uses a Flask backend that builds the language model once, stores it in memory, and serves it just as fast as retrieving a random value from a large flat file.
The PHP site was, of course, intentionally modeled after Media Takeout’s styling at the time, and so used entirely server-side rendering (if memory serves me correctly). This Flask app serves an extremely simple React App, and makes async requests to retrieve data from the same app on a separate endpoint.
And of course, from a computational linguistics standpoint, HMMs produce far better output than the somewhat more naive N-Gram-based approach I used in the past.
I think there’s something special in creating art from your code, especially when you can do it in a way that lays bare the endemic characteristics of another form of art. It lets you engage as both a craftsman and observer, providing commentary and critique simultaneously.
I encourage you to imagine what songs like Show Me The Night, You Made a Fool Believes, Caught Up in the Business, and Tell Me What You Won’t Do For Love sound like. Rest assured, they’ll have that Doobie bounce, smooth production, a little something extra melodically, and probably a Porcaro or two in the personnel.