Skip to main content
The Keyword

Honoring J.S. Bach with our first AI-powered Doodle

Article's hero media

Ever wondered what Johann Sebastian Bach would sound like if he rocked out? You can find out by exploring today’s AI-powered Google Doodle, which honors Bach’s birthday and legacy as one of the greatest composers of all time. A musician and composer during the Baroque period of the 18th century, Bach produced hundreds of compositions including cantatas, concertos, suites and chorales. In today’s Doodle, you can create your own melody, and through the magic of machine learning, the Doodle will harmonize your melody in Bach’s style. You can also explore inside the Doodle to see how the model Bach-ifys familiar tunes, or how your new collaboration might sound in a more modern rock style.

Made in partnership with the Google Magenta and Google PAIR teams, the Doodle is an interactive experience encouraging players to compose a two measure melody of their choice. With the press of a button, the Doodle then uses machine learning to harmonize the custom melody into Bach’s signature music style.
10:25

Today’s Doodle is the result of a collaboration between the Doodle, Magenta and PAIR teams at Google. The Magenta team aims to help people make music and art using machine learning, and PAIR produces tools or experiences to make machine learning enjoyable for everyone.

The first step in creating an AI-powered Doodle was building a machine learning model to power it. 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). Anna Huang, an AI Resident on Magenta, developed Coconet, a model that can be used in a wide range of musical tasks—such as harmonizing melodies, creating smooth transitions between disconnected fragments of music and composing from scratch (check out more of these technical details in today’s Magenta blog post).

Next, we personalized the model to match Bach’s musical style. To do this, we trained Coconet on 306 of Bach’s chorale harmonizations. His chorales always have four voices: each carries their own melodic line, creating a rich harmonic progression when played together. This concise structure makes the melodic lines good training data for a machine learning model. So when you create a melody of your own on the model in the Doodle, it harmonizes that melody in Bach's specific style.

Beyond the artistic and machine learning elements of the Doodle, we needed a lot of servers in order to make sure people around the world could use the Doodle. Historically, machine learning has been run on servers, which means that info is sent from a person’s computer to data centers, and then the results are sent back to the computer. Using this same approach for the Bach Doodle would have generated a lot of back-and-forth traffic.

To make this work, we used PAIR’s TensorFlow.js, which allows machine learning to happen entirely within an internet browser. However, for cases where someone’s computer or device might not be fast enough to run the Doodle using TensorFlow.js, the machine learning model is run on Google’s new Tensor Processing Units (TPUs), a way of quickly handling machine learning tasks in data centers. Today’s Doodle is the first one ever to use TPUs in this way.

Head over to today’s Doodle and find out what your collaboration with the famous composer sounds like!

Let’s stay in touch. Get the latest news from Google in your inbox.

Subscribe