Montreal

Today's Google Doodle uses AI to let you write music in the style of Bach

In honour of the composer's birthday, today's Google Doodle uses artificial intelligence to turn a simple melody into a four-part chorale arrangement.

Machine-learning model was partially developed at Montreal hub

The Google Doodle harmonizes your melody to emulate Bach's chorale arrangements. (Google)

Ever wanted to write music like Johann Sebastian Bach?

In honour of the composer's 334th birthday, today's Google Doodle uses artificial intelligence to turn a simple melody into a four-part chorale arrangement.

The machine-learning model that powers the Doodle, Coconet, was developed by Anna Huang. She's an AI resident at Google and worked on the project while she was a visiting student at the Montreal Institute of Learning Algorithms.

"I wanted to build a model that could be really flexible so that it could actually support a musician," she said.

Having studied both music composition and computer science, Huang sees the project as a way to combine her two passions.

Coconet can generate sound to bridge two musical ideas, harmonize melodies and identify the key and chord progressions used in a piece of music.

It can also change the way artists write — working alongside an AI program to create music.

Huang's AI was trained on 306 of Bach's chorale arrangements. The AI researcher says the chorales, written for soprano, alto, tenor and bass voices to sing together, work well because they are short, have distinct parts and don't move too quickly.

"They're very concise, but at the same time very rich," she said.

Anna Huang developed Coconet over three years, including while she was a visiting student at an AI institute in Montreal. (Submitted by Anna Huang)

Coconet analyzes a musical score and generates a visual representation of the music that it analyzes for patterns.

To train the AI, the researchers would remove random notes and let the Coconet fill them in, checking to see how close it could get to the original piece.

And once it understood how the harmonies worked, it started creating its own rules based on what it had learned.

The Google Doodle is also a way to make composition accessible, shrinking down the complex machine learning model so that it can work in the average web browser.

It allows people who don't think they can write music to express themselves with the help of a computer.

"We want them to feel empowered," she said.

Comments

To encourage thoughtful and respectful conversations, first and last names will appear with each submission to CBC/Radio-Canada's online communities (except in children and youth-oriented communities). Pseudonyms will no longer be permitted.

By submitting a comment, you accept that CBC has the right to reproduce and publish that comment in whole or in part, in any manner CBC chooses. Please note that CBC does not endorse the opinions expressed in comments. Comments on this story are moderated according to our Submission Guidelines. Comments are welcome while open. We reserve the right to close comments at any time.