Recurrent neural network model for music generation

O.C. Komarskiy, А.Yu. Doroshenko


The paper considers the possibility of generating musical compositions using recurrent neural networks. Two approaches to the generation of musical works are proposed and considered, namely using the method of notes and the method of chords. The research of both methods was carried out, and their advantages and disadvantages were formulated. As a result it was decided to use the method of notes as the main one for music generation. The process of searching and processing data for learning a music neural network is described
in detail, the algorithm for converting data from MIDI format to your own text for use in a neural network is considered in detail. The learning process of the neural network was also described, and the learning speed was compared using GPUs and CPUs, as a result of which it was determined that learning
takes place faster using a graphics processor,  in some cases 5.5 times. As a result of testing the operation of the neural network, it was determined that the optimal characteristics of the recurrent neural network for music generation is a network consisting of 4 LSTM layers, each with a dimension of 600 neurons. As music generation cannot be assessed by objective characteristics, a special focus group survey was conducted to assess quality. It shows that music generated by a neural network received almost the same marks as music. written by a man. It should be considered as a great result. It was also determined that it was difficult for the survey participants to correctly identify the author of a musical work, since they correctly identified the authors in only 58% of cases. The proposed solution allows to easily generate musical compositions without human intervention.

 Problems in programming 2022; 1: 87-93


music generation; machine learning; recurrent neural networks; LSTM; RNN


Nierhaus G. (2009) Algorithmic Composition - Paradigms of Music Generation. Springer, Vienna. pp. 7-66.

Wasserman P. (1992) Neural Computing : Theory and Practice. pp. 180-185.

Callan R. (2001) The Essence of Neural Networks. pp. 50-65.

Nielsen A. (2015) Neural Networks and Deep Learning. p. 111.

Kandel E., Schwartz J., Jessell T. (2000) Principles of Neural Science 4th Edition. pp. 283-302.

Introduction to MIDI and Computer Music. URL:



  • There are currently no refbacks.