This simple program analyzes the sentiment of sentences typed by the user, and composes music on-the-fly based on the extracted sentiment.
Python 2.7
NLTK 3.0
, a natural language processing library. Installation.FluidSynth 1.1
, a real-time synthesizer. Installation. Also available via Homebrew.PyFluidSynth 1.2
, Python wrapper for FluidSynth. Installation. Also available via pip.
After installing the dependency tools/libraries mentioned above, clone this repository into a directory of your choice:
git clone git@github.com:erdiaker/sentiment2music.git
Sentiment analyzer needs some data (~15 MB) to train. Download it by typing the following in terminal:
python -m nltk.downloader movie_reviews punkt
FluidSynth needs some soundfont files (~145 MB) in order to synthesize sound. Download it into your installation directory as follows:
wget -O - http://ftp.de.debian.org/debian/pool/main/f/fluid-soundfont/fluid-soundfont_3.1.orig.tar.gz | tar -xzf -
To start the program, type the following in your installation directory:
python sentiment2music.py
After a few seconds, you should start hearing something. The program will also prompt you to type a sentence. Do as instructed, and the music will change according to the sentiment of the sentence. Have fun!
MIT