If a robot read a novel, how would it feel? You might get a sense from these little jingles. Below are some songs that were automatically created by a series of algorithms that turn the emotions in novels into short pieces of music. If the songs remind you, traumatically, of your untalented little sister practicing piano… well, you can’t say I didn’t warn you.
Actually, the origins of the songs are pretty cool, as the Physics arXiv Blog reports. They start with sentiment analysis, a field in computer science that got hot not long after Twitter did. As more and more people started tweeting, computer scientists and companies wanted to automatically process those tweets, to figure out what emotions people were expressing in them. For example, do people feel negatively or positively about… snack cakes? How do people feel about a specific brand, say, Little Debbie? You can see the commercial interest in this.
The same techniques computer scientists use to analyze Twitter are also able read the feels in any text. So now it’s possible to automatically read the emotions in novels, too. To make the songs below, two researchers—one of them a programmer and a musician—went one step beyond that. After running novels through a sentiment-analysis algorithm, they created an algorithm that would express those sentiments through music.
Each song progresses through the emotions of the novel.
The algorithm splits novels up into four parts—beginning, early middle, late middle, and end—and writes melodies for each section. Thus, each song progresses through the emotions of the novel.
Among other things, the algorithm matches music to emotion by choosing different octaves, tempos, and keys. The sentiment analysis algorithm the researchers used was able to identify eight emotions in novels: trust, joy, sadness, fear, surprise, anger, and disgust. So the researchers wrote equations to tell their software how to choose the right qualities to go with these emotions. Joy and trust, for example, call for higher octaves. Anger, disgust, fear and sadness get lower octaves.
Knowing all that, it’s a little easier to appreciate these ditties. The algorithms don’t do too bad of a job at all. Lord of the Flies, for example, starts out appropriately ominously, although it gets a bit difficult to interpret in the middle:
Heart of Darkness is even heavier than Lord of the Flies, especially with those repeating fifths:
Anne of Green Gables is cutesy all the way through:
Check out the rest of the pieces on the researchers’ website.
The algorithms’ creators, Hannah Davis and Saif Mohammad, imagined several future applications for a piece of software like this. Here are some examples, taken from a paper Davis and Mohammad wrote about their work:
- Creating audiovisual e-books that generate music when certain pages are opened—music that accentuates the mood conveyed by the text in those pages.
- Finding songs that capture the emotions in different parts of a novel. This could be useful, for example, to allow an app to find and play songs that are compatible with the mood of the chapter being read.
- Generating music for movie scripts. (!!)