Johann Sebastian Bach is widely considered one of the great composers of baroque music. Bach lived and worked in Germany during the 18th century and is revered for the beauty of his compositions and his technical mastery of harmony and counterpoint.
One form of music that Bach excelled in was a type of polyphonic hymn known as a chorale cantata. These are based on Lutheran texts and sung by four voices. The composer starts with a well-known tune which is sung by the soprano and then composes three harmonies sung by the alto, tenor, and bass voices. Bach wrote over 300 short chorale compositions.
These compositions have attracted computer scientists because the process of producing them is step-like and algorithmic. But doing this well is also hard because of the delicate interplay between harmony and melody. That raises an interesting question: could a machine create chorales in the same style of Bach?
Today we get an answer thanks to the work of Gaetan Hadjeres and Francois Pachet at the Sony Computer Science Laboratories in Paris. These guys have developed a neural network that has learned to produce choral cantatas in the style of Bach. They call their machine DeepBach (see also “AI Songsmith Cranks Out Surprisingly Catchy Tunes”).
The machine-learning technique is straightforward. Hadjeres and Pachet begin by creating a data set to train their neural network. They begin with 352 chorales composed by Bach and then transpose these to other keys that lie within a predefined vocal range, to give a data set of 2,503 chorales. They use 80 percent of these to train their neural network to recognize Bach harmonies and the rest to validate it.