Exploring Some Highly Entropic Synthetic Chorales Generated by TonicNet

The traditional 12 tone scale can be described in python code as np.array([‘C♮’, ‘D♭’, ‘D♮’, ‘E♭’, ‘E♮’, ‘F♮’, ‘G♭’, ‘G♮’, ‘A♭’, ‘A♮’, ‘B♭’, ‘B♮’]), or the enharmonic equivalent as np.array([‘C♮’, ‘C♮’, ‘D♮’, ‘D♮’, ‘E♮’, ‘F♮’, ‘F♮’, ‘G♮’, ‘G♮’, ‘A♮’, ‘A♮’, ‘B♮’]). Those are basically the notes that Bach used to notate his music (with the exception of B♮ which was called “H” and “B♭” was called “B”). Go figure.

I’m working on a way to improve the sound of some synthetic chorales generated by the Deep Neural Network model known as TonicNet. I’m most interested in the synthetic chorales that have a high degree of pitch entropy. I use the python library known as muspy to evaluate the generated chorales looking for those that have a high pitch class entropy.

The pitch class entropy is defined as the Shannon entropy of the normalized note pitch class histogram.

The formula according the the muspy documentation is:
Pitch Class Entropy
It basically gives a higher score if the pitches used include a lot of notes not in the root scale of the piece. A score over 3 contains a lot of notes outside the root key.

I used the TonicNet neural network to synthesize around 5000 unique chorales in S-A-T-B format, four voices, any number of notes each. I selected the highest scoring chorales, in terms of Pitch Class Entropy, and studied them for some ideas.

I tried retuning them using some standard Well Temperaments, and obtained some nice results. But I thought I might be able to improve on them if I used an adaptive tuning. William A. Sethares has a paper on the subject here: adaptive tuning.

I still need to code it up. But I thought it would be useful to describe what I am trying to accomplish first.

Balloon Drum Music #35

I’ve made a number of changes over the past few weeks to the code that creates the music files. Many involved fixing bugs. Some of them were associated with the slides, others with varying the duration of some sections probobalistically. There are four paths through the model, and making sure the timing is accurate in each is important. You wouldn’t want the bass flute playing the verse when the balloon drums were on the bridge, for example. I also spent some time making sure that if a part repeated a section, the second time through would be quieter than the first. And the tempo of the trills was off, due to the duration of the notes being longer than they should be. I was adding 10% to each notes duration, and that messed up the timing of the trills. What was supposed to finish 8 ups and downs in the space of a half note, would actually not finish before the note should have ended.

I have some other enhancements I want to work on, but I think I have to leave this piece and move to another.
Listen here:

Balloon Drum Music #30

After completing the previous version of this piece on January 4, I thought it would be neat if I added the ability to slide some of the notes in the bass flute. Little did I know it would open up dozens of bugs in my python code. It took me a month and a half to sort out the issues. But now I can include slides in arbitrary note strings.

I had already created the ability to enter specific streams of notes in a text string.

inputs_array_64 = "n0o4u0e1v69d12 n3d4 n4 n5 n6o0 n7o4 d6n0 n1 n3 n2 n4 e8v78d1n6 n7"

This is similar to the way my old Pascal code worked. I specify notes with letters for each of the six features each note possesses:

  • n: note number, a number from 0 to 7 for the scale degree, which is later translated into one of the 256 note numbers in my 214 note tonality diamond array. In this example, we start with n0, for the first note in a scale, move to n3, the fourth note in the scale, and so forth. If I change the root key of a scale, then the notes choose different notes in the 256 note diamond.
  • o: octave, a number from 1 to 8. Zero is used to indicate that the note is silent. The fifth note is silent in the example above.
  • u: up sample, which causes the program to use a different sample than the one calculated based on the equivalent MIDI number. For example, each sample set has six distinct samples per octave. C4 uses one sample, and D4 uses the next one. Sometimes I want to pick a higher or lower sample for a more sharp or mellow sound. More on that later.
  • e: envelope, which is where I pick the envelope to be used. I pre-made several envelopes in csound and then specify which to use. e1 is on-off, e8 is fast decay, and e2 is very fast decay. I use the latter for the baritone guitar samples.
  • v: velocity, which is used to indicate how hard the key is pressed. This is used to choose a sample that matches the preferred pressure. I use that if the sample set supports different samples for different loudness levels. This is important with piano samples especially. It also affects the loudness in the absence of samples that don’t provide different loudness levels.
  • d: duration, which is how many time steps the note should be played.

My latest enhancement was to add a new feature, the glissando. The value for g indicates how many time_steps should be combined to have a continuous glissando between notes. See it’s use in the next example:

inputs_array_64 = "n0o4g0u0e1v69d12 n3d4g12 n4 n5 g0n6o0 n7o4 d6n0 g18n1 n3 n2 g0n4 e8v78d1n6 n7"

In this example, we start off with g0, which means no slide. Then on the second note, we have a glissando over 12 time steps. In this case that includes the notes n3, n4, and n5. I then create a function table that transits those notes over 12 time steps. Then in note five, we reset to g0 for no glissando. Note 8 starts another glissando over 18 time steps. I build a slide that transits n1, n3, n2, since each note has a duration of 6 time steps. The result is relatively simple to slide wherever I want in the scale. My code calculates the closest note automatically, changing octaves to do so when it would result in a smaller slide.

One of the consequence for glissandi on samples that already have vibrato is that a slide up by a whole step results in a speed up of the vibrato. This can get annoying if the distance traveled is several steps. My code automatically compensates for this “muchkinization” effect by changing the up sample feature in the background to avoid this effect. In this way, rising or falling glissandi don’t have mistimed vibrato. If I want, I can deliberately set the up sample feature to higher or lower samples. In the case of this piece, the bass flute part is played by four different flutes, with four different up sample values: -1, 0, +1, +2 from the calculated sample.

Glissandi can have many other controls, including how long to spend on the slide compared to the destination note, different durations to stay at different notes, different velocities for different notes. I’ve not yet implemented these controls in the text input file, but I have them buried in the code for later exploitation.
Listen here:

Balloon Drum Music #12

Today’s version is for an ensemble of finger pianos, balloon drums, baritone guitar, bass flutes, clarinets, oboes, french horn, and bassoons, with their bass versions. It’s tuned to the 15-limit of the Partch Tonality Diamond.

I wrote it using a python notebook and code that’s available on github here. It has everything you need to duplicate the results. Or actually, since the piece is probabilistic, you can create one that is not exactly like any other.

The structure is in the form of a vamp and a bridge, each around a minute and half in length. The vamp features the woodwinds pretending to be a horn section, with the bass flutes playing slides and trills. Everyone plays tetrachords based on the 4,5,6,7/8 to 9,11,13,15/8 overtones. The bridge has the woodwinds playing one long sliding chord through a set of changes. I assume circular breathing. The bass flute plays the melody, such as it is. Throughout the bass line and percussion is playing the same tetrachords on finger pianos, balloon drums, and a baritone guitar. Tetrachords are four note chords. During the bridge the chords go through some changes that I’ve used in the past.

You can listen to the results here:

Balloon Drum Music Take 3

There are a lot of parameters to modify. This one includes fading in of the instruments over the first minute, and fading them out at the end.

Balloon Drum Music Take 2

I’ve been working on some python code to explore the tonality diamond to the 31-limit. This piece is one of the first to result in some “music”. It’s derived from a set of chord changes based on the 15-limit diamond. It starts out with a vamp on the otonality of 16/9, then proceeds to a bridge made up of nine chords:

# mode root rank inversion
bridge_keys = np.array([["oton","16/9","A", 1],
["oton", "8/7", "A", 3],
["uton", "9/8", "A", 3],
["oton", "16/15", "A", 4],
["uton", "1/1", "A", 2],
["oton", "1/1", "A", 1],
["uton", "7/4", "A", 4],
["uton", "15/8", "A", 4],
["oton","16/9","A", 3]])

I divide the 31-limit diamond up into what I call “ranks”. Rank “A” in the otonality is 8,10,12,14/8. Rank “B” is 9,11,13,15. I’ll get to the other ranks after I am more comfortable with the tools I’m using these days. Instead of using my old standby Pascal code to translate text into Csound, I’ve written a collection of python functions, dictionaries, and data structures. It’s a pretty steep learning curve. But I think there is potential here. Take a listen.

Working on a new version of Balloon Drum Music – Take 1

This is another attempt to use the chord changes from Balloon Drum Music in another context. Scored this time for Bass Flute, Finger Piano, Balloon Drums, Oboe, Clarinet, French Horn and Bassoon.  This is just the vamp on the verse in 16/9 otonality.

Balloon Drum Music for Small Ensemble #17

This piece is made up of 17 short pieces based on a journey through the tonality diamond. They each consist of a vamp and a bridge. The vamp is in the same key for several measures, and the bridge follows a set of rapid chord changes as shown in the list below.

otonality on 16:9 - B♭

otonality on 8:7 - D+
utonality on 3:2 - G♮
otonality on 16:15 - D♭
utonality on 4:3 - F♮
otonality on 1:1 - C♮
utonality on 7:6 - E♭
otonality on 16:9 - B♭
utonality on 5:4 - E♮

I’ve split the 16 notes in the tonality diamond scale into four tetrads (four note chords).

Tetrad otonal ratios
A 1:1 5:4 3:2 7:4
B 9:8 11:8 13:8 15:8
C 17:16 24:16 25:16 29:16
D 19:16 23:16 27:16 31:16

Tetrad utonal ratios
A 8:7 4:3 8:5 1:1
B 6:15 16:13 16:11 16:9
C 32:29 32:25 32:21 32:17
D 32:31 32:27 32:23 32:19

The piece is is based on the vamp and bridge on each of the four tetrads, one at a time. The first one is based on the four notes of the ‘A’ tetrad, 1:1, 5:4, 3:2, 7:4 relative to the root key of otonality on 16:9 – B♭. The bridge is then played on the 8 keys in the list above. The next time, I play the vamp on the ‘B’ tetrad, 9:8 11:8 13:8 15:8, and the bridge is based on the same chord changes listed above, but on the ‘B’ triads on those o/u tonalities. Then we move to the ‘C’ and ‘D’, and back to the same series for a total of 17 short pieces across the cycle of tetrads. Each piece might start with a short set of chords to introduce the tonality, and end with another to close the piece out. Or it might just start right up at a faster pace. When it has a short intro, it sets the mood for that piece, based on chords in the chosen tetrad. There is never a time when more than four notes are played at the same time, except for different octaves. Some of the pieces are as short as 17 seconds, others are as long as 90 seconds or so. They all have a different rhythmic structures based on masking and arpeggiations.

The piece is scored for different collections of instruments. Each of the 17 pieces can include a woodwind quintet, finger pianos, and balloon drums in different combinations.

Five Dances based on TonicNet Chorales #46

Today’s work results from trying to isolate the variables that create the most interesting set of five dances based on the TonicNet Chorales. In this version the keys are F# minor, B minor, E major, A major and D major, tuned in Kellner’s Well Temperament. As before, I chose them because they have many segments where the notes are not in the root key of the chorale. There are dozens of variables in the creation of the dances from the original synthetic chorale material, but the main control points can be found by scanning the logs using grep:

egrep "mask.shape|factors|repeat_count|mask_zeros|midi_file" open_samples3-t46.log

This produces the following output, which includes the key values for important variables chosen by the algorithm from a set of ranges and probabilities:


The dances are scored for finger piano, balloon drum, and Ernie Ball Super Slinky Guitar strings on an old Gibson humbucking pickup.

Five Dances based on TonicNet Chorales #25

This one is based on chorales in a circle of fifths: The chorales start out in F# minor and then B minor, E major, A major, and the final one in D major. It has a nice bouncy feel. I added some Balloon Drums.