Digital Kenyon: Research, Scholarship, and Creative Exchange

IPHS 300: Artificial Intelligence for the Humanities: Text, Image, and Sound Digital Humanities

Fall 2018

RNN monophonic sheet generation with LilyPond

Seth Colbert-Pollack Kenyon College, [email protected]

Follow this and additional works at: https://digital.kenyon.edu/dh_iphs_ai

Recommended Citation Colbert-Pollack, Seth, "RNN monophonic generation with LilyPond" (2018). IPHS 300: Artificial Intelligence for the Humanities: ext,T Image, and Sound. Paper 2. https://digital.kenyon.edu/dh_iphs_ai/2

This Poster is brought to you for free and open access by the Digital Humanities at Digital Kenyon: Research, Scholarship, and Creative Exchange. It has been accepted for inclusion in IPHS 300: Artificial Intelligence for the Humanities: Text, Image, and Sound by an authorized administrator of Digital Kenyon: Research, Scholarship, and Creative Exchange. For more information, please contact [email protected]. RNN monophonic sheet music generation with LilyPond Seth Colbert-Pollack [email protected] AI for the Humanities, Fall 2018, Kenyon College

Abstract Training the model Criticism continued I trained a model using the Python package textgenrnn using the method of Max The commenter goes on: Computers are well suited to tasks such as data categorization and labeling. Woolf [6]. After experimenting with some smaller models, my final model had 3 More challenging is data “generation”, a problem in which recurrent neu- “What. . . is much more interesting is to generate new music that can- layers with 128 long short term memory, or LSTM cells in each layer, and ral networks (RNNs) and more specifically long short-term memory networks not be composed by a human, and cannot be played by a human. That’s was trained character-by-character, considering the previous 40 characters each (LSTMs) have made significant progress in the past few years. In this project, playing to the strength of the machines. Sonification of large datasets, time before predicting a new one. After training for 20 epochs, I had some mod- I train an RNN on a database of classical sheet music, and use it to generate sonification of function behaviour. Sonification of the binary world, that’s erately coherent results. The LilyPond code which the network produced was not new sheet music. so different to ours. This is much more interesting than the 10th failed anywhere near compilable, but it did contain fairly lucid passages which could be emulation of a simple folk .” —iammyIP [3] considered melodic voices. It would be fair to say the results looked like they came I find this critique valid. I envision the tools available, including the one I used in Recurrent Neural Networks from a human who had just learned how to use LilyPond—that is, couldn’t use it very well—but was very enthusiastic. I took these and compiled them this project, to be not a replacement for, but a supplement to, human creativity. Simply recurrent neural network network or RNN is a system for generating into sheet music on their own. Frankly, the music my model is generating is not really valuable enough to inspire some output based on some input which the network has been trained on. The better human composition. But that does not mean the project was a failure. inputs (in our case, text represented as numbers), shown on the left in the diagram Results below, are multiplied by some values, represented as arrows. These products are Future Work added together, giving us the values in the left hidden layer. The left hidden layer I generated 80KB of data from the model. The resulting LilyPond code was rec- ognizably LilyPond-like, but would require a lot of editing and cleaning up to performs some calculations and passes the results to the right hidden layer. The There are many possibilities to explore which would likely improve the model’s compile. right hidden layer then produces an output (in our case, a character) as well as music generation. ! s2.*4 | s2.\< s8 | s2\dures bes8 s4. \stemDown r8 32. 8