If you’re like me, you know that there’s never “enough Bach” in one’s life and you can always tap into infinite musical curiosities based on Bach. Using Artificial Intelligence methods such as deep learning to “train” computers for music composition is one of the fascinating recent trends in this area, and applying these automated, statistical methods to Bach chorales is an active topic of research with interesting results. The book by David Foster, “Generative Deep Learning – Teaching Machines to Paint, Write, Compose, and Play“, has a chapter dedicated to using generative deep learning methods such as MuseGAN for music composition, and explains how such “generative” models can be trained on Bach’s real polyphonic compositions to output new musical pieces in the style of Bach.
Below is an original piece created by the Generative Adversarial Deep Learning Network (GAN, in particular the famous MuseGAN network architecture). The MuseGAN deep learning network system was able to create this after training for only 1000 epochs on a moderate laptop for 2 hours (without using GPUs), based on the data set at https://github.com/czhuang/JSB-Chorales-dataset (a set of 229 Bach chorales). In other words, this is definitely not representative of what Deep Learning can achieve as best because such a system can be easily trained for longer on much more powerful systems (see further examples below). The focus of these examples is the fact that you can also start to experiment with deep learning systems that start to model musical aspects without explicit musical teaching, hard-encoded rules in software, etc.
You can click on the image below to visit SoundCloud and listen to MP3 file generated by MuseScore.
Among the actual Bach chorales in the data set, the “closest” one to the artificially generated example (“close” in the sense of Euclidean distance) can be seen below.
Running Foster’s examples, and changing the “noise vector” that encodes the chord-related aspects, and keeping “style”, “melody”, and “groove” noise vectors the same for gan.generator.predict function, we get:
Similarly, changing only the “style noise vector”, a sample output is
Changing only the melody noise vector, an example result is:
and finally changing groove noise vector:
In the beginning, I wrote there’s no such thing as “enough Bach”. And therefore you can compare the previous examples with a Google Doodle dedicated to a very similar task: harmonizing a few bars of notes in the style of Bach chorales, using deep learning neural networks. Careful readers will realize that I took first voice of the original Bach composition above to see how Google’s deep learning system would “complete” it by adding 3 more voices below. You can listen to it at http://g.co/doodle/prvuk
Of course, Google isn’t the only technology giant dedicating brain and compute resources to further the legacy of Bach. Another big player, Sony Computer Science Laboratories also worked on polyphonic music generation in the style of Bach, demonstrated by their DeepBach system. You can read more about Deep Bach by Flow Machines at http://www.flow-machines.com/history/projects/deepbach-polyphonic-music-generation-bach-chorales/ and interactive music generation at Sony at https://csl.sony.fr/project/interactive-music-generation/
Now I wonder what Kemal Ebcioğlu would think about these new approaches and results, because in his PhD thesis published in 1986, he describes his CHORAL system, built as a purely symbolic system using BSL, a new logic programming language that he also designed to encode constraints and rules for Bach-like harmonization of four-part chorales. I also wonder what David Cope thinks, because he’s the creator of one of the most famous symbolic music composition systems, named “Emily Howell“; you can see one of the compositions generated by Emily below:
I’m sure the new year of 2020 will bring us even more surprises in the intersection of music, AI and Deep Learning, because as you are reading these, music researchers, performers and programmers are busy applying such methods to Beethoven’s unfinished 10th symphony, to be premiered in Bonn on 28 April, 2020.
Meanwhile, thanks to available data sets, open source deep learning libraries and applications, and relatively cheap and easily available computing facilities such as CoLab and similar ones from AWS and Microsoft Azure, we’ll continue to experiment with even more interesting examples of computer-generated music and other types of art.