Gaetan Hadjeres and Francois Pachet at the Sony Computer Science Laboratories in Paris created DeepBach, then entered Bach's 352 chorales. The resulting composition is certainly in the style. So why does this work better than some other attempts?
Part of it is the sample size of compositions. Another part is the chorale's formal structure (four voices, simple patterns of notes and harmonies). Once they had their composition, they asked 1600 people, 400 of whom were professional musicians, to guess if a tune was Bach or DeepBach. According to MIT Technology Review:
The results make for interesting reading. When given a DeepBach-generated harmony, around half the voters judged that it was composed by Bach. That’s significantly higher than with music generated by any other algorithm. “We consider this to be a good score knowing the complexity of Bach’s compositions,” say Hadjeres and Pachet. Even when confronted with music composed by Bach himself, participants only judged that correctly 75 percent of the time.
• Deep-Learning Machine Listens to Bach, Then Writes Its Own Music in the Same Style (MIT Technology Review)