Construct chords of stacked thirds, based on scale degrees

chord_degree  degree (symbol_or_number), tonic (symbol), scale (symbol), number_of_notes (number)

In music we build chords from scales. For example, a C major chord is made by taking the 1st, 3rd and 5th notes of the C major scale (C, E and G). If you do this on a piano you might notice that you play one, skip one, play one, skip one etc. If we use the same spacing and start from the second note in C major (which is a D), we get a D minor chord which is the 2nd, 4th and 6th notes in C major (D, F and A). We can move this pattern all the way up or down the scale to get different types of chords. chord_degree is a helper method that returns a ring of midi note numbers when given a degree (starting point in a scale) which is a symbol :i, :ii, :iii, :iv, :v, :vi, :vii or a number 1-7. The second argument is the tonic note of the scale, the third argument is the scale type and finally the fourth argument is number of notes to stack up in the chord. If we choose 4 notes from degree :i of the C major scale, we take the 1st, 3rd, 5th and 7th notes of the scale to get a C major 7 chord.

Introduced in v2.1

Examples

# Example 1

puts (chord_degree :i, :A3, :major)



# returns a ring of midi notes - (ring 57, 61, 64, 68) - an A major 7 chord



# Example 2

play (chord_degree :i, :A3, :major, 3)



 



# Example 3

play (chord_degree :ii, :A3, :major, 3)



# Chord ii in A major is a B minor chord



# Example 4

play (chord_degree :iii, :A3, :major, 3)



# Chord iii in A major is a C# minor chord



# Example 5

play (chord_degree :iv, :A3, :major, 3)



# Chord iv in A major is a D major chord



# Example 6

play (chord_degree :i, :C4, :major, 4)



# Taking four notes is the default. This gives us 7th chords - here it plays a C major 7



# Example 7

play (chord_degree :i, :C4, :major, 5)



# Taking five notes gives us 9th chords - here it plays a C major 9 chord



# Example 8

play (chord_degree :i, :C4, :major, 3, invert: 1)



# Play the first inversion of chord i in C major - (ring 64, 67, 72)