Thursday’s Google Doodle celebrates Johann Sebastian Bach with its first artificial intelligence-powered doodle. (Google/AP)
Classical music critic

You, too, can compose like Bach. Or rather, artificial intelligence can compose like Bach. Or at least, that’s the premise of Thursday’s delightful Google Doodle, which promises to take any two-bar melody you type in and turn it into a Bach, or Bachlike, chorale in four parts, played by charming little music-box figures of bewigged 18th-century musicians.

It may only add to the doodle’s charm that what it actually proves is the opposite of what it sets out to do. Nobody can compose like Bach. Especially not a machine. You already knew that. But you can have a lot of fun along the way to finding it out.

Music and math, according to stereotype, tend to group together in people’s brains. This doodle is an example of the limitations of that premise. It was certainly a technological feat that required a whole team of engineers. Three hundred and six Bach chorales were fed into a machine-learning model, called Coconet, which used the data to inform the generation of its own harmonizations. (Coconet can even compose from scratch, as the team of developers explains in an impressive blog post, which includes sound samples that are considerably more convincing than the snippets generated by the Google Doodle.)

But what happens when you actually type a melody into the doodle is, well, akin to most of the random-generator programs online that allow us to create poems or stripper names or other diversions. If you’re not confident about writing yourself, the doodle offers two familiar tunes, “Mary Had a Little Lamb” and “Twinkle, Twinkle, Little Star,” on which it perpetrates a range of variations, each time different, and some of them downright horrible. As for Bach’s style, the harmonies may have specific evocations of specific Bach works, but they don’t sound very much like Bach at all — even when you type in one of Bach’s own melodies as a starting point.

Musicians and musicologists on Twitter had a lot of fun playing with the thing all day.

“Throw in a chromatic melody and pump up the tempo to 100 beats per minute and you get a reasonable facsimile of Hindemith,” wrote a user named ninedragonspot.

The question of how far music and musical style are quantifiable is an ongoing issue in artificial intelligence. Gerhard Widmer, a scientist in Austria, has been working for decades experimenting with teaching computers to isolate elements of style in performance, in projects with names such as “Computational music performance research.” As long ago as 2003, he and his team gave a computer 13 recordings of Mozart piano sonatas and had the computer generate a performance of a different sonata, played in the same style as the pianist. It won a prize at a contest for computer piano performance rendering. But that doesn’t answer the question of whether it was actually pleasing to the ear.

This is not to rag on the doodle, which admirably fulfilled its purpose of getting people to talk and think about composition in general, and Bach in particular, a few days before his 334th birthday. The goal, according to Leon Hong, a member of the Google Doodle team, in the accompanying video Google released about the project, is “combining art with technology and allowing people to create things they couldn’t create before.” Asking whether the thing thus created is worthwhile is perhaps beside the point.