Google created its first ever Artificial Intelligence (AI)-powered doodle to celebrate German composer and musician Johann Sebastian Bach’s 334th birthday.

The doodle, which went live Thursday, was made in partnership with the Google Magenta and Google PAIR teams, in such a way that it provided an “interactive experience encouraging players to compose a two measure melody of their choice.” Furthermore, users could also harmonize the custom melody into Bach’s signature music style with just a press of a button.

And it was all done using a machine learning model. “Machine learning is the process of teaching a computer to come up with its own answers by showing it a lot of examples, instead of giving it a set of rules to follow as is done in traditional computer programming. The model used in today's Doodle was developed by Magenta Team AI Resident Anna Huang, who developed Coconet: a versatile model that can be used in a wide range of musical tasks—such as harmonizing melodies or composing from scratch,” Google explained in a blog post.

Anna Huang, a resident AI researcher with Google’s Magenta project, told The Verge that the fact Bach was a composer of Baroque music, which used consistent rules, made it easier for AI to learn composer’s techniques. “The Bach compositions in this dataset are highly structured, and the style is very concise, yet with rich harmonies, allowing machine learning models to learn more with less data,” she said.

The painstaking process of creating the doodle was recorded in a behind-the-scenes video, posted on YouTube:

Apart from composing music at a prolific pace during his time, Bach also mastered the process of building and repairing the complex inner mechanisms of pipe organs. The 19th century was known as “Bach revival" when the music world found a renewed appreciation for the composer's work. 

His personal life was as interesting as his professional achievements. He was married twice in his lifetime, first to Maria Barbara (1707–1720) and then to Anna Magdalena (1721–1750). He had a total of 20 children from both marriages. Unfortunately, only 10 of them made it to adulthood. Four of his six sons who survived went on to become notable composers in their own right.

Wilhelm Friedemann Bach, his oldest son, worked as an organist at the St. Sophia’s Church in Dresden. His father had written him a graded course of keyboard studies, called the “Klavierbüchlein für Wilhelm Friedemann Bach.”

Arguably the most talented of Bach’s sons was Carl Philipp Emanuel Bach. Among his achievements were writing the essay, “True Art of Keyboard Playing,” being appointed court musician to Frederick the Great and composing original symphonies and choral music that enriched the world of classical music. “He is the father, we are the children,” Mozart said of Carl. 

Johann Gottfried Bernhard Bach was the least successful of the bunch. He attended the University of Leipzig but dropped out. He ended up getting a job as a harpsichordist at Bückeburg. Later in life, he collaborated with philosopher and poet Johann Gottfried Herder, on some vocal work.

Johann Christian Bach, the youngest son, was only a teenager when his father died. He went to Italy and converted to Roman Catholicism and became an organist at Milan Cathedral. He came to be known as “The London Bach” after he moved to England and began working for Queen Charlotte.