Esto también se puede leer en español.

Leer en español

Don't show this again

AMD Radeon RX 6800 XT Daylight Saving Time Ring Video Doorbell Pro Walmart Black Friday Cyberpunk 2077 delayed Section 230 Senate hearing Halloween blue moon

Google Doodle taps AI to unleash your inner Bach

Harmonizing in the style of the great Baroque composer made easy, thanks to machine learning.

Harmonize with Johann Sebastian Bach.


If you've ever listened to classical music and thought, "I could write that," Google has the key to your success.

To mark the 354th birthday of renowned German composer Johann Sebastian Bach, Google on Thursday launched its first-ever artificial intelligence-powered Doodle, which harmonizes a melody of your own creation into Bach's Baroque style of music. Widely regarded as one of the world's greatest composers, Bach produced hundreds of compositions, including cantatas, concertos, suites and chorales, over his lifetime.

Bach already had a great deal of musical knowledge close at hand when he was born in Eisenach, Germany, in 1685. His family included 50 known musicians and several notable composers.

But you and I most likely need a little help to create compositions that sound like Bach's Art of Fugue or Brandenburg Concertos. So Google used machine learning to analyze more than 300 Bach compositions, and with the push of a button, the Doodle will use what it's learned to transform your two-measure melody into Bach's signature style.

Composing Bach, made easy with machine learning.


Within the interactive experience, you can start with simple existing melodies, change the key of the composition and even listen to your composition with a modern rock twist.

The use of AI is spreading like wildfire across the tech industry for everything from speech recognition to spam filtering. The term generally refers to technology called machine learning or to neural networks that are loosely modeled on the human brain. Once you've trained a neural network with real-world data, it can, for example, learn to spot a spam email, transcribe your spoken words into a text message or recognize a cat.

Helping out the Google Doodle team on this project were Google's Magenta and PAIR teams. Magenta is an artificial intelligence effort to create original music and visual art, while PAIR (People + AI Research Initiative) examines the relationship between humans and artificial intelligence in the hopes of making the latter more useful to the former.

The task of creating a machine learning model to power the Doodle fell to Anna Huang, an AI resident with Magenta. She developed Coconet, a model that can perform a wide range of musical tasks, such as harmonizing melodies, smoothing transitions between disconnected fragments of music and composing from scratch.

Coconet was then trained to match Bach's musical style on 306 of Bach's chorale harmonizations. Bach's chorales always have four voices (soprano, alto, tenor and bass) that create a rich harmonic progression when played together. The nature of this structure made for good training data for the model, allowing Coconet to harmonize your melody in Bach's specific style. Google shared more about the process in a "Behind the Doodle" video.  

This isn't the first time a Google Doodle has let us fiddle with virtual music. In 2011, Google celebrated the musician and electric-guitar innovator Les Paul with a playable and recordable guitar. A year later, Google gave us a virtual synthesizer to celebrate American engineer and electronic music pioneer Robert Moog.

But this was a much larger undertaking, requiring much greater resources. Machine learning typically occurs on a lot of servers, with information being sent from a user's computer to a data center and back to the user's computer.

To better handle all the back and forth that would be generated by the interactive Doodle, the PAIR team used TensorFlow.js, a JavaScript library that allows machine learning to occur on the user's browser. For computers not fast enough to run the Doodle on TensorFlow.js, Google's TPUs (tensor processing units) are used to serve up the Doodle. This is the first time the custom processors that speed up AI tasks have been used in a Doodle.

Take note: When your composition is harmonized in Bach's style, you'll have the option of sharing it with friends and even giving it feedback on your masterpiece, which will help improve the machine's performance.

The Doodle will remain on Google's search page for two days in most of the places it's appearing.

Originally published March 20.
Update, March 21: Adds "Behind the Doodle" video from Google.