An algorithm to create a simple chord progression

2.9k views Asked by At

I'm making a program that generates random simple melodies, based an a randomized basic chord progression from the C Major scale.

What would be a good way to generate a chord progression of 4 triads from this scale? Generating 4 completely random triads (from the 7 existing ones) from the scale usually doesn't sound very good.

I need an approach to generate a chord progression that will sound good or okay, but I don't want to simply choose a progression randomly from an existing pool of progressions. I still want the program to generate these 4 triads by itself, using some simple algorithm to ensure that the generated progression sounds decent.

(As I said, these 4 triads will each be taken from the 7 triads of the C Major scale).

Please note: This question is not a duplicate of my previous question about an approach for creating an algorithm for melody creation. This one is about finding a way to generate a chord progression. Generating melodies is a different topic.

Thanks for your help

EDIT: General guide lines on how to know if a triad will sound okay next to another triad, will also be great.

4

There are 4 answers

3
millhouse On

Sounds like you need to break this into phases:

  • Firstly, generate a triad randomly from all the possibilities of this key
  • Secondly, apply one or more filters to eliminate ones that don't "sound decent"(*).
  • Keep going until you've got 4 triads that pass all the filters.

I think this solution might end up being pleasant to work on too - you can slowly build up a collection of filters, each which does one simple thing - but put together, you gradually work out what it is that defines "decent".

(*) The sounds decent is defined in terms of with reference to the previous triad(s) (if there are any), and this is where you could write filters like:

  • Does the root note of the triad fit on a logical pattern relative to the previous root notes?; examples:

    • Simple ascending
    • Simple descending
    • Ascending in thirds
    • etc
  • Do the notes of this triad have at least one common note with the previous triad?

    • this could find some pleasant-sounding inversions
  • Is the "jump" from the previous triad "less than" some given threshold?

    • to avoid jarring jumps all over the scale
    • simply achieved by summing the MIDI note values of the triad and comparing with previous
2
edgarmtze On

You could check these papers

Generating Music Using Concepts from Schenkerian Analysis and Chord Spaces

and A Probabilistic Model for Chord Progressions

But this subject is complex as you want it to be, for example, let us say that accurate and compact representation of music signals is a key component of large-scale content-based music applications such as music content management and near duplicate audio detection. In this case You are working on C major scale which goes like:

C - D - E - F - G - A - B

which has the intervals

C - STEP - D - STEP - E - HALF STEP - F - STEP - G - STEP - A - STEP - B - HALF STEP - C - 

Now a chord is formed by distance between notes for example

C major chord is formed by C-E-G
D minor chord is formed by D-F-A
E minor chord is formed by E-G-B
F major chord is formed by F-A-C
G major chord is formed by G-B-D
A minor chord is formed by A-C-E
B dim   chord is formed by B-D-F

The problem you describe is not well solved yet despite many research efforts in this field. So for instance take a look at other papers where they suggest mid-level summarization of music signals based on chord progressions. So chord progressions are recognized from music signals based on a supervised learning model, and recognition accuracy is improved by locally probing n-best candidates.

So you can investigate the properties of chord progressions, then calculate a histogram from the probed chord progressions as a summary of the music signal. Then with a chord progression-based summarization you can describe harmonic progressions and tonal structures of music signals.

But how to do it?, well you need music datasets ( > 70,000 songs ??) so you can retrieve relevant information...

0
zolley On

Actually that's quite an interesting question.

I would say that one more thing needs to be considered and understood here: What would you like to say (i.e.: express) with your chord progression? I assume that you would like to express "something meaningful" with your melodies and with the supporting chord progression.

Now, "something meaningful" is not an exact term. Personally I would describe this term as something whole, something complete, as a short story. It can be as brief as 4 chords, but it should tell something and should add up to a full story. If we accept this then I would say that your 4 chord should "lead" from the beginning till the end, and we should "feel" the last chord as it was a satisfying ending (resolution) of the "story".

The hard part is that for every human, the terms "satisfying", "decent", etc. can mean quite different things, and what is satisfying for you maybe it is not satisfying for another person. Although in music theory there are some basic guidelines (linked above in the answers and comments), which were tested by great composers through hundreds of years of music, so I guess you should try some of those hints.

1
Dominic Ellis On

Define the 7 normal triads of C major and put them each in 7 separate 3 vectors. Then use a random generator pick 4 chords specifying whether repeated chords are allowed or not. If you want the progression to be "hipper", use 7th chords and extensions/alterations. For this version, you'll need 4 vectors for 7th chords, 5 vectors for 9th chords, 6 vectors for 11th chords and 7 vectors for 13 chords. If you first define a scale as a 7 vector going from C to B, then you can actually generate all of these chords by simply looping around the scale and extracting every other note similarly to how they are defined. You still have to specify when the loop terminates or else you'll get an endless chord that's inaudible. Python and many other programming languages have an actual library for different frequencies so if you define each note with a specific frequency, you can use this program to write melodies, harmonies, and entire movements.