Refactor to store notes as key-agnostic scale degrees + alterations (flat, sharp, etc.). We now think of a pitch in different ways: - *Note*: the 7 notes diatonic to C major. Notes capture the principle in western harmony of the common scales having seven distinct diatonic "notes" and allows us to do arithmetic with them (do up three scale degrees). - *Pitch*: the 12 chromatic pitches, regardless key. Pitch allows us to assign unique names and ordinal values to each note of the chromatic scale, allowing us to do arithmetic with them. - *SpelledPitch*: a unique spelling of one of the chromatic pitches (*Note* + alteration) allowing the stylistic choice to use different *Notes* to describe a single *Pitch*. - *ScaleDegree*: a variant of *SpelledPitch* that uses the scale degree instead of the *Pitch* to store a pitch in a key-agnostic manner. To illustrate, the difference, consider the flat-six in the key of Eb. - *Note*: The 6th scale degree in Eb is C (1-E 2-F 3-G 4-A 5-B 6-C). - *Pitch*: In the chromatic scale, ignoring the key, this is the *Pitch* called B. - *SpelledPitch*: In the context of the key of Eb, because this is the *Note* C, we should spell this as Cb, not B. So the spelled pitch is *Note*(C), *Alteration*(flat). - *ScaleDegree*: This captures the key-agnostic representation that we used in the begining: *Number*(6) and *Alteration*(flat) With these four ways of representing a note, we can transpose any pitches that follow western 12-tone harmony arbitrarily between keys preserving the author's choice of chord function (remembering that this is the b6 and not the #5, in our example). Building on this new notational data model, the AST now uses the *ScaleDegree* relative to the provided key as the internal representation of a pitch. Formatting of a *ScaleDegree* always requires the key in which it is being rendered. Transposition is now only a matter or updating the current key.
32 lines
1.0 KiB
Nim
32 lines
1.0 KiB
Nim
const PCO_CHORDS_VERSION* = "0.6.0"
|
|
|
|
const USAGE* = """Usage:
|
|
pco_chords [options]
|
|
pco_chords help [options]
|
|
|
|
Options:
|
|
|
|
-i, --input <in-file> Read input from <in-file> (rather than from
|
|
STDIN, which is the default).
|
|
|
|
-o, --output <out-file> Write output to <out-file> (rather than from
|
|
STDOUT, which is the default).
|
|
|
|
-t, --transpose <distance> Transpose the chart by the given number of
|
|
semitones. Distance can be expressed as a
|
|
positive or negative number of semitones,
|
|
for example: 4, +3 or -5.
|
|
|
|
-n, --number-chart Write out a chart using the Nashville number
|
|
system rather than explicit pitches.
|
|
|
|
--help Print this usage information
|
|
--debug Enable debug logging.
|
|
--echo-args Echo the input parameters.
|
|
--large-print Use the large type styling.
|
|
"""
|
|
|
|
const ONLINE_HELP* = """
|
|
|
|
"""
|