Algorithmic Music Generator
Fugue Generator Overview
Fugue Generator is an algorithmic music composition generator that uses stochastic Markov models to create fugues in the style of Bach. The program was written using Python and a Python library called music21 developed by MIT. I trained my model using the fugues from Bach’s Well Tempered Clavier. I did this as a class project in a little over a month with a simple goal in mind; the generator would output a three-voice fugue with one subject, an exposition, one episode, and a coda.
Fugue Analysis
The fugues from Bach’s Well Tempered Clavier are taken for analysis and datasets for melody, harmony, and rhythm are created and stored in Python pickle (.pkl) files. The melody dataset contains weighted scale degree contours, the harmony dataset contains Roman numeral chord progressions, and the rhythm dataset contains beat durations.
Fugue Generation
The program uses a Markov model to create the melody using what it learned from Bach’s fugues and algorithmically improvise the melody by implementing compositional elements like fragmentation and augmentation. Due to the limited time I had to work on this project, all of the fugues are generated in the 4/4 time signature, and the episode is generated using a basic descending second sequence.
Results
Below are some of the fugues created by the fugue generator (score excerpt and full audio).
Fugue 1
Fugue 2
Future Possibilities
It was an enlightening experience to convert human creativity into tangible machine code with my fugue generator, but I believe that I only scratched the surface of what is possible with this program and that there is more to investigate and explore about machine learning and music generation. Using deep learning and advanced computational methods, it is certainly possible to create a comprehensive fugue generator that could creatively compose various fugue types in different meters, number of voices, more episodes, and far more musicality than the current fugue generator achieved.