Our inspiration arose after a short conversation with the employees at Google Cloud's sponsor table. After explaining our current position as freshman, new to the whole hackathon scene, we were encouraged to use their many application program interfaces, and upon showing us their demo app, a world of possibilities seemed to have opened up.

What it does

Upon running the program, the user is prompted to say any sort of statement ending with the word 'quit'. That statement is then analyzed for its sentiment score, after which a playlist is generated to the particular valence value.

How we built it

We built the program through the use of three APIs, first Google Cloud's speech to text, passing the user's line into a method for sentiment analysis, utilizing Google's sentiment analysis to create a score for the statement, and normalizing that score to a scale of 0 - 1. This score is then given to the Spotify API, generating a list of 50 songs, parsing for each song's_'uri'_ and adding it to a list. A playlist is then created, the songs added, and the playlist id returned.

Challenges we ran into

The biggest challenge we faced was gaining the correct authorization for use with the Spotify api. The module being used, spotipy, did not detail the use of authentication needed. We eventually learned that, rather than using oauth2, we needed to get the token of our Spotify user, and then with that we were able to gain the proper credentials to modify aspects of the account.

Accomplishments that we're proud of

Coming into BostonHacks with nothing but passion and creativity, our project seemed doomed at the start. We were bouncing around ideas, skipping one after the other, making excuses that we were not able to do it. A few hours and a sleepless night later, we are very proud of our newfound knowledge of APIs to create a project we previously thought was unattainable.

What we learned

We learned and made use of three APIs: converting the user's statement into text, passing it into the natural language processing api for sentiment analysis, and then creating a randomized playlist based on their statement's valence.

What's next for ezPlaylist

The ideal next step for 'ezPlaylist' would be implementing the project into a web app, for easier usability. In its current state, this playlist creation tool requires every user to set their 'GOOGLE_APPLICATION_CREDENTIALS' and Spotify developer account keys, however we would love to make this into a simple website where the user clicks a button, says their statement, and suddenly... their playlist is displayed.

Built With

  • google-cloud-natural-language-api
  • google-cloud-speech-api
  • python
  • spotify
  • spotipy
Share this project: