Chords and Inversions

Problem #64

Tags: music

Who solved this?

Previous:Scales and the Circle of Fifths Next:Equal Temperament


By now we've learned a little bit about notes, intervals and scales, but if we take any given group of three notes from a scale and play them simultaneously, we may find that some groups sound different than others. A group of notes played together is called a Chord, and chords consisting of 3 notes are specifically called Traids.

A typical Triad consists of 3 notes stacked in thirds, and so there is some Root note or Bass note, then the 3rd interval above the root, and also the 5th interval above the root. However you may recall that there are both Major 3rd and Minor 3rd intervals, and so depending on which one we use for our triad we will produce either a Major or Minor chord. For example, the C-Major chord consists of the notes C E G, whereas the C-Minor chord consists of the notes C Eb G.

Let's take a look at the D-Major scale for a moment and look at all the triads we could make from it. Starting on each note, we make the following chords:

Chord Name Notes in Triad Chord Notation
D-Major D, F#, A I
E-Minor E, G, B ii
F#-Minor F#, A, C# iii
G-Major G, B, D IV
A-Major A, C#, E V
B-Minor B, D, F# vi
C#-Diminished C#, E, G vii_o


Let's recognize a few things here. Firstly that each chord is made from stacking thirds upwards from the root as discussed above, and also that the intervals between the notes define the Quality of the chord - with Major chords having the intervals M3 P5 from the root, Minor chords having intervals m3 P5, and Diminished chords having intervals m3 TT. We can hear these three chord qualities sounding very different when played aloud:

There exist many more chord qualities than these three listed above, but for now we will stick to these three.

Also pay attention to the notation used to describe the chords - the scale degree is in Roman numerals, uppercase for Major chords, lowercase for Minor chords, and for Diminished chords it is lowercase with a _o added to the end.

The chords played in the above audio files are such that the Root note has the lowest frequency (called root position), then the 3rd having the next-highest frequency and the 5th above that, in the order D F# A. But there's no reason why we couldn't instead take F# as our bass note then add the 3rd and 6th, or instead take A as the bass note then add the 4th and 6th intervals. In all circumstances we would still end up with the notes D F# A, and so in all cases we would have a D-Major chord but with a different bass note. These are called Inversions of the chord, and have different notation.

Inversion Name Note order for
D-Major chord
Figured Bass
Chord Notation
Root position D, F#, A I
1st Inversion F#, A, D I_6
2nd Inversion A, D, F# I_64


And so we can see that the notation really just describes the intervals stacked above the bass note, assuming 3rds when nothing is otherwise specified.

We should clarify a few more things before concluding, just for your general understanding. Firstly, only the note in root position matters when defining an inversion, and really the higher notes can be in any order, so A F# D would still be written as I_64 (but for the sake of this problem, please report them in their "closest-packed" sequential order). Additionally while these notations are written in plaintext for this purpose of communicating the problem, the typical chord notation is written with superscripts and subscripts in this format:

$$\huge \text{I}^6 \;\;\;\;\; \text{V}^6_4 \;\;\;\;\; \text{vii}\degree$$

Problem Statement

Input Data
First line is Q, the quantity of testcases.
Q lines then follow, each with two values: a Note name indicating the tonic note of a Major scale, and then a chord name in the notation style detailed above.

Answer
Should consists of 3 * Q space-separated note names, corresponding to the notes in each chord name listed.
Report all triads in their "closest-packed" sequential order in regards to pitch.
Refer to all note names using the proper notation in the associated scale.

Example

input data:
4
C I
G V_6
Bb vii_o_64

answer:
C E G F# A D Eb A C 
You need to login to get test data and submit solution.