Developing a heuristic for evolving guitar blues licks

Towards the development of a pseudo simulated annealing genetic heuristic for evolving blues ideas

Architecture, graphic design, your projects.

Moderators: Calilasseia, Blip, ADParker

Re: Developing a heuristic for evolving guitar blues licks

#21  Postby John Platko » Nov 17, 2015 6:09 pm

I've explained how I create a text file which can go into LilyPond (music engraving software) and that same text file can also go into my program, LickMaker. The text file has some information added that LilyPond ignores that makes it easier for my program to understand the licks.

The first thing the program does is to squirrel away the header and footer (non lick) information that LilyPond needs so that it can later create an output that matches the format of the input file which can go directly into LilyPond to produce a music score of the new set of licks.

Next the program scans the input file and creates a dictionary with an entry for each lick. Python supports object oriented programming, and I use that here. Each lick becomes an object accessed by an entry in the dictionary. The information found in each lick is picked apart and sorted in a way that is more useful later one. I won't go into all of the details of that now but I'll give a flavor of what happens.

Here's Lick 5:

Image

And here's what the input text code for lick 5 for both LilyPond and LickMaker is:

%{c%}% 5
%{i%} \mark "5"
% .95 1
%{tbtt%} \tuplet 3/2 { %{n%} g'8\1 _"(1/4)" \bendAfter #2 %{n%} e'8\1 %{n%} b8\2 }
%{tbtt%} \tuplet 3/2 { %{n%} g'8\1 _"(1/4)" \bendAfter #2 %{n%} e'8\1 %{n%} b8\2 }
%{nv%} %{n%} a2\3 \prall
%{bar%} \bar "||"

In that format the information for the note pitch, note duration, and where it's played is all jumbled together. The dictionary entry for each lick sorts it out so note pitches can be found in one place and durations in another etc. etc.

For example, in the dictionary for that lick, note pitches are organized as:

[["g'", "e'", 'b'], ["g'", "e'", 'b'], ['a']]

All of the notes are in their playing order and some of the playing structure is still intact. The notes in each triplet can still be identified and the final A note with the vibrato is separated too.

In a similar way, note durations are organized in a way that is easy to get to.

[['8', '8', '8'], ['8', '8', '8'], ['2']]

It's easy to see that the final A is a half note.

I also keep track of the type of "gesture" that makes up the various components of the lick. Is it just a note, a trill, a triplet, something more complicated, etc.

['%{tbtt%}', '%{tbtt%}', '%{nv%}']

For this lick there are two triplets with a "curl" on the first note (not enough of a bend to make a half step) and a note with vibrato.

Similarly, dotted notes are tracked, I keep a record of which notes are played in a lick - this is useful for trying to figure out the scale or chord of the lick.

I'll just end with one more example of a simple lick that we saw before. Lick 0.

Image

Here's the BlueLick.0 text for lick 0.

%{c%}% 0
%{i%} \mark "0"
% .95 1
%{n%} r8
%{b1%} %{n%} g'4\1 _ "(1/2)" \bendAfter #2 % %{n%} gis'4\1
%{n%} e'8\1
%{n%} d'8\2
%{n%} b8\2
%{n%} a8\3
%{n%} g8\3
%{n%} e1\4
%{bar%} \bar "||"

And here's the LickMaker dictionary note pitches entry for Lick 0:

[['r'], ["g'", "gis'"], ["e'"], ["d'"], ['b'], ['a'], ['g'], ['e']]

Notice the rest is included. and the half step bend is represented by the Gis (sharp) in a set with the G. All other notes are just single notes.

And here's the dictionary "gesture type" entry for Lick 0

['%{n%}', '%{b1%}', '%{n%}', '%{n%}', '%{n%}', '%{n%}', '%{n%}', '%{n%}']


The details are not important for this thread. I'm just trying to communicate that LickMaker intputs a set of licks and builds a dictionary of these licks with the information being sorted in ways that aid understanding the components of the licks so that information can be later used.

The thread should start picking up and be a little less dry after this post as I start getting into actual lick mutations and such.
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Ads by Google


Re: Developing a heuristic for evolving guitar blues licks

#22  Postby John Platko » Nov 18, 2015 6:09 pm

I covered basic blues structure and blues licks. How to code LilyPond to engrave music notation for blues licks. How LickMaker also inputs the blues licks and organizes them in a dictionary with a structure that makes it easier to get at note, duration, string played, etc.

At this point further analysis of individual licks could be done, i.e. what scale do the notes in the lick best fit? What chord do the notes best fit. What note path do the notes traverse? The entire dictionary could also be analyzed, we could generate a network path map that shows which note transitions are most likely, what are common starting and ending notes for licks, etc.. We could even check out multi dimensional entropy values for licks. But I'll save that sort of thing for later and start out more simply by examining what kind of variations or mutations we can make on the original set of licks.

Variation is an important part of all music, playing the same thing over and over get's boring pretty fast. A blues solo will often start by introducing a lick and then playing a variation of it, maybe going to something new when the IV chord arrives ...

I call the kind of variations that I'll be covering in the next few comments, "cool mutations" - not because they result in especially tasty licks but because I'm working towards a simulated annealing heuristic. Simulated annealing takes it's name from how metal anneals. When the metal is very hot the atoms have more freedom to move as the metal cools the atoms are more locked into place and only smaller movements may occur. These "cool mutations' are smaller changes in the licks and less like to "break" the lick, if that's even possible to do. Starting and ending points of licks are pretty important so I tend to leave those alone for cool mutations.

One very basic variation is to add white space in a lick. That is, simply give some notes a rest. That's the first type of mutation that I'll introduce. I input lick_0 into LickMaker and had it compose some variations by resting various notes.

Image

A bit more directed mutation is to target the "let" (middle note) of a triplet and just rest that note. Here's an example of that:

Image

Now this starts to bring up the question: what is a valid mutation of a lick? Or even, what is a blues lick? I'm reminded of what Shrunk posted earlier in the thread.

The analogy I would use is that the blues (or any other musical idiom) is a language. The chord structure is like the grammar and licks or riffs are like idiomatic phrases that identify a fluent speaker of the language from someone who can do no more than speak the language well enough to get his thoughts across, but not with fluency.


So what are the licks that a "fluent" speaker would use? How does one go about answering this question? Do we appeal to authority, i.e. the blues masters? Maybe we can get some clues by looking at licks that don't make the cut - more of a subtractive process.

These are the kinds of questions I'll be exploring.

Does anyone have a favorite way to create a variation from a lick? i.e any suggestions for mutations that I can introduce?
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#23  Postby John Platko » Nov 19, 2015 4:51 pm

In my last comment I posted an example of what I call a "let rest" mutation. That is, the second note in a triplet is changed to a rest note. But in that example only one triplet was effect for each mutation. That's because the example showed only one generation of mutations and recent mutations are not eligible for further mutations in a given generation. That is, new mutations are prepubescent.

Also notice that there was only one specimen of each mutation type. My software checks for duplicate mutations and eliminates them.

To get a full compliment of "let rest" mutations for this lick it takes several generations of mutations. Here's the output of that:

Image

Above each lick in the upper right I keep track of the lineage of the lick, along with mutations encountered through the generations. lr is my abbreviation for "let rest" mutation.
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#24  Postby John Platko » Nov 19, 2015 5:31 pm

Adding rest notes in licks is interesting - to a point. I mean, it's not so interesting if too many rests are added. Which brings up the question of how to quantify when too much is too much. One obvious way is to just not allow too much silence in a lick- and that might end up being one rule of thumb in my ultimate heuristic.

Another way to think about quantifying licks is to use the idea of Shannon Entropy from information Theory. You can read about it here. I'm told we have some members who are expert on the subject of entropy so maybe they'll help.


People have been trying to use entropy to understand music since the 50s. There are lots of ways to apply the idea. I think I'll eventually end up using many of them to create a multi-dimensional entropy vector which I'll use to compare licks with.

One fairly simple way to quantify a lick's entropy is to use the probabilities of notes in a lick. That is:

Image

I did just that in the following example which started with a minor pentatonic run and mutated notes to rests through the generations. The following is some examples of the licks that came out of that:. (The generational information is shown along with the Entropy (E) of the lick. Notice that adding a rest can increase this measure of entropy.

Image
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#25  Postby John Platko » Nov 20, 2015 2:32 pm

Hmmm. no comments on my introducing entropy to the thread ... OK.

We're checking out "cool" mutations of licks. That's is, mutations that don't change the character of the lick too much. We've seen rest mutations. i.e. taking a note and silencing it. Two types of rest mutations were shown. A general note rest and a more targeted rest for the "let" of a triplet.

We can also mutate a lick by swapping note positions: For example:

Can you spot the mutation?

Image

We can also swap whole triplet positions. e.g.

Image

Another type of mutation is to split a note into two notes of the same pitch, each with half the duration.
e.g.

Image

Another type of mutation is to combine two notes into a single note of twice the duration - maybe randomly picking which pitch survives the mutation.

e.g.

Image

Can anyone suggest any other "cool" mutations?
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#26  Postby felltoearth » Nov 20, 2015 2:54 pm

Very interesting. Is it possible to supply these as .mid files?
"Walla Walla Bonga!" — Witticism
User avatar
felltoearth
 
Posts: 11616
Age: 52

Canada (ca)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#27  Postby John Platko » Nov 20, 2015 6:37 pm

felltoearth wrote:Very interesting. Is it possible to supply these as .mid files?


Well I haven't done much with midi with this effort, mostly because I've always found midi guitar not to be very good.

But for those who don't play guitar it would be nice to be able to hear some of this. (We do have some guitar players on the forum perhaps they'll volunteer to play ... ;)

LilyPond does output midi but I've haven't managed to get it to output all the pitch bend and other accidentals. But I could work on that a bit. Another route might be to find some python midi tools that make it easy to create midi files and output them from my program - that way I'd have a lot of control over bends and such. Does midi support hammer-ons?

But for starters I could create some midi-files directly with LilyPond and not worry about the articulations. I'll use lick examples where the articulations aren't important. That would give some flavor for what's going on.

Should I just post a midi file to my google drive and give everyone access to that file or did you have something else in mind?
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Ads by Google


Re: Developing a heuristic for evolving guitar blues licks

#28  Postby John Platko » Nov 20, 2015 10:43 pm

I thought I'd give posting a midi file a go. I tried to make it a bit interesting but simple enough to understand what is being listened to. So I just went with a selection (I hand selected - not very carefully) of some licks from about 4 generations of "cool" mutations of one lick, which is:

Image

The music score can be found here

And the midi file can be found here

Let me know if there are any problems with these files.
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#29  Postby felltoearth » Nov 21, 2015 1:37 pm

Cool. Thanks. Very interested in this but with limited time. I'll have a look at the link regarding information theory as since you mentioned entropy the idea has been rolling around in my head as "loss of of information" and how that could be applied to generational mutations of licks without ending up with a plain old mess of a score.

As for midi and hammer ons- a hammer on sound would be part of a patch on a synth or sampler that would be triggered by different performance parameters. You'd have to know how it's set up in the patch to begin with in order to send the proper performance parameter.

Anyway, not being a trained musician, I can't read notes so this will give me a sense of note, length and rhythm. I'm not interested in it sounding like a guitar.
"Walla Walla Bonga!" — Witticism
User avatar
felltoearth
 
Posts: 11616
Age: 52

Canada (ca)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#30  Postby John Platko » Nov 21, 2015 3:09 pm

felltoearth wrote:Cool. Thanks. Very interested in this but with limited time. I'll have a look at the link regarding information theory as since you mentioned entropy the idea has been rolling around in my head as "loss of of information" and how that could be applied to generational mutations of licks without ending up with a plain old mess of a score.


Perhaps I didn't make this clear but my intent, at least for this thread, is not to create a whole piece of music but rather a dictionary of little pieces of music and their variations that then a musician would be able to uses to create actual music.

So for a 12 bar blues solo, a musician, might pick a lick, and then a variation of that lick, and then a completely different lick, then go back to the first lick or another variation of it, then ... like that. Of course once you have a robust dictionary of licks the next level is to start putting them together with a program working at that higher level.

I'm imagining using entropy as one of the selection criteria for the survival of a blues lick. There will be a fitness function with weighted criteria of all sorts, one being the entropy of aspects of the lick. One aspect that I touched on briefly is pitch information - what notes are played. Another aspect would be rhythm information- duration of notes.

The example I gave where rests were added to a lick until only the first and last note were left with everything else being a rest is a good one to see how entropy can be applied to which licks survive and which licks die. With only two notes left the entropy went down to 1.58. (the calculation in this case was based on three symbols with equal probability). I included the rest in the calculation, even though rest information is more about rhythm than pitch because I didn't want to complicate things to much and add a rhythm entropy number too. But more generally two notes of equal probability would require 1 bit.
So those two notes with just silence between would reduce to a Pitch Entropy = 1.


As for midi and hammer ons- a hammer on sound would be part of a patch on a synth or sampler that would be triggered by different performance parameters. You'd have to know how it's set up in the patch to begin with in order to send the proper performance parameter.


I'm looking into what it will take to create my own midi files. I like the idea of having control of bends and such. I don't want it too specialized though so I would try to simulate hammer-ons with a quick bend or something like that. But the LilyPond midi gives the idea of the general timing and pitch variations. I suppose I could just play some music and record that too.


Anyway, not being a trained musician, I can't read notes so this will give me a sense of note, length and rhythm. I'm not interested in it sounding like a guitar.


Yes, it should do that. It should help give the triplet feel, and what happens when you rest the middle note of a triplet. That kind of rhythm is key to the blues. If done throughout the bar it gives a "shuffle feel".

I could post more of those types of midi files if it helps, just ask. Also, feel free to just ask about any piece of music I post. If you see a lick and wonder about the notes in it, just ask me to explain a bit about what's going on there. The small set of licks I'm using are not ones I invented but rather I took standard very simple licks that seemed like a good starting point.
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#31  Postby John Platko » Nov 21, 2015 6:01 pm

Since we're talking about entropy I thought it might be useful to post the series of rest mutations that I posted earlier but this time calculating independent pitch and rhythm entropy. So E= X Y where X is the pitch entropy and Y is the rhythm entropy.

Image

You can see that the initial lick only contained quarter notes so the rhythm entropy = 0.

And now, with rests taken out of the pitch entropy calculation the final lick only has two different pitches , each with equal probability, so the pitch entropy is 1. And for the final lick, there are two quarter notes and one big rest (all the little rest symbols amount to one big rest) so the rhythm entropy calculation has 2 symbols, one has a probability of .66 and the other .33.

And one can add a third dimension to the entropy vector - a harmony entropy, that would be determined by how many notes are being played simultaneously. A bit less of an issue for blues licks but "double stops" playing two notes at once are a common flavor adder, as are chord fragments, or whole chords.

All of these entropy calculations tell you something about the information content of different aspects of a lick. Taken together they become an entropy vector. And entropy vectors can tell you something about how similar or different licks are from each other.
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#32  Postby John Platko » Nov 22, 2015 8:57 pm

So I've been looking into what it would take for me to generate my own midi files based on my internal representation of the licks and it doesn't look too bad so I'm going to give that a go. Then I can add the bends and play with the timing and dynamics a bit to make it sound slightly less robotic like. Be back shortly ...
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#33  Postby John Platko » Nov 25, 2015 3:17 am

I gave outputting midi directly from my program LickMaker a try. Then I created a sound file and posted it on SoundCloud. It's a cheesy midi guitar type sound but it's more guitar like than what LilyPond put out.

This is just the input licks. You can play the file and follow the score. I included the pitch and rhythm entropy on the score images. PDF is probably easier to read but the image is right there in the post. This is just an experiment at this point to see if this makes it easier to follow along. - so. testing 1 2 3 ...

Image

Image


Listen here
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#34  Postby John Platko » Nov 26, 2015 3:04 pm

So where are we ...

So far I gave an overview of the basic structure of blues music, explained in a simple way how blues licks fit into that structure. Introduced LilyPond, a free music engraving software package (which can also output basic midi), introduced Python the programing language and environment I'm using for my software - which is called LickMaker. LickMaker takes the same input as LilyPond (slightly enhanced to make my life easier) and creates a dictionary of blues licks. It can then add to the list by making variations, etc.

So far we only talked about very simple variations, I'm calling simple variations "cool" mutations because in the final simulated annealing heuristic these happen when the annealing temperature is low. I also talked a bit about how Shannon entropy can be used to measure something about the pitch and/or rhythm content of music.

Lastly, LickMaker was just given a new skill, it can now output licks in its directory directly to midi so we can not only see the engraved music but we can hear it - bends et. all (well sort of). I'm kind-of liking this new feature so over time I'll enhance the quality of LickMaker's ability to "play" music by playing with the timing and dynamics of it's output a bit. For now, I'll leave the timing alone so that it's easier to hear more subtle variations in licks.

The cool mutations we covered so far are: Changing a note to a rest. Resting the "let" of a triplet. Swapping the position of some of the inner notes of a lick (leaving the beginning and end intact), Some other mutations I have are: splitting a note in half and making it two notes, Combining the timing of two notes and only playing one of them, Converting a quarter note into a triplet, turning a triplet into a quarter note.

Before I'm done I'm thinking I'll add about 6 more of these cool mutations. Anyone have any suggestions?

One that I'll do soon is to convert a note to a double stop. A double stop is playing two notes at the same time. A favorite of Chuck Berry and many others.

I ran a couple of generations (not many, I think 2) of the original 18 licks and produced about 350 licks. To give an idea of what that looks like you can read the music here. And you can listen to them being played here.

It's long, you might want to skip around a bit to just get the idea. On the other hand, a new guitar player might benefit from trying to read the score as the music plays. Even a more skilled guitar player might find an interesting rhythm twist with even the basic mutations that are being used.

I'll just add, since I now learned the basics of midi and how to generate midi output from Python, if anyone is interested in doing some programming that generates midi music I can give some pointers on how to go about doing this - it could save some google time and the midi package I used for Python was short on documentation.
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#35  Postby Adco » Nov 26, 2015 3:17 pm

Just listened to tracks. Interesting. Perhaps a blues drum beat and an occasional bass note could give it a different feel as well.
god must love stupid people - he made so many of them
User avatar
Adco
 
Posts: 1295
Age: 60
Male

South Africa (za)
Print view this post

Ads by Google


Re: Developing a heuristic for evolving guitar blues licks

#36  Postby felltoearth » Nov 27, 2015 1:28 pm

I see what you mean by licks now. Very interesting. Following you on soundcloud now.
"Walla Walla Bonga!" — Witticism
User avatar
felltoearth
 
Posts: 11616
Age: 52

Canada (ca)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#37  Postby John Platko » Nov 28, 2015 1:58 pm

Adco wrote:Just listened to tracks. Interesting. Perhaps a blues drum beat and an occasional bass note could give it a different feel as well.


I'll try adding a rhythm track to the midi sequencer that's creating the sound file. That might help give the licks a bit more context even though we're not nearly at a stage I would call music yet.
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#38  Postby John Platko » Nov 29, 2015 10:36 pm

I decided to add some double stop mutations. A double stop is playing two notes at once. Think the intro to Chuck Berry's Johnny B Goode.

There are lots of ways to play a double stop but the simplest is to play two notes on the same fret that are on adjacent strings. In most case the two notes will be a fourth apart. The third string to second is a Major 3rd. Here's what some double stop mutations look like. (the original lick and two mutations)

Image

This is a fairly complicated "cool" mutation because in order not to change the scale, key, or chord of the rest of the lick I check that the note being added is already being used in the lick- at least in some octave. When I add a double stop triplet, I also add a slide usually up but down if I run out of fingerboard. Which brings up another complication for this mutation. It must be aware of where the notes are on the fret board.

The double stop mutation inspires a similar one which would be a bend mutation. That is, adding a bend to a note if the destination pitch of the bend is already in the lick. (adding pitches to a lick will have to wait for warm and hot mutations)

Here's a short group of double stop mutations.

Image

And here's what they sound like I added a drum track as Adco suggested.
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#39  Postby Adco » Nov 30, 2015 6:41 am

Yup, that's sounds good.
god must love stupid people - he made so many of them
User avatar
Adco
 
Posts: 1295
Age: 60
Male

South Africa (za)
Print view this post

Re: Developing a heuristic for evolving guitar blues licks

#40  Postby John Platko » Nov 30, 2015 7:20 pm

Adco wrote:Yup, that's sounds good.


I didn't add the bass line that you suggested yet, I think I'll wait until major vs minor licks come more into play and then a bass line will he helpful to establish the chord that the lick is playing over and make the differences more apparent.
I like to imagine ...
User avatar
John Platko
THREAD STARTER
 
Name: John Platko
Posts: 9411
Male

Country: US
United States (us)
Print view this post

PreviousNext

Return to Technical Design and Engineering.

Who is online

Users viewing this topic: No registered users and 1 guest