User’s Guide, Chapter 23: Roman Numeral Analysis

F major is a chord that has the notes F, A, and usually C. Those notes, placed in the same octave, instrument, dynamics, etc., should have basically the same acoustical properties each time it’s played, but human perception of this chord can seem to vary dramatically depending on the context the chord is placed in. One of the most powerful contexts that can give the same isolated sound remarkably different meanings comes from its surrounding key.

Roman numeral analysis is a way to identify certain similarities in tonal music (whether classical, folk, or popular) that have traditionally been assigned to different chords that appear on the same scale degrees in different keys.

Note

For a basic introduction to Roman numeral analysis, see the strong Wikipedia article or, for a quick review, the great PDF cheatsheet at “Learn Music Theory”

Let’s create an F-major chord but convert it to roman numerals in a few different contexts by creating different key objects. First the setup:

from music21 import *
f = chord.Chord('F4 C5 A5')
kf = key.Key('F')
sf = stream.Measure([kf, f])
sf.show()
../_images/usersGuide_23_romanNumerals_4_0.png
kc = key.Key('C')
sc = stream.Part([kc, f])
sc.show()
../_images/usersGuide_23_romanNumerals_5_0.png
kb = key.Key('B')
sb = stream.Part([kb, f])
sb.show()
../_images/usersGuide_23_romanNumerals_6_0.png

Now that we have four different keys, let’s create Roman numerals from the F major chord and each of the keys. We will use a function from the music21.roman module called romanNumeralFromChord() (which we saw briefly in Chapter 10). We pass to this function a Chord object and a Key object.

rf = roman.romanNumeralFromChord(f, kf)
rf
 <music21.roman.RomanNumeral I in F major>
rc = roman.romanNumeralFromChord(f, kc)
rc
 <music21.roman.RomanNumeral IV in C major>

Music21 tries its best to find a Roman numeral for almost any combination of chord and key, even if, like in B major:

rb = roman.romanNumeralFromChord(f, kb)
rb
 <music21.roman.RomanNumeral bV in B major>

Each RomanNumeral object has some common properties, such as .figure, .figureAndKey, .romanNumeralAlone, .key, and .scaleDegree:

(rf.figure, rc.figure, rb.figure)
 ('I', 'IV', 'bV')
rf.figureAndKey
 'I in F major'
(rf.romanNumeralAlone, rc.romanNumeralAlone, rb.romanNumeralAlone)
 ('I', 'IV', 'V')
(rf.key, rc.key, rb.key)
 (<music21.key.Key of F major>,
  <music21.key.Key of C major>,
  <music21.key.Key of B major>)
(rf.scaleDegree, rc.scaleDegree, rb.scaleDegree)
 (1, 4, 5)

Note that in the last case, the scale degree is the uninflected degree – the flat sign isn’t included in the .scaleDegree tag. For that, use .scaleDegreeWithAlteration

rf.scaleDegreeWithAlteration
 (1, None)
rb.scaleDegreeWithAlteration
 (5, <music21.pitch.Accidental flat>)

Or look at the .frontAlterationString, frontAlterationAccidental, and frontAlterationTransposeInterval

rb.frontAlterationString
 'b'
rb.frontAlterationAccidental
 <music21.pitch.Accidental flat>
rb.frontAlterationTransposeInterval
 <music21.interval.Interval d1>

Of course, some RomanNumerals make more sense than others, so there’s a .functionalityScore which returns a number from 0 to 100 as a rough approximation of how “functional” this chord is:

(rf.functionalityScore, rc.functionalityScore, rb.functionalityScore)
 (100, 59, 0)

As I hinted at above, RomanNumeral objects are Music21Objects so they can be put into Streams and showed:

s = stream.Measure()
s.insert(0, rf)
s.show()
../_images/usersGuide_23_romanNumerals_28_0.png

Note that the spacing of the roman numeral is preserved from the chord that it was converted from. If we create a RomanNumeral object directly, then it is created in closed position above a tonic note in octave 4:

rf2 = roman.RomanNumeral('I', kf)
rf2
 <music21.roman.RomanNumeral I in F major>
rf2.show()
../_images/usersGuide_23_romanNumerals_31_0.png

It is possible to pass in just a roman numeral (“I”, “ii”, “iii”, “IV”, etc.) and a string (“C” = C major, “c” = c minor) to create a RomanNumeral object:

subDom7 = roman.RomanNumeral("IV7", "B-")
subDom7.show()
../_images/usersGuide_23_romanNumerals_33_0.png
e65 = roman.RomanNumeral("ii65", "E")
e65.show()
../_images/usersGuide_23_romanNumerals_34_0.png

For these romanNumerals, there is information after the .romanNumeralAlone this can be found as a string in .figuresWritten:

(subDom7.figuresWritten, e65.figuresWritten)
 ('7', '65')

These numbers can also be found as part of a more powerful figuredBass.Notation object (to be discussed later) in the .figuresNotationObj attribute:

(subDom7.figuresNotationObj, e65.figuresNotationObj)
 (<music21.figuredBass.notation.Notation 7>,
  <music21.figuredBass.notation.Notation 6,5>)
e65.figuresNotationObj.numbers
 (6, 5, 3)

Many of these properties can be changed:

rf.key = key.Key('D')
rf.show()
../_images/usersGuide_23_romanNumerals_41_0.png

Changing the key removes any information about pitch spacing. You can’t have everything. :-)

We’ll put the key of F back and the original pitches before we forget:

rf = roman.romanNumeralFromChord(f, kf)

RomanNumerals as Chords

A RomanNumeral object is a subclass of a Chord object, therefore we can do everything with them that we could do with a chord. For instance:

rf.isMajorTriad()
 True
rfc = rf.closedPosition()
rfc.show()
../_images/usersGuide_23_romanNumerals_47_0.png
rb.lyric = rb.figure
rb.show()
../_images/usersGuide_23_romanNumerals_48_0.png
(rf.quality, rc.quality, rb.quality)
 ('major', 'major', 'major')
e65.inversion()
 1
e65.primeForm
 [0, 3, 5, 8]
e65.semitonesFromChordStep(7)
 10

That’s all we have for RomanNumerals for now – we will return to RomanNumeral like objects later when we look at other Harmony objects such as ChordSymbols and FiguredBass and we look at the romanText module. But we’ll take a break from musical objects and get acquainted a bit better with how your system works when running music21 with a look at Chapter 24, Environment.