There are many methods to build up a music generator. Deep Learning is a strong method to generate nice music pieces, however, the weakness exists that the participation of human beings is quite limited. This program will introduce a music generator built by useing Markov Chain model.
A pipeline of this system can be summarized as follows:
- The participants need to provide songs for constructing the global and local features of the songs;
- The participants need to play several notes which will act as the initial starting notes for the music generation algorithm;
- Participants are supposed to tune the parameter and the music generation algorithm will create music pieces with different k-values;
- A voting for different k-values by the participants will be arranged;
- Choose the best k-values and improve the music generation system from the crowd sourcing voting data.
Our music generator generated several different kinds of music: Chinese style, Japanese style, Blues and others. The demo of the generated songs can be viewed by clicking the button below.
I. Markov Chain Model and Adjacency Matrix
Markov Graph is built based on chords. A song can be roughly divided into intro, verse, chorus, bridge, solo, outro, etc. Different chords are used to provide different harmonic colors. Therefore, by extracting the notes corresponding to the same chords will build a Markov graph.
It might be too clastic if the system just generate the notes one by one without linking to the other notes, thus the adjacency matrix is used to improve the Markov Chain Model. The tunable parameter k-value is the order of the adjacency matrix representing the local feature, the larger k-value is, the more notes a single note will link to. According to the result, the adjacency matrix improves the music generation system significantly.
II. Improvement with Crowd Sourcing Method
Now we may get several music piecies with different k-value. Participants have already vote for them – they will choose their favorite piece among arbitrary two pieces, and that will form a preference pair (i, j), meaning that music piece i is preferred over music piece j. Convex optimization can be used to rank the data and finally get a ranked k-value series. Choose the highest rank of the k-value, and add the verse, chorus, solo parts together to form a complete song.
The codes can be viewed by clicking the button below.
Comparing the generated song and the original song, the result shows that the music generator works pretty good.
III. Turing Test
Given the original song and the generated song, the participants need to identify whether the song is written by human or computer, and which piece of music they prefer. The questionnaire survey result is shown as below:
From the figure above, a summarized results are listed as follows:
- For songs with more structural and regular melody information, like the Japanese and Chinese style music, the proposed music generation algorithm can generate beautiful music pieces;
- For songs with more rhythm, like Pop Rock, the proposed music generation with a general and simple guideline with music theory still performs well, though not as many votes as the original song;
- Specific music styles, like Blues, needs much more techniques, like triplet, beat variations and so on, rather than just the melody of a song. The proposed music generation algorithm does not perform well. This will be considered in the future work.