Life during a pandemic is difficult. Every day, the news tells us another disheartening story of ignorance, intolerance, and injustice. In times of strife, the human instinct is to turn to art. We crack jokes, we become amateur artisans, and we listen to music. These unite us, especially as we live socially-distanced lives. Our group was inspired by the power of fusing music, art, and technology to bring communities together. Named after the physics symbol for wavelength, lambda allows us to discover more about what kinds of music bring us stability amidst a world of uncertainty, and more lightheartedly, to find out if our friends are grooving to the same frequencies as we are.

What it does

Lambda is a multi-dimensional visual analyzer of your top Spotify tracks. This visual analyzer connects the following metrics in a personalized animation:

  • Preference: How many times you have listened to the song recently, represented on the x-axis
  • Energy: How much the song makes you want to dance, represented by the height of the circles
  • Valence: How positive the song is, on a color gradient from yellow (happy) to blue (sad)
  • Popularity: How popular the song is among Spotify users, from 0 (most obscure) to 100 (most popular)
  • Tempo: The speed of the song, represented by the pulsing sound waves around the circles

In addition, lambda analyzes the lyrics of your top songs using machine learning sentiment analysis, providing an average sentiment score across all your favorite tracks. lambda also calculates which words appear most frequently in the songs you listen to.

Through these factors, lambda provides a unique, musical view into your headspace, which can be easily shared with your friends and family.

How we built it

We used Glitch to work collaboratively and remotely on this project. The entire software was created using a combination of JavaScript, HTML, and CSS. We used the Spotify Web API to get the user's Spotify data and we used the Genius Web API to get the lyrics of the user's top 20 Spotify songs for further analysis. The machine learning aspect of the project was powered by Sentiment from ml5.js and the animations in the visual map used the p5.js library. We worked with Bootstrap for the front-end part of this project.

Challenges we ran into

We ran into several challenges during the project. For one, we all started this project with limited knowledge of JavaScript. The majority of the group had no prior javascript experience before starting this hackathon, but we felt that creating a website would be the best approach for lambda.

It was also our first time working the web APIs and we ran into a number of problems along the way. One problem we struggled with for a while was setting up the Spotify API. For a long time, our results were coming back as null. We eventually realized that we had inadvertently disrupted the client & server interaction. This was our first time learning this concept. Another issue we struggled with was authentication, a problem which we then resolved by including it in the header of the GET request. We also struggled with the Genius web API. In the process, we learned about modules, different types of imports, and event listeners.

Accomplishments that we're proud of

We are proud of how much we were able to accomplish. Considering that the majority of our team was neither fluent in JavaScript nor had experience with web APIs prior to this project, we are immensely proud of ourselves for ultimately implementing our entire project in JavaScript with two web APIs. This has been a tremendous learning opportunity and we had a lot of fun while working on lambda.

What we learned

We learned about the inner workings of and interactions between JavaScript, HTML, and CSS. We also learned about web services, APIs, authentication, and client-server interaction.

What's next for lambda

Future plans include extending the dimensionality of the visualization (e.g. a rotatable three-dimensional dot plot) to give the user more visual information. Providing users with analytics about their top artists on Spotify, not just top tracks, would also be an interesting extension of lambda.

Share this project: