Skip to main content

Module harm

Module harm 

Source
Expand description

The harmonic annotations a **harm spine carries: music21’s humdrum.harmParser.

A **harm token is a scale degree with what is written round it – V7b, #IVo7, Gnd, V/V/V, (I), I[V] – and the two notations are not the same, so music21 converts one into the other: a V7b there is a V65 to a RomanNumeral, the inversion letter standing for the figured bass. The representation is described at https://www.humdrum.org/rep/harm/.

music21 reads a token with a regular expression; the crate has none, so Harm::parse reads it by hand in the same order – the accidental, the degree, the quality, the intervals, the inversion, an alternative reading in brackets, and a secondary function after a slash. The two agree on every token music21’s own tests and docstrings name, and on the ones they do not: harm::tests holds forty more read off music21.

The degree is matched longest first where music21’s alternation tries the shortest and backtracks. The two come to the same thing, since no prefix of a degree (i, v, I, V) is a quality, an interval, an inversion, a bracket or a slash, so a shorter degree never leaves something the rest of the token can read.

Structs§

Harm
A **harm annotation read: music21’s HarmParser.parse, whose answer is a dictionary of these same parts.

Functions§

convert_harm_to_roman
The figure a **harm token stands for, or nothing where it is no token: music21’s convertHarmToRoman.