Introduction
Finally, here’s part 2 of Article 4. In this part of the article, I will further explain this mathematical space of music points. In particular, I will define this neighborhood concept that I have been referring to in the previous articles.
The Infinite Space of Musical Points
In my previous Music Discovery articles, I have written about this mathematical (musical) space of an infinite number of points (musical melodies). Each of these musical points represents a sequence of musical notes and rests that make the melody. All melodies that exist in human knowledge and all possible melodies that have not yet been revealed to humans are present in this space. These melodies, when heard by a human, can be judged to be good, bad or ugly; however, I conjecture that the “goodness” of a musical point is an inherent property of a musical point. This goodness is determined by the structure of the melody and does not depend upon human opinion. For me, goodness is a matter of smoothness in the transitions between notes.
I have also suggested that most of the musical points in this space correspond to awful music or gibberish, so the goal of music composition is to discover the good musical points. Furthermore, I suggested that since the musical space is infinite, it is very difficult to find a good musical point. Your best bet is probably discovering a musical point in the neighborhood of a good point; that is, a musical point that just needs some incremental tweaking of the notes and rests to transform it into a good musical point. The process for creating a melody was described previously as first finding a musical point in some neighborhood of a good musical point. Then you would incrementally tweak (trial-and-error modification of notes and rests in the melody) this initial musical point, transforming it into a good or good enough musical point. The algorithm used to find this initial point randomly selected a musical point from a reduced, finite subset of this infinite space. This subset was created by imposing restrictions upon the allowable points to be searched. The restrictions imposed included the following:
The allowed pitches were restricted to one or two octaves of a particular scale. I used the C major scale.
The time signature was restricted to 4/4-time.
The allowed note/rest durations were restricted to a subset of the standard values. I really didn’t restrict the durations as much as I should have.
The transitions between note pitches and between note durations were smoothed. That is, the probabilities of large transitions in pitch or duration were set lower than the probabilities of small transitions.
These restrictions gave a finite set for the algorithm to randomly select an initial musical point. Instead of an ocean of musical points, I ended up with a pond of musical points and the algorithm sampled it using a music-point eyedropper! Rather than continue sampling until a likeable music point was found, I usually just took the first point the algorithm produced and tweaked it.
To get some idea of how good the points selected by the algorithm were in a reduced finite set, I conducted some experiments. In the first experiment, I removed the smoothing code from the algorithm. I selected the first four bars of the song “Twinkle, Twinkle, Little Star” as a reference musical point. I listed the pitches found in this riff in the algorithm. Only these pitches would be available to be randomly selected for the neighborhood musical point. I listed the note durations found in the riff in the algorithm. Only these note durations would be available to be randomly selected by the algorithm. There were 12 quarter notes and 2 half notes, so the probability of producing a half note was set to 0.15 and the probability of producing a quarter note was set to 0.85. The only pitches contained in this four-bar reference are C4 through A4. I made the probability of being selected equal for all these pitches. The resulting finite set contains “Twinkle, Twinkle, Little Star” and I wanted to note if my algorithm would find it. Note that this set is very large, even though it is finite. For every bar there are 1980 distinct arrangements. Since there are 4 bars, there are 1980 x 1980 x 1980 x 1980 = 1.537E13 distinct possible sequences of notes (musical points) that could be produced by the algorithm. I ran this algorithm (without smoothing) 20 million times to see if the algorithm would find “Twinkle, Twinkle, Little Star”. It didn’t find it. It did find points where one of the bars matched and it found some points where two bars were matched, but it did not find points where three or four bars were matched! Running the algorithm with smoothing enabled didn’t do much better. Of course, the smoothing technique I used did not produce a smaller search set. It only reduced the chance of obtaining a sample point with really wild pitch and duration transitions.
In the second experiment, I modified the algorithm to use the rhythm of a reference musical point (melody) and to randomly select a pitch based off the pitches used in the reference musical point. I chose the first four bars of “Twinkle, Twinkle, Little Star” as the reference musical point. That is, the points of this new set would all have the same rhythm as the reference melody. Another constraint on this new set is that pitches of the notes comprising a point were a random function of the reference melody pitches. So, all points in this set could only choose pitches from the set of pitches found in the reference melody or reference musical point. There is a total of 14 notes in these first four bars. The rhythm is fixed to be the same for all musical points. So, only the pitches vary from musical point to musical point. There are 6 possible pitches for each note. This means there are 6^14 = 7.836E10 distinct possible sequences of notes (melodies) or musical points in this reduced set. The smoothing feature of the algorithm will make some of these musical points less likely, but all of the points could possibly be selected by the algorithm. This is still a lot of points! This algorithm ran slower, so I only tested it with 10 million runs. I still did not find “Twinkle, Twinkle, Little Star”, but I did get a few points that had 3 bars that matched “Twinkle, Twinkle, Little Star”. What does this mean? Well, it means that the mentioned sets are very, very big and the probability of randomly selecting a good point is not very likely. Of course, this does not mean it’s impossible.
So, these experiments demonstrated the following:
The finite sets produced were very large and “finding” a particular known point by taking a random sample many times (10 million) most likely would not be successful.
Using the smoothing code really didn’t help with “finding” the known reference point using statistical sampling.
The development of the first and second experiment setups inadvertently evolved into a way of defining a neighborhood of a musical point! Essentially, the result was a neighborhood being defined as a set of musical points that contain the same musical rhythm as a selected reference musical point. Given a reference musical point, a neighborhood of that point is the set of all musical points that have the same rhythm as the reference musical point. The points differ from each other and the reference point because none of the melodies use the same exact pitches for all the notes.
In this article, the goal is to understand better the neighborhood of a good musical point. The hope is that understanding the nature of the neighboring points of a good musical point may help understand how to find good musical points. This information could then be used to improve the search algorithm so as to generate musical points that require minimal tweaking to achieve a good musical point. Note that this and the previous articles of the Music Discovery Series focus on the creation of a short melody or riff.
What is a Good Musical Point
This is a subject that I have pretty much avoided in the previous articles. So, let me remedy this right now! I hereby define a good musical point as one that you can hum and if there are associated lyrics, then they pretty much stick in your head. Does this mean that a musical point cannot be good if it hasn’t been heard by a human? No, it just means this is the way I would judge the point to be good if I heard it. I assume that the goodness of a musical point is intrinsic to its structure. If its structure produces sounds that please my ears/brain, then it’s a good melody according to my definition. Furthermore, I hereby declare that good musical points mostly have smooth transitions between adjacent notes with regards to pitch and duration. By smooth pitch transition, I mean that the interval formed by adjacent notes is pleasant or providing a pathway to a soon-to-be pleasant interval. By smooth duration transition, I mean the change in note duration is pleasant or provides a pathway to a-soon-to-be pleasant duration interval. In other words, there are not a lot of “wild” random transitions in pitch and duration in the melody. Furthermore, I declare that good musical points can have syncopation, but it cannot be randomly applied. Finally, good musical points use repetition of notes, bars, and/or phrases in an arrangement that just sounds good to my ears/brain.
What is a Neighborhood of a Musical Point
This is another subject I have avoided in the previous articles. It’s time to remedy this too! As mentioned above, while conducting two experiments to evaluate the effectiveness of my search algorithm, I inadvertently discovered a way to define a neighborhood of a musical point. I hereby define a neighborhood as a finite set of musical points with the same time signature and the same sequence of note/rest time durations (rhythm) as a given reference musical point. For example, if you chose the melody “Twinkle, Twinkle, Little Star” as a reference melody or musical point, then every musical point that has that same rhythm, is part of the neighborhood of the melody “Twinkle, Twinkle, Little Star” and hence is a neighbor. The set of neighborhood points can be further broken into the following neighborhood subsets: 1) the Friend Musical Point Set (FrMPS), 2) the Family Musical Point Set (FaMPS) and 3) the Immediate Family Musical Point Set (IFMPS). These subsets are defined in the following sections. You will see that the IMFPS subset is contained in FaMPS subset and the FaMPS is contained in the FrMPS subset. The FrMPS is actually the entire neighborhood, so it is another name for a neighborhood of a musical point! I will next define these subsets of the neighborhood.
Since the FRMPS is just another name for the neighborhood, I’ll go ahead and say a few things here. The definition of a neighborhood (and FrMPS) given makes no mention of any constraints on the pitches of the notes in a neighbor point. I hereby declare that a neighbor or FrMPS musical point may use any of the standard chromatic pitches from any octave. The actual pitches present in the reference musical point are not part of the definition of a neighbor or FrMPS.
Set of Family Musical Points
Define the set of pitches used by the reference musical point as the Reference Pitch Set (RPS) and define the scale or mode that contains these pitches as the Reference Scale (RS). I hereby define the Family Musical Point Set (FaMPS) as those neighbor musical points whose set of pitches belong the Reference Scale (RS). This definition allows notes from any octave of this reference scale. This set of musical points is smaller than the FrMPS, but it can still be very large.
Set of Immediate Family Musical Points
Suppose you restrict the set of pitches for a neighbor musical point of a reference musical point to be equal to the Reference Pitch Scale (RPS). Then the set of these musical points is called the Immediate Family Musical Point Set (IFaMPS). This set is smaller than the FaMPS, but it can still be very large.
The Neighborhood of a Good Musical Point
Now that we have a definition of a neighborhood of a musical point, what can we say about the neighbors of good musical point? Is the rhythm the major contributor to the “goodness” of a melody? If you allow only one pitch, say C4, will the resulting melody capture the “essence” or “feel” of the good musical point? If you allow only one note duration and randomly arrange the pitches, will the resulting melody capture the “essence” of the good musical point? What if you maintain the order of the pitches but only have one note duration? In this special case where there are only two note durations (quarter and half) and the half only occurs 2 out of 14 times, the pitches will convey more information than the rhythm about the “essence” of the reference melody. This is an exception. In general, I believe it’s the rhythm that makes or breaks a melody.
Here is the complete “Twinkle, Twinkle, Little Star” melody:
Here is just the rhythm, with the single pitch C4:
Here is just the notes randomly applied with only quarter notes:
Well, what do you think?
How Good are Neighborhood Musical Points?
My conjecture is that Immediate Family Musical Points are good or at least marginally good neighbors of a good musical point. Such points should require little tweaking to produce a good musical melody. Since the Family Musical Set contains the Immediate Family Musical Points, I conjecture is that they are also good candidates for an initial point set, which could be marginally tweaked to get a good musical point. With regards to the remainder of the neighborhood, I conjecture that opening up the set of allowed pitches to any pitch in the standard chromatic scale has the potential of producing some really interesting music, but quite a bit more tweaking will be required in general.
Recall from the previous articles that the process was to come up with an initial musical point in the neighborhood of a good musical point. Then incremental tweaking would be done on this initial musical point until a “good” musical point resulted. I wrote that the “better” this initial point, the less tweaking would have to be performed to achieve a good musical point. Now, you have a way of obtaining a “better” initial point, thanks to the concept of a neighborhood described above. You begin by choosing a reference good point. Next, you produce an initial musical point with the same identical rhythm as the reference point. You use probability to produce the pitches for each of the notes in the initial musical point. The set of allowed pitches you choose to use for your initial point will determine how similar it will be to the chosen reference point. Use smoothing in the algorithm to minimize “wild” fluctuations in pitch. You control the complexity of your initial point by the complexity in your chosen reference point. You want syncopation? Then choose a reference good point that has the desired syncopation.
Revised Procedure for Procuring a Good Musical Point
Ok, let me pack all this information into a new procedure for procuring a Good Musical Point. There are now three steps:
Obtain a known Good Musical Point. This could be one of the simple nursery rhymes, a scale progression, or some melody you made up. It could also be a more complex melody that you borrowed or one that you created. Note that this choice also by default chooses a time signature and a scale.
Decide which neighborhood subset you want to use as a basis for your initial music point. Using the IFaMPS should require little tweaking to get a good musical point. Using the FaMPS or the FrMPS will require more tweaking but has the potential for creating a good musical point that is more interesting or maybe even “gooder” than the reference musical point!
Now you must randomly select the pitches associated with each note of the initial melody. For example, suppose the first note of the reference melody is E4 and the Reference Pitch Set includes the C major scale notes from C4 to G4. Using a single-mode probability distribution like a Gaussian distribution with E4 as the mean, would smooth the transition, since the closer the note to E4, the higher the probability of being selected. The Beta distribution would be the best choice since it assumes both skewed and symmetrical shapes, which would be needed for such a finite set of pitches.
Summary
This part of Article 4 completes the theory associated with this article. In part 3 you will see some results of using this neighborhood approach. You should see Part 3 in your email really soon! Hope you enjoyed the theory!