Deep learning for assisting the process of music composition (part 4)

This is part 4 of my explorations of using deep learning for assisting the process of music composition. In this part, I look at the process of composition using a model built using deep learning methods on over 23,000 folk tunes. Part 1 is here. Part 2 is here. Part 3 is here.

In the previous parts, my explorations were not so much about a model assisting me in composition, but really of using a model to generate a bunch of material, and then sifting through that material to get ideas, inspiration, etc., which I then fix, edit, arrange, and so on. Now, what about using the model to help me complete ideas.

As was one motivation for David Cope, let’s say I have composer’s block. I need to write an original jig (say, for a scene in a staged play), but I have nothing. I will use the model to generate something, by priming it with the following text:

T: Bob's Jig
M: 6/8
L: 1/8
K: Amix

Here is its output:

T: Bob's Jig
M: 6/8
L: 1/8
K: Amix
|: AAA eAA | eAA eAA | GAA eAA | BAG BAG |
AAA eAA | eAA efg | aba ged | edd d3 :|
|: eef aaa | eee efg | dBA BAG | ABB B3 |
eee aee | aee aee | gga gee | dBG GAB :|

T: Oik In The Watslan
M: 6/8
L: 1/8
K: Gmaj
|:B|dGG BGG|dGG BGG|dGG AGG|ecA ABc|dGG BGG|dGG BGG|dgg gfe|d2 e dBA:|dgg fag|ede cAG|dgg egg|dgg bag||dgg bgg|aga bge|ded AcA|AGF GBc||dgg age|dBG GAB|cEE DGF| GBG GAB|cee dcB|ced Bcd|eag edB|cfg afe|dgg gab|age dBG|AFE DEF|GAG Gdc|Bgg dgg|Bgg g2 a|bag agf|1 gdc Bdd:|2 gdc B2 E||

T: Road To Erin, The
M: 4/4
L: 1/8
K: Edor

... [and so on]

It not only gives me a completed jig, but also decided to compose another jig it titles “Oik In The Watslan”, a reel it titles The Road to Erin, and on and on.

Ok, nice. Here is “Bob’s Jig” notated, and realised:
J3Dren-000

What a great start! Except I don’t like that it uses the dusty high notes on my melodeon.

Let’s try again, but with a different random seed. The trusted seed “1213”. Here are the notated result and realisation:
G4NMj9-000

Aside from the strange quaver of a pickup (Maybe to add tension? Maybe for tuning?), I can definitely see how fixing a few of those strange leaps, and adjusting the end of the tune would bring this into jiggable line.

Let’s try again, but in C major. Here is the notated result:
VXHcWx-000

I really like it, but it is much more Persian than Irish; and it really isn’t in C major. And what is that C# doing in there!?!?!

Now, let’s say I already have something of the beginning of a tune:

T: Bob's Jig
M: 6/8
L: 1/8
K: Dmaj
|: d2A A2A | GAB A2A | Bcd efg | fed cBA |

So, I feed that into the model, and out comes its idea of how the rest goes:

T: Bob's Jig
M: 6/8
L: 1/8
K: Dmaj
|: d2A A2A | GAB A2A | Bcd efg | fed cBA |
d2A A2G | FGA d2A | GFG A2G | FDD D3 :|
|: dcd edc | dAF D3 | ABA A2B | cde e3 |
afd edc | dcd A3 | FGA BGE | D3 D3 :|

D8fHHt-000

Look at that! It “thought” to repeat what happens at the beginning of the tune (with a little variation), and it even resolves. And then after the first two measures of the turn it goes into the dominant, and returns to the tonic.

Trying with another random seed produces this:
gjoxMn-000

Some aspects are nice, like that the turn starts in the subdominant, builds to the dominant, and resolves. I don’t like the last measure of the tune, or the third of the turn; but still, the system is giving me ideas to complete my idea. (The “correct” completion is here.)

Now, let’s say I want to produce something unconventional. Here is my beginning:

T: Bob's Idea
M: 4/4
L: 1/8
K: Cmaj
|: CcDB E^A=AF | d2 cB c2 E2 |

And the system spits out:
AE3bCo-000

I like the measure following the two I specified. This gives me the idea to keep that measure, add another measure that mimics the second:

T: Bob's Idea
M: 4/4
L: 1/8
K: Cmaj
|: CcDB E^A=AF | d2 cB c2 E2 | Gc_Bc EFAc | f2 ed e2 _B2 |

So, I feed that into the system, and it produces:
GgNhgT-000

I am not impressed with that first ending, but the second: that has potential! We have modulated to the dominant key. I am going to keep it, and input the following into the system:

T: Bob's Idea
M: 4/4
L: 1/8
K: Cmaj
|: CcDB E^A=AF | d2 cB c2 E2 | Gc_Bc EFAc | f2 ed e2 _B2 |
B^ABc E2 A2 | dcde f4 | cBAG ^F2 Ec | dcBA G4 |

This produces:
DYUtz6-000

I like measures 9 and 10! Let’s mimic them to create measures 11 and 12. Steaming ahead, my composer’s block is now dissolved.

A few hundred edits, modulations, some orchestration, and now we have a fun ditty that I call, “The March of Deep Learning”.

ACRys2-000