**This section of blog written in August 2016:**

My new novel, *Eternal Sonata* (publication date October 4, 2016), imagines a future global struggle to control the science of extreme human life extension. In the novel, a brilliant scientist working to honor the memory of his late wife by curing cancer develops a process for cellular reversion that unlocks the key to immortality. While he works tirelessly on his research, he fills his lab with a fictional Bach “eternal sonata,” a metaphor for both his enduring love for his scientist/musician wife and for the human quest to live forever. Here is how the scientist describes an “eternal sonata” to the person visiting his lab:

“It’s not a pure Bach sonata. It’s an eternal sonata, a variation on *all* of the *Sonatas de Chiesa*, using Bach’s same fractal formulas but extending the mathematical variation *ad infinitum*. If Bach had written his sonatas to go on forever, each melody embedded with the mathematical formula guiding the whole, this is probably what they would have sounded like, all thanks to the miracle of quantum computing.”

In the run-up to the launch of the book, I wanted to see if it might be possible to actually create an eternal sonata and reached out to a Brilliant Bach professor at Julliard who, in turn, connected me with one of his students. The student, both a composer and a coder, volunteered enthusiastically and threw himself into the project.

A couple of months later, I received the following note from him:

I’ve been working on this a lot, and am starting to think the goal is less practical than expected (shocker, I know…). Not sure if you have leads on other musicians, but I might not be able to do this.

In any case, this is what I have as of now; maybe it’s possible to imagine the result:

– It is most practical to write in three voices, rather like Bach’s organ sonatas.

– The higher two voices imitate each other, with the lowest developing its own accompanimental motifs, and referencing the “head-motif” of the higher voices (this is tricky to implement).

– The movements alternate fast and slow tempos. The first movement is fast. All fast movements are in the home key. Slow movements are in the relative major/minor, or in major or minor V (the choice can be random).

– Not every movement ends in the home key. Maybe every other slow movement and every third fast movement ends in either V or V of the next movement’s tonality.

– Slow movements are all of the same form, with the first and second half repeated. If the ending is not in I, there should be a second ending. Ornamentation follows the model of CPE Bach (this is also tricky to analyze and implement).

– Fast movements are in one of these two forms (chosen randomly): Same as the slow movements, though with less ornamentation; similarly bisectional, but without repeat, and not stopping after the modulation.

– There are some numerological items Bach was fascinated in, and they can be interpolated into the list of requirements (mostly, they concern the number of measures).

– What makes this piece a single sonata then, rather than a bunch of movements? There is a second layer of development, featuring the continuous variation and obscuration of a hymn-tune (perhaps the tune from Gottes Zeit ist die allerbeste Zeit—*God’s time is the very best time*, in which the tune is *In you have I hoped, Lord*). This provides seriousness, and links the whole as an outpouring of thoughts on death and time passing (this is very tricky to implement).

– As well, there is a sense of continuous development over the whole piece, which might be motivic.

Beyond these guidelines, I wanted to let the computer do the composing, which would take place bit by bit as sections are needed. The biggest problems as of now are:

– Getting the “composer” to work correctly. It’s really a coding problem more than a musical problem, and as such is buggy. Because I don’t code professionally, the code is clunky and inefficient, more about that in number 3.

– Getting the large-scale structure to “work”. It would be nice if the piece sounded right at the end…

– Producing music quickly enough. This is the real trick; as of now, individual measures come laboriously. Eventually, I would need to produce music quicker than one listens to the music. I think this is impossible; with a long piece, one could simply push back a deadline, but I would need to push it back *infinitely*.

– Eventually getting the program to run itself, producing music forever, including once we’re dead. I have no ideas.

Not sure if you have any ideas about these problems? I’m starting to run out of solutions.

Not to be deterred, I send the student’s note to a friend who works in one of the world’s most high profile artificial intelligence projects in one of the world’s most famous companies and asked for his suggestions. Here is what he replied:

**I believe you and your Julliard colleague should think about the endless sonata use case as follows:**

**Input A: Julliard student’s observations of each composition (structured and/or unstructured data sets)**

**Input B: Listener favorability of each composition (e.g., “who likes what”)**

**Output A: Mathematical pattern/compatibility ranking of all possible combinations of compositions**

**Output B: Auditory quality ranking of all possible combinations of compositions**

** Insight #1: An endless sonata mathematically looks like….**

**Insight #2: An endless sonata sounds like….**

**Insight #3: A combined sonata ceases to become favorable when….**

**Insight #4: A combined sonata remains favorable if….**

Armed with this additional information, I went back to the student and asked him to take another crack. Two months later, I received the following message:

Hi, I spent the weekend (more like a whole week, actually) with a small team of slave-laboring CS students at Columbia, trying to work out the code. We came to a few conclusions:

– The project is definitely *possible*, because we managed to get the computer to “play itself”, and to write code without intervention (most people get really excited when a computer can write code itself, because artificial intelligence and all, but this is a very idiosyncratic intelligence, if in fact it has any. If you ever want to write a book about a robot takeover, this is probably not the droid you’re looking for).

– We’d need maybe five years of nearly full-time work. This is really non-negotiable, because there is a lot of grunt work involved in defining musical parameters (musicians are taught in school “don’t write with parallel fifths”, “don’t double a leading tone”, et cetera. If you want to teach a computer those, you first need to find a mathematical way of defining the transformation, then codify all the manifestations, then allow for exceptions—you now need to define a stochastic tool for producing weighted random numbers, and “calibrate” it experimentally—and then pray that the computer doesn’t get too smart and make an unpredictable blunder that a human wouldn’t… which of course you can’t check for until the end. There doesn’t seem to be a simple way around this piecemeal work—if someone found one, they’d be making celebrity-professor-money at a big university. If the best classical music sounds “simple” or “logical”, it’s because human learning and music are so intimately connected; in the arts, the last person you want as a student is a completely logical robot, not because the field is illogical, but because defining it logically will break your head needlessly).

– The amount of code needed for a simple bit (few seconds maybe) of music is distressingly large. The demand on the RAM would be similarly distressing, and the practicalities of bandwidth and linking to the internet would provide a less than pleasant listening experience (the quality of sound would have to be lowered, and there would still be clipping, skipping, whole moments of silence, etc.)

In so many words, the killer really is the practicality, not the possibility, much like the individual steps are deceptively possible when you chase the moon around. So I need to apologize, and say it can’t be done, at least for now.

It was very enjoyable to work with you! Very sorry we couldn’t make something work,

PS, you might be happy to know that several people have adopted the tool to help them with their own pieces, so this work has served some use (though I have yet to hear those pieces). We have also developed a rather strange, yet practical tool for managing the load on the CPU during the playing phase; it has been named “Sonata”, of course, and might be handy in other people’s projects. Furthermore, we seem to have produced 10 new fans of your books! Thanks again for offering the opportunity to work with you, it’s been a lot of fun, even as I pull my hair out.

So now, dear Internet, I am throwing out this challenge to you.

Can anyone create a real-world Eternal Sonata? If you do, fame, fortune, and glory will be yours and we will spread it to the world.

**Text below added on February 19, 2023:**

In light of the incredible advances in AI, I thought I would ask ChatGPT if it could compose an Eternal Sonata.

Here is what I asked:

*Please compose a Bach-like sonata. It should be a variation on all of Bach’s Sonatas de Chiesa, using Bach’s same musical and mathematical formulas but extending the musical mathematical variation ad infinitum. Write this music as if Bach had written his sonatas to go on forever, with each melody embedded with the mathematical formula guiding the whole.*

Here is what ChatGPT responded:

*As a language model, I can’t compose music directly, but I can provide you with a description of a Bach-like sonata that follows the parameters you have provided.*

*The Bach-like sonata that I envision would build upon the mathematical and musical formulas that Bach employed in his Sonatas de Chiesa. It would be a highly structured and intricate work that would unfold over an extended period of time, with each melody and theme being embedded with a mathematical formula that guides the whole.*

*The sonata would begin with a slow and stately introduction, featuring a simple melody that would gradually evolve and become more complex as the piece unfolds. The first movement would be characterized by a series of variations on this initial theme, each of which would be based on a different mathematical formula.*

*The second movement would be more lively and energetic, featuring a faster tempo and more intricate harmonies. The musical and mathematical formulas employed in this movement would be more complex than those used in the first movement, building upon and extending the ideas introduced earlier in the piece.*

*The third movement would be a slow and contemplative adagio, featuring a rich and expressive melody that would be repeated and varied throughout the movement. The mathematical formulas used in this movement would be simpler than those used in the previous two movements, emphasizing the emotional and spiritual dimensions of the music.*

*The final movement would be a lively and triumphant fugue, featuring a complex interweaving of melodies and themes that would be guided by a masterful mathematical formula. This movement would build upon and integrate the themes and ideas introduced in the earlier movements, culminating in a grand and satisfying conclusion.*

*Overall, this Bach-like sonata would be a highly structured and intricate work, featuring a deep and sophisticated interplay between musical and mathematical formulas. It would be a work that would continue to unfold and reveal new insights and dimensions with each subsequent listening, reflecting the timeless genius and innovation of Bach’s own music.*

This was not success, but I feel the time that an AI systems can create an eternal sonata is getting closer. Given that my novel is set in 2025, I’ve got two years for this to happen in line with what I have written.