Smart DJ'ing using Facial Recognition
You're hosting a party with your friends. You want to play the hippest music and you’re scared of your friends judging you for your taste in music.
You ask your friends what songs they want to listen to… And only one person replies with that one Bruno Mars song that you’re all sick of listening to.
Well fear not, with MoodBox you can now set a mood and our app will intelligently select the best songs from your friends’ public playlists!
What it looks like
You set up your laptop on the side of the room so that it has a good view of the room. Create an empty playlist for your party. This playlist will contain all the songs for the night. Run our script with that playlist, sit back and relax.
Feel free to adjust the level of hypeness as your party progresses. Increase the hype as the party hits the drop and then make your songs more chill as the night winds down into the morning. It’s as simple as adjusting a slider in our dank UI.
Behind the scenes
We used python’s
facial_recognition package based on
opencv library to implement facial recognition on ourselves. We have a map from our facial features from spotify user ids, which we use to find the saved songs.
We use the
spotipy package to manipulate the playlist in real-time. Once we find a new face in the frame, we first read in the current mood from the slider, and find songs in that user’s public library of songs that match the mood set by the host the best.
Once someone is out of the frame for long enough, they get removed from our buffer, and their songs get removed from the playlist. This also ensures that the playlist is empty at the end of the party, and everyone goes home happy.