Abrazolica
Home     Archive     Tags     About        RSS
Let's create new music by hybridizing Beethoven's 5th Symphony and Deep Purple's Smoke on the Water using a probabilistic automaton.
You might ask "How did you come up with such an idea?". Well, Deep Purple's guitarist Ritchie Blackmore, who created the central melody of Smoke on the Water, says the melody is derived from Beethoven's 5th, and that he owes Beethoven "a lot of money".
The use of automata for creating melodies is covered in our book Creating Melodies, and the methods in this post come from there.
We start by converting sheet music of the 1st movement of Beethoven's 5th Symphony to scientific pitch notation:
Notes: | z [G3G4] [G3G4] [G3G4] [E3E4] z [F3F4] [F3F4] [F3F4] [D3D4] z G4 G4 G4 z A4 A4 A4 z E5 E5 E5 C5 G4 G4 G4 z A4 A4 A4 z F5 F5 F5 D5 G5 G5 F5 [E5D5] G5 G5 F5 |
---|---|
Rhythm: | 1 1 1 1 4 1 1 1 1 8 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 5 1 1 1 |
From there, we create an
abc
notation file consisting of the following:
X: 1 T: Symphony No 5, 1st movement C: Original work: Ludwig van Beethoven M: 2/4 K: none Q: 140 L: 1/8 %%MIDI program 0 z1[G,1G1][G,1G1][G,1G1][E,4E4]z1[F,1F1][F,1F1][F,1F1][D,8D8]z1G1G1G1z1A1A1A1z1e1e1e1c5G1G1G1z1A1A1A1z1f1f1f1d5g1g1f1[e5d5]g1g1f1[e5d5]Then we create a
MIDI
file from the abc
file with the command:
abc2midi bvn5th.abc -o bvn5th.mid
You can listen to the result here.
Now we do the same with the first four measures of Smoke on the Water whose notes and rhythm are:
Notes: | [D3G3] [F3^B3] [G3C4] z [D3G3] z [F3^B3] [^A3^D4] [G3C4] [D3G3] [F3^B3] [G3C4] [F3^B3] [D3G3] |
---|---|
Rhythm: | 2 2 2 1 1 1 2 1 4 2 2 2 2 7 |
As before, from there we create an abc notation file consisting of the following:
X: 1 T: Smoke on the Water C: Original work: Deep Purple M: 4/4 K: none Q: 140 L: 1/8 %%MIDI program 0 [D,2G,2][F,2_B,2][G,2C2]z1[D,1G,1]z1[F,2_B,2][_A,1_D1][G,4C4][D,2G,2][F,2_B,2][G,3C3][F,2_B,2][D,7G,7] [D,2G,2][F,2_B,2][G,2C2]z1[D,1G,1]z1[F,2_B,2][_A,1_D1][G,4C4][D,2G,2][F,2_B,2][G,3C3][F,2_B,2][D,7G,7]Again, we create a
MIDI
file from the abc
file with the command:
abc2midi smoke.abc -o smoke.mid
You can listen to the result here.
Now to hybridize the two works, we start by creating an automaton of each work. As our book describes in more detail, an automaton can be constructed for each work from the notes listed above. The automata are shown below.
The next step is to make the hybrid automaton. To do that, we need to connect the above two automata to make a single larger one. This can clearly be done in more than one way. Because we want the resulting music to sound good, experimentation is in order. A guiding principle is that the connection between the two needs to go both ways, so we don't get stuck in one or the other automaton. Below is one possible connection that seems reasonable.
The Smoke on the Water automaton is marked by a dashed line rectangle. Here we've made three connections between automata. Two that enter the Smoke on the Water automaton, and one that exits it.
With the above hybrid automaton we can now make a probabilistic automaton file to represent it. Below is the file hybrid01.pat
which consists of the following lines:
16 0 (0,0,0.33333) (1,1,0.33333) (12,c,0.33333) 1 (2,2,1.0) 2 (2,2,0.5) (3,3,0.5) 3 (4,4,0.5) (14,e,0.5) 4 (4,4,0.5) (5,5,0.5) 5 (5,5,0.33333) (6,6,0.33333) (8,8,0.33333) 6 (6,6,0.5) (7,7,0.5) 7 (4,4,1.0) 8 (8,8,0.33333) (9,9,0.33333) (11,b,0.33333) 9 (10,a,1.0) 10 (10,a,0.5) (8,8,0.5) 11 (10,a,1.0) 12 (13,d,0.5) (14,e,0.5) 13 (2,2,0.25) (12,c,0.25) (14,e,0.25) (15,f,0.25) 14 (13,d,1.0) 15 (12,c,1.0)
Note that for simplicity we've given all transitions equal probability. There are 16 nodes in the automaton numbered in the file from 0 to 15 with note correspondences shown below:
0 → G3G4
1 → E3E4
2 → F3F4
3 → D3D4
4 → G4
5 → A4
6 → E5
7 → G5
8 → F5
9 → D5
10 → G5
11 → E5D5
12 → G3C4
13 → F3B♭3
14 → D3G3
15 → A3D♭4
Note that we've accidentally created a redundancy with nodes 7 and 10 being the same. Those two nodes could be merged, but that only makes things more efficient, and doesn't affect the outcome, so we'll just leave it as is.
To create an output string of length 24 with the above defined probabilistic automaton, with start state 0, and a random seed, we run the command:seed=$RANDOM;echo $seed;pautogen hybrid01.pat 24 0 $seed
which outputs for example the lines:
4886 000122234555566744444456
with the 1st line being the random number seed used, and the second line the output string. Now we need to produce a rhythm for the 24 notes above.
We'll just use the Smoke on the Water rhythm, which has length 14, which we'll repeat once to make a rhythm string of length 28. Our note string has length 24, so we'll add 4 more notes to match the length of the rhythm string, while simultaneously imposing more symmetry on the note string by changing a few notes. Note that this is an "art" part of the process, involving listening to the result, then going back and changing the note string, and repeating until it sounds satisfying. The final note string may not even satisfy the rules of the automaton, but what counts after all, is that the end result is something you like.
Now we paste the note strings and rhythm strings into a .str
file (hybrid01.str
), including our list of notes/chords used. Below is the complete file:
"Beethoven's 5th - Smoke on the Water" hybrid automaton variations Stefan and Richard Hollos Abrazol Publishing 16 [G,G] [E,E] [F,F] [D,D] G A e g f d g [ed] [G,C] [F,^B,] [D,G,] [A,^D] 0001211123455556674444456456 2221112142222722211121422227 2
For details on the format of .str
files see the "Input file formats" section of the Software chapter near the end of the Creating Melodies book, or online here.
abc
file and MIDI
file with the following commands:
str2abc hybrid01.str 0 C 100 1/16 > hybrid01.abc abc2midi hybrid01.abc -o hybrid01.mid
You can listen to the result here.
seed=$RANDOM;echo $seed;pautogen hybrid01.pat 28 13 $seedwhich gives us an output like this:
18274 edfcdedfcedced2223edced223edAdding this note string to the file
hybrid01.str
, calling it hybrid01b.str
and alternating it with the note string already in the file, our file becomes:
"Beethoven's 5th - Smoke on the Water" hybrid automaton variations Stefan and Richard Hollos Abrazol Publishing 16 [G,G] [E,E] [F,F] [D,D] G A e g f d g [ed] [G,C] [F,^B,] [D,G,] [A,^D] edfcdedfcedced2223edced223ed 2221112142222722211121422227 2 0001211123455556674444456456 2221112142222722211121422227 2 edfcdedfcedced2223edced223ed 2221112142222722211121422227 2 0001211123455556674444456456 2221112142222722211121422227 2
This makes for another nice tune.
Let's add a drum, by using the following abc
file as a model (a Soukous rhythm from our book Creating Rhythms):
X: 1 T: bdf002 M: 16/4 K: C Q: 480 V:1 clef=perc L: 1/4 %%MIDI channel 10 %%MIDI drummap A 45 | A3A3A4AA5 | A3A3A4AA5 | A3A3A4AA5 | V:2 clef=perc L: 1/4 %%MIDI channel 10 %%MIDI drummap B 50 | z2B3B3B4BB3 | z2B3B3B4BB3 | z2B3B3B4BB3 |Some of the info in that abc file was added to
hybrid01b.abc
, saving it as hybrid02.abc
. Now, as before we convert the abc
file to MIDI
with command:
abc2midi hybrid02.abc -o hybrid02.mid
You can listen to the result here.
Note that in hybrid02.abc we also slightly slowed the tempo (Q: parameter) from 100 to 90, since we liked it better. Reference info for drum mapping can be found here.
Now let's start from scratch to make another hybrid melody, putting it in hybrid03.str
. We generate a couple note strings using the automaton like this:
seed=$RANDOM;echo $seed;pautogen hybrid01.pat 35 13 $seedwhich produced the output:
9291 edcdededfcdcd223eded23444444589aa89
seed=$RANDOM;echo $seed;pautogen hybrid01.pat 15 13 $seed
19789 cededcd23edfcde
Note that the first string is length 35, while the 2nd is length 15. We will end up with two note strings of length 35, where the shorter string is repeated, and an additional 5 notes added to make another string of length 35.
This time we use a Son Clave rhythm which consists of the abc
file:
X: 1 T: bdf000 M: 16/4 K: C Q: 480 V:1 clef=perc L: 1/4 %%MIDI channel 10 %%MIDI drummap A 45 | A3A3A4A2A4 | A3A3A4A2A4 | A3A3A4A2A4 | V:2 clef=perc L: 1/4 %%MIDI channel 10 %%MIDI drummap B 50 | B3B3B4B2B4 | B3B3B4B2B4 | B3B3B4B2B4 |
The note strings and the rhythm from above are incorporated into hybrid03.str
which consists of:
"Beethoven's 5th - Smoke on the Water" hybrid automaton variations Stefan and Richard Hollos Abrazol Publishing 16 [G,G] [E,E] [F,F] [D,D] G A e g f d g [ed] [G,C] [F,^B,] [D,G,] [A,^D] edcdededfcdcd22edcdededfcdcd22edcde 33424334243342433424334243342433424 2 cededcd23edfcdecededcd23edfcdeceded 33424334243342433424334243342433424 2
str2abc hybrid03.str 0 C 100 1/16 > hybrid03.abc
Now let's add a drum by editing the just created hybrid03.abc to make it look like this:
X: 1 T: "Beethoven's 5th - Smoke on the Water" hybrid automaton variations C: Stefan and Richard Hollos Z: Abrazol Publishing M: 4/4 K: C Q: 160 V: 1 L: 1/16 %%MIDI program 24 [D,G,]3[F,^B,]3[G,C]4[F,^B,]2[D,G,]4[F,^B,]3[D,G,]3[F,^B,]4[A,^D]2[G,C]4[F,^B,]3[G,C]3[F,^B,]4[F,F]2[F,F]4[D,G,]3[F,^B,]3[G,C]4[F,^B,]2[D,G,]4[F,^B,]3[D,G,]3[F,^B,]4[A,^D]2[G,C]4[F,^B,]3[G,C]3[F,^B,]4[F,F]2[F,F]4[D,G,]3[F,^B,]3[G,C]4[F,^B,]2[D,G,]4[D,G,]3[F,^B,]3[G,C]4[F,^B,]2[D,G,]4[F,^B,]3[D,G,]3[F,^B,]4[A,^D]2[G,C]4[F,^B,]3[G,C]3[F,^B,]4[F,F]2[F,F]4[D,G,]3[F,^B,]3[G,C]4[F,^B,]2[D,G,]4[F,^B,]3[D,G,]3[F,^B,]4[A,^D]2[G,C]4[F,^B,]3[G,C]3[F,^B,]4[F,F]2[F,F]4[D,G,]3[F,^B,]3[G,C]4[F,^B,]2[D,G,]4 [G,C]3[D,G,]3[F,^B,]4[D,G,]2[F,^B,]4[G,C]3[F,^B,]3[F,F]4[D,D]2[D,G,]4[F,^B,]3[A,^D]3[G,C]4[F,^B,]2[D,G,]4[G,C]3[D,G,]3[F,^B,]4[D,G,]2[F,^B,]4[G,C]3[F,^B,]3[F,F]4[D,D]2[D,G,]4[F,^B,]3[A,^D]3[G,C]4[F,^B,]2[D,G,]4[G,C]3[D,G,]3[F,^B,]4[D,G,]2[F,^B,]4[G,C]3[D,G,]3[F,^B,]4[D,G,]2[F,^B,]4[G,C]3[F,^B,]3[F,F]4[D,D]2[D,G,]4[F,^B,]3[A,^D]3[G,C]4[F,^B,]2[D,G,]4[G,C]3[D,G,]3[F,^B,]4[D,G,]2[F,^B,]4[G,C]3[F,^B,]3[F,F]4[D,D]2[D,G,]4[F,^B,]3[A,^D]3[G,C]4[F,^B,]2[D,G,]4[G,C]3[D,G,]3[F,^B,]4[D,G,]2[F,^B,]4 V: 2 clef=perc L: 1/16 %%MIDI channel 10 %%MIDI drummap A 45 | A3A3A4A2A4 | A3A3A4A2A4 | A3A3A4A2A4 | z3z3z4z2z4 | A3A3A4A2A4 | A3A3A4A2A4 | A3A3A4A2A4 | | z3z3z4z2z4 | A3A3A4A2A4 | A3A3A4A2A4 | A3A3A4A2A4 | z3z3z4z2z4 | A3A3A4A2A4 | A3A3A4A2A4 | | A3A3A4A2A4 | A3A3A4A2A4 | A3A3A4A2A4 | z3z3z4z2z4 | A3A3A4A2A4 | A3A3A4A2A4 | A3A3A4A2A4 | | z3z3z4z2z4 | A3A3A4A2A4 | A3A3A4A2A4 | A3A3A4A2A4 | z3z3z4z2z4 | A3A3A4A2A4 | A3A3A4A2A4 | V: 3 clef=perc L: 1/16 %%MIDI channel 10 %%MIDI drummap B 50 | B3B3B4B2B4 | B3B3B4B2B4 | B3B3B4B2B4 | z3z3z4z2z4 | B3B3B4B2B4 | B3B3B4B2B4 | B3B3B4B2B4 | | z3z3z4z2z4 | B3B3B4B2B4 | B3B3B4B2B4 | B3B3B4B2B4 | z3z3z4z2z4 | B3B3B4B2B4 | B3B3B4B2B4 | | B3B3B4B2B4 | B3B3B4B2B4 | B3B3B4B2B4 | z3z3z4z2z4 | B3B3B4B2B4 | B3B3B4B2B4 | B3B3B4B2B4 | | z3z3z4z2z4 | B3B3B4B2B4 | B3B3B4B2B4 | B3B3B4B2B4 | z3z3z4z2z4 | B3B3B4B2B4 | B3B3B4B2B4 |
where the rhythms are alternatively stopped between measures with rests (z's).
Now, as before we convert theabc
file to MIDI
with command:
abc2midi hybrid03.abc -o hybrid03.mid
You can listen to the result here, which we call Beethoven on the Water.
© 2010-2020 Stefan Hollos and Richard Hollos
Tweet   
blog comments powered by Disqus