Harmony Journey — Python and the Soundtrack to Your Life

Shuffle a public Spotify playlist so that it builds up towards a target song in a given time. Perfect to set the right mood on your trip as you arrive at your awesome destination!

Eric Velasco
2 min readAug 21, 2023
https://opinela.blogspot.com/2013/07/the-most-specific-directions-to.html

Have you ever wanted life to have a fitting soundtrack for what you’re seeing and experiencing, just like the match between songs and scenes in a movie? Harmony Journey is the app for you!

Picture this: you have put together an amazing playlist for your next trip but how do you make sure Miley Cirus’ Party In The U.S.A. will play exactly when you arrive in Hollywood and see the famous sign? That would be a fitting soundtrack for the scene, right? With that in mind I created Harmony Journey.

The app is a simple adaptation of the infamous knapsack problem. You want to minimize the absolute difference between the length of your trip and the sum of the shuffled playlist’s length, stopping at a target song (Party In The U.S.A. in the example above). I also added a sprinkle of linear algebra so that the other songs’ progress until your target are cohesive.

I guess the bottom line is that with things your learn at the start of your coding journey there’s nothing you can’t do. So begginers: be creative and NEVER give up!

Have fun: Harmony Journey — Shuffle a Spotify playlist so your life has a fitting soundtrack! · Streamlit (harmony-journey.streamlit.app)

P.S.: the streamlit app is just Proof of Concept to see if you guys like the idea. It’ll have improvements if you show interest via reaching out to me on LinkedIn or commenting on this article.

--

--

Eric Velasco

Data Engineer | Python, Apache Airflow, SQL, Docker, Machine Learning (AI), Data Analytics