Five more Preludes based on TonicNet Chorales #22

I’ve been using Pandas dataframes to analyze the synthetic chorales I’ve created. I started by generating 500 of them. Then I use lots of python code to learn more about the chorales. Each chorale produced by the TonicNet GRU model consists of a variable number of time steps, each consisting of Soprano, Alto, Tenor, & Bass voices expressed in MIDI note numbers. Some of those time steps have notes that are not in the dominant root key of the chorale. These are often leading tones, or suspensions, or diminished chords, augmented, and so forth. Bach used these chords to produce tension, that was always resolved in a cadence of some sort. The TonicNet model was trained on hundreds of real Bach chorale, which are further augmented by transpositions of the existing chorales to all twelve keys, so that 1,968 chorales were used as input to the model. What is amazing to me is that the final model is only 4.9 MB in size. The Coconet model ended up as 1.6 GB in size.

I like those interesting sections where the chorale uses notes not in the root key for many time steps. I wrote some python code that builds a list of the number of voices that are not in the root key of the chorale, one value for every time step:

zero_one_q = np.array([not_in_key(time_step, root, mode) for time_step in chorale_tr])

It basically calls another python function that looks at each time step and reports the number of voices not in the root key of the chorale. Once I have that array, I can build a list of sections that have notes not in the root key. I run every chorale through that routine so that I have information about each chorale that can be used to select for certain characteristics, such as lots of steps in a row not in the root key, or many sections of notes that are not in the root key.

Today’s results used a Pandas data frame to find chorales that met these characteristics:


I did the same for A minor. The value of these measures is that it produces a final result of five preludes that in total lasts about 15 minutes. That is in contrast with an earlier version that had many more challenging steps and went on for an hour and ten minutes. I used Kellner’s Well Temperament.

Published by

Prent Rodgers

Musician seduced into capitalism.

Leave a Reply

Your email address will not be published.