Art Creative Process Current events Media and Technology Publishing technologies

(How) can a computer produce Bach chorales and Harry Potter books?

My discovery of the Google Doodle which celebrated the music of Johann Sebastian Bach started me on the road to composing and producing my own music. (Don’t know what a Google Doodle is? You’ve gotta be kidding me. Just ask Siri or Google it…)

I first published a post about the “J.S. Bach Doodle” on March 24, 2019 (the post is below). The “Bach Doodle” was the first Artificial Intelligence type of Doodle used by Google. Since then, the Bach Doodle has proved to be useful for teaching and researching music, and entertaining for music lovers of all ages, despite the outrage from some experts about the scandalous reinterpretation of Bach’s music used in the app.

The developers have reported that “…in three days [after the Bach Doodle’s launch on March 21, 2019], people spent 350 years’ worth of time playing with the Bach Doodle, and Coconet [the machine learning model behind the Doodle] received more than 55 million queries. Users could choose to rate their compositions and contribute them to a public dataset.” That’s just in the three days following the launch. Imagine how much data they have collected from users now, after slightly more than two years.

In the months after the publication of the Bach Doodle, I used it to piece together some bars of music to use in my own compositions. There I was, trying to make music out of a few MIDI (Musical Instrument Digital Interface) files of Bach-sounding notes in Garageband – what a complete idiot I felt, struggling like that. However, to quote the acclaimed singer-songwriter St. Vincent,

“Theory gives language to what you can already hear.”

– St. Vincent, Masterclass

By fiddling with those little Bach Doodle files, I learned there are things like notes, staffs, bars, keys, chords, etc. I learned to listen to J.S. Bach’s music with new understanding, and as my ears sharpened, and I acquired more of the language of music, I could finally express the music that I had had in my head for years.

The Bach Doodle two years later

Today I checked on the availability of the Bach Doodle app, and found out that it can now only be run on Google Chrome (link here). (If you type in “Bach Google Doodle” or “Celebrating Johann Sebastian Bach” into Google Chrome, a link will come up. The “little” app, which is neither little nor simple, was a research project and not created primarily to help or entertain the public. So, like with all freebies, no matter how useful, one cannot expect it to stay available and functional ad infinitum. But today, it still is.

The Bachinator: Better try it before it disappears.

Something similar which launched this year, also from Google Arts and Culture, is Assisted Melody, a sound experiment in which you can also create a few notes, with the software running behind the app changing them into a Bach-like form. It also only runs on Google Chrome, but you cannot download the sound file that you have created as a handy MIDI file, only link to the website. That’s not half as useful or as much fun.

Hopefully, the “Bachinator”, as I call the Bach Doodle, will always be there for me to experiment on. For now it’s still available online, gathering the data from millions of users and uses. It seems to me that it produces a nicer-sounding result than Assisted Melody, because it has been going on longer, and the more data that is available for a computer program to learn from, the better the output gets.

Apart from Assisted Melody, Google Arts and Culture has since launched a raft of AI-based “games” with which users can generate sounds or images. Bearing in mind why they created them, they are nevertheless quite interesting and entertaining, even for adults, for instance “Blob Opera”. (Try it here on Google Chrome.)

Blob opera, by Google Arts and Culture. C’mon, I know you’re dying to try this.

However, despite the fun I am having, the question remains: can a computer produce real art and literature? Or, can a person produce real art and literature using a machine-learning-based program?

Below is my original post about the Bach Doodle and computer-generated art and writing, recently updated.


Google Doodle, Inspirobot, Botnik, and DeepArt

March 24, 2019 – updated May 5, 2021

Computer-generated artistic text and images tend to resemble FrankenArt and FrankenFiction. Using machine learning, designers can build software programs that can generate text and images of various kinds – but the results vary from the sublime, to the ridiculous, to the positively weird.

Machine-generated text includes paragraphs written in the style of specific authors, snippets of “philosophical” sayings, or even scripts. Machine-generated images include “paintings” in the style of famous artists, generated from a photo, or – vice versa – realistic photos of landscapes generated from rough drawings. Anything is possible these days. And in addition to text and images, an interactive Google Doodle this week allowed users to generate snippets of music that sound like something Johann Sebastian Bach would’ve composed. Some classicists in the music world were highly offended.

I believe that these machine learning-based apps are here to stay. Here are a few of the more entertaining ones – Google, Inspirobot, Botnik, and DeepArt. [Update, May 2021: since this post, many more of these creative apps that use machine learning have been launched, including some that generate song lyrics, for instance.]

What is the point of these programs?

The point of these programs to generate “art” is that they serve, as DeepArt’s founders say, to help people get creative and share what they have made. The programs are not intended to replicate what master artists have done. No machine learning program ever can.

A machine learning program works by analyzing the data that is inputted, and finding patterns, and generating output according to those patterns. The more data is inputted, the more material the program has to “learn” from (which is why the interfaces invite users to “share” their creations) but once the fount of data about the original artwork is exhausted, all that is left is the data about the copycat art of the imitators, which is added to the database from which the computer “learns”.

The point to remember with all these programs is that is is always a case of “rubbish in, rubbish out”. As with all software, the output is only as good as the input.

1. Bach Google Doodle – Music

On March 21, 2019, to celebrate the life and works of Johann Sebastian Bach, Google released a fun Doodle which allowed people to key in a few notes on-screen, which their AI program would then convert to something sounding like a Bach composition.

First you put down a few notes for a melody, in a four-part chord, and then the program harmonizes it by adding Bach-style soprano, alto and tenor notes. And voila! – something that sounds like…Something Bach-ish!

Cute gif by the developers of the Google Bach Doodle. Thank you!

Just a wee taste of how wonderful it is

For someone like me, who knows a handful of languages but cannot read or write musical notation, and plays the piano by ear, this was an absolute wonder, a wow!  moment that allowed me, musical dumbo that I am, to “make” something that sounded unusually like classical music, and what’s more, keep it, in the form of a teeny midi file. And what’s even more, I could see which notes did what. First I did not realize that you could put 4 notes into – what was it? – a “measure” on a “staff”, the thingie with lines. So I figured out what the 4/4 at the beginning meant. It was a huge learning curve for me, and I played with it most of the day.

Screenshot of the Google J.S. Bach Doodle interface, after me having submitted one of my experiments to add to the AI database. See? It says “Thanks!”

Eventually, because I like the sound of it, I made something with my various snippets of “Bach Chorale” on GarageBand on my Mac. Below is the result of my further fiddling. Hey, it’s not much but it’s the first piece of music I have ever created and recorded! The first, ever!!

My first creation – do not smirk. I did not know anything about music.

It led me to understand the further reasons for these kinds of apps: I got a flash of insight into how complicated, ingenious, effortful and wonderful real musical composition is. (And how genius Hip-Hop is! Breaks, stringing up loops and layering sound!! Yes, like Andy Cooper and The Allergies!)

I realized that music is a language I would need to learn, and that it would perhaps be possible to learn it without being mathematically inclined. This app, like the others, prove that making art is something everyone can aspire to. You need to learn, but it can be done.

Like a poem that doesn’t quite do what you want it to do, and doesn’t sound quite right, your machine-produced music, images and narrative passages are just the starting point of something bigger, better and more beautiful. They are the start of a long learning path.

2. Inspirobot – Philosophy

A  strange saying generated by Inspirobot today (May 5, 2021, update). There’s some logic to that? Maybe?

Inspirobot is just that – an AI program (robot) that generates “inspirational” random but often very weird and wrong sayings, quotes, idioms, etc.: As the website says: “I am an artificial intelligence dedicated to generating unlimited amounts of unique inspirational quotes for endless enrichment of pointless human existence.”

Link here to the Inspirobot app to generate a saying.

Like typical machine learning programs,“…Inspirobot is a ‘generative’ system.  It has learned the basic rules behind motivational quotes and how to ‘fill in the blanks’ — and, since the materials for filling in the blanks is unreasonably large, it will rarely repeat itself (and almost never do so exactly).  

On the other hand, by examining enough Inspirobot phrases, we can recognize the general structure that Inspirobot learned by its regularities and repetitions — both exact and generalized — and then tease out how it was taught.”

Black Box Files: How Does Inspirobot Do Its Thing? (Generative Systems), on Steemit.com, rtrvd. 2019-03-23

Inspirobot on Instagram

Inspirobot’s account on Instagram is still going after many years. [Update: as of May 5, 2021, 95.5k followers. They are definitely active.] What is noticeable is that as the program learns and its language database grows from the continued input from users, the sayings from Inspirobot become less and less nonsensical and more and more plausible. The messages by now sometimes look like greeting card messages. Yes, sometimes the wheels come off entirely, and the messages are either about sex or advice to be violent. Humour of course, is partly based on fear, so that kind of dark thing does amuse people.

Screenshot of the Inspirobot Instagram page: Bottom left, not so mundane. The rest, either self-explanatory or possibly true (bottom, right).

3. Botnik – Fiction


“Botnik” is a ‘a human-machine entertainment studio and writing community’, and the community members include head writer Jamie Brew, and former New Yorker cartoon editor Bob Mankoff. It launched in 2017. The predictive text keyboard is the community’s first writing tool. It works by analyzing a body of text to find combinations of words likely to follow each other’ based on the grammar and vocabulary used. In other words, it uses a predictive algorithm – based on the data in the program, the algorithm predicts which words follow which words, and which words and punctuation go where.

In other words, the program uses standard machine learning to generate text and keep improving the output. The text can be all sorts, generated from a “voice” or style of writing, that runs the gamut from Leonard Cohen to Jeff Bezos. (Link to the Botnik “writer” here.) Google defines machine learning as:

“…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 results generated in Botnik are predictably odd. It looks like English, and makes sense in a way, but falls apart when you drill down. Machine-generated language output is based on dissecting and converting human-generated language which is naturally convoluted, abstract, non-systematic and driven by factors other than grammar rules, for instance emotion, individual understanding and intention, dialectical variations and genre or form.

Human language is as complicated as the human brain and human thought, and it is an unreachable goal to machine-generate human language at the same level of complexity and accuracy. It’s impossible to do it for one human. Imagine how utterly impossible it is to do it for all users of a language. But nevertheless, people try.

Link here to the Botnik app.

If you use this type of machine text generation for text that is per definition non-standard, with reference to non-standard things, such as Fantasy fiction, then it works better. For the same reasons, it would also work for generating poetry. However, at the core of a machine-generated text is that the unique, personal and highly cohesive vision of the author is missing. The authorial presence is missing, in other words. This means that, ultimately, machine-generated text can be useful for factual communication but not for creative writing. Yet.

Botnik, though it has produced TV scripts that look like they can be used for TV shows like Scrubs and Seinfeld, has also produced a brief Frankenfiction chapter (just one chapter) of something that looks like it could have come from a Harry Potter novel. It’s called Harry Potter and the Portrait of What Looked Like a Large Pile of Ash. It’s a bit mad, but in a weird way, also…plausible?

This looks and smells like a Harry Potter book because J.K. Rowling’s writing style is quite formulaic, with typical and standard expressions, a predictable structure, and a well-known word list of all the characters and things that she invented for this constructed world. As with any machine-generated program, the nouns, verbs, adjectives, etc. (the “notions”, to use an old Linguistics term) get slotted into standard sentence forms, like questions and statements (the “functions”). The trick is to make the different parts of the sentence hang together correctly because where different parts of the sentence are, and how they are connected, determines the meaning. That’s syntax and semantics for you – a pain in the patootie.

Since this first chapter, many more “Harry Potter-like” texts have been generated on Botnik.


4. DeepArt – Paintings

The mission of the creators of DeepArt, is

“… to provide a novel artistic painting tool that allows everyone to create and share artistic pictures with just a few clicks. We are five researchers working at the interface of neuroscience and artificial intelligence, based at the University of Tübingen (Germany), École polytechnique fédérale de Lausanne (Switzerland) and Université catholique de Louvain (Belgium).”

Source: DeepArt.io

The app is still alive and kicking at May 2021. You upload a photo that you took, choose a painting style, say Pointillism or Pop Art, and the result is a photo that looks like it was painted in the style you preferred. (Three examples, below.)

Art, even more so than literature, cannot be machine-generated. This app is just for fun, and for encouraging an interest in related subjects.

The bottom line

Inspiration, creativity, context, emotion and unique personal experience, all of which shapes what an artist produces, cannot be replicated by a machine, and therefore a machine, like an animal, cannot produce true art. That being said, Google’s Bach Doodle was a fun way to get closer to the art of a maestro.


PS: How did Google do it, by the way?

The Bach Doodle was the first ever AI-powered Doodle featured on a Google home page. It was made in partnership with the Google Magenta and Google PAIR teams. The first step in developing the Doodle was to create a machine learning model to power it. The model used in the Bach Doodle was developed by the Magenta Team’s AI engineer Anna Huang. The model is called Coconet (Counterpoint by Convolution), and it can be used in a wide range of musical tasks—such as harmonizing melodies or composing from scratch.

As the developers explained, Coconet was trained on 306 of Bach’s chorale harmonizations. His chorales always have four voices, each carrying their own melodic line, while creating a rich harmonic progression when played together. This concise structure made them good training data for a machine learning model. Next, the Google PAIR team used TensorFlow.js to allow machine learning to happen entirely within the web browser (versus it running utilizing tons of servers, as machine learning traditionally does).