Elm-music-theory: A toolkit for musical ideas

I would be curious to hear what tools you think would be most beneficial to those two groups to have at their disposal.

My approach to answering this question in general has been to learn from the creative processes of composers and musicians, and learn to model the techniques involved in the decisions they make.

Here is one such technique I’m working on modeling, which is giving me some trouble; I wonder if any of the folks here might be interested in discussing it, because I feel the design of a solution would benefit from some discussion with both engineers and musicians:


Generating variations on a melody
One technique that composers use a lot is a melodic sequence. The term “sequencing” means taking a melodic line or motif and changing it, while retaining some of the characteristics of the original version.

The opening of Beethoven’s 5th Symphony is one of the most famous examples of a series of melodic sequences:

First the motif: G G G Eb – three of the same note followed by one note that’s lower
Then a variation: F F F D – similar but starting on a different note
Two more variations follow: Ab Ab Ab G, Eb Eb Eb C

Similar to the functionality of generating possible solutions to the problem of voicing a chord that I described in the original post, I think modeling the features of a melodic line and generating variations on it would be very helpful as a compositional tool, and almost essential if your goal was to generate music procedurally (e.g. to generate, say, bebop lines over a set of chord changes).

How to model an abstracted melody in this way?

A simple approach might be to model it as integer differences between notes on the scale it occurs in. Variations could be created by using different starting notes, and/or different scales.

analyzeMelody : Scale.Scale -> List Pitch.Pitch -> List Int

generateVariation : Scale.Scale -> Pitch.Pitch -> List Int -> List Pitch.Pitch

original : List Pitch.Pitch
original =
    [ Pitch.g4
    , Pitch.g4
    , Pitch.g4
    , Pitch.eFlat4
    ]

abstractMelody : List Int
abstractMelody = 
    analyzeMelody (Scale.minor PitchClass.c) original
    -- [ 0, 0, -2 ]

variation : List Pitch.Pitch
variation =
    generateVariation (Scale.minor PitchClass.c) Pitch.f4 abstractMelody
    -- [ Pitch.f4
    -- , Pitch.f4
    -- , Pitch.f4
    -- , Pitch.d4
    -- ]

This works well, but only under these assumptions:

  1. A melody uses only one scale
  2. A melody uses only pitches contained in the scale
  3. Each pitch in a scale is an equally viable possibility
  4. A variation should maintain the same scale steps, in the same directions, as in the original

All of these assumptions, unfortunately, break down very quickly:

(1) does not describe the many melodies and melodic fragments that are written across chord changes. Chord changes often imply a change in scale, so a melodic variation should be able to be specified in a way that includes transitions between scales.

(2) leaves out chromatic notes in melodies. The opening line of “When You Wish Upon a Star” is one example of a simple melody that nonetheless includes notes outside the scale.

(3) ignores the distinction between stable and unstable tones. This means some notes are not good options to emphasize in a melody because of their relationships to the current harmony. This idea varies with musical idiom; in classical music, any note that is not in the chord must be resolved. In jazz, all notes in the scale are available except for so-called “avoid notes”.

And (4) ignores the usefulness of variations that adjust the direction or distance of pitch transitions (like the variation Ab Ab Ab G from before).

How can these aspects of melody be modeled in a way that lends itself to the generation of variations? And how can this variation process be parameterized in a helpful way?

I have tried to model in terms of a current harmonic context, and a melody note’s relationship to it, and have some preliminary code working to generate variations in this way, but I am not happy with my designs so far.

I am considering modeling in terms of techniques for resolving nonharmonic tones like escape tones and anticipations. This might have the benefit of being easily understood by musicians, but given that one of my design goals is for designs to apply broadly across musical styles, I wonder if this will be successful in other musical contexts like jazz.

I would be very happy to hear anyone’s input on this, particularly if you have experience with these musical ideas.

2 Likes