We won the Nexmo Prize (best use of their API) and best audio hack.
After being inspired by a friend's creation of a rap bot, we decided to build a bot that could alter existing rap songs to be about new topics. Then, of course, we needed a way to access the bot, and we wanted to do something with the Nexmo API, so we decided that we would interface with it using texts and phone calls.
The entire project is built in python. We've used quite a few libraries, including:
- flask (for building a web server)
- nexmo (for interfacing with the nexmo platform)
- nltk (natural language processing)
- tswift (for fetching song lyrics)
- google-cloud-texttospeech (for text-to-speech)
- pydub (for layering 2 MP3 files ontop of eachother)
Our team was just two people,
- Justin Chadwell: Natural language processing and lyric generation with
- Will Russell: Nexmo SMS and calls, flask server, tts and mp3 layering
$ git clone https://github.com/jedevc/royal-hackaway-2019.git $ cd royal-hackaway-2019 $ virtualenv .env $ source .env/bin/activate $ pip3 install -r requirements.txt
Before you can run, ensure that you have created the required files for the Nexmo API and the Google Cloud Platform so that you can access their APIs.
Google Cloud Platform
Follow the quick start guide here
python3 -m caller
Using the Nexmo API, we get the user to text our bot using SMS with the theme they'd like to use for their own rap. Then, we select a random song from our list of songs to use as a base. We then use NLP to tag the song and to modify it so that we replace some of the nouns with our desired subject, effectively changing what the song is about. The lyrics are converted into an MP3 with the Google Cloud TTS API, with a beat added behind them, using pydub, to create the rap.
The result is then sent back to the user. This is done with a phone call, where the rap is played back to them.