17 Commits

Author SHA1 Message Date
97ef8a7491 Fix parsing of G#. Tweak large print stylesheet. 0.6.1 2025-06-03 01:13:11 -05:00
9741c55cee Additional documentation about the new notation data model. 2025-06-03 00:34:58 -05:00
25d7ddcd1b Major refactor of internal note storage to better support transposition.
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.
0.6.0
2025-06-02 23:07:41 -05:00
533089431e Use better heuristics for chord pitch naming.
Previously we used a heuristic for choosing pitch names based on the
major scale degree, minimizing radicals. So, for example, in the key of
Gb, we render the 4 as Cb rather than B because Bb is the 3 of Gb. In
other words, we want 1:Gb, 2:Ab, 3:Bb, 4:Cb instead of re-using B. This
is standard practice in western music notation.

When rendering non-diatonic notes we prefered choosing the version that
minimized the radicals. Again in the key of Gb we would choose to render
E as E (the #6) rather than considering it as Fb (the b7) and choose to
render D as D (the #5) rather than E𝄫 (the b6). This was chosen to
reduce the number of unusual radicals like 𝄫.

However, in practice this leads to unusual charts because it is more
common when writing chordal harmony to use the b6 rather than the #5.
Similarly the b7 is far more common than the #6. This is, I think, due
to the prevalence of the major scale and minor scales and the fact that
the minor scale is built from flatting the 3, 6, and 7 of the major
scale. So when thinking in a key-center agnostic manner (like numbers)
we almost always think about these altered scale degrees as being
flatted relative to the major scale, not sharped. Because of this, in
the key of Gb, we would prefer to render a b6, b7, 1 chord walkup as
E𝄫, Fb, Gb rather than D, E, Gb.

This change redefines the heuristic used to name chord pitches to follow
a heuristic that covers all pitches in the octave based on scale degree:
1, b2, 2, b3, 3, 4, b5, 5, b6, 6, b7, 7
0.5.6
2025-06-02 10:59:52 -05:00
d7dd509138 Tweak styling to make the lead sheet more compact. 2025-06-01 07:28:42 -05:00
73bdb97881 Support one- and two-column layouts. Transposing keys doesn't start a new section. 0.5.5 2025-04-26 11:40:55 -05:00
a57aed0715 Fix chord parsing, formatting. 0.5.4 2025-04-11 15:47:53 -05:00
2712f9ff52 Key of C should use flats for accidentals. 0.5.2 2024-03-21 18:51:48 -05:00
8271129b90 Better support for transposition and Nashville numbers.
- Non-diatonic pitches are supported using Nashville numbers (#5).
- When using Nashville numbers chord variants with non-diatonic roots
  are now recognized (e.g. b7)
- Pitch rendering is now aware of key centers. For example, F# is F#
  rendered as F# when in the key of G but Gb when in the key of Ab.
0.5.1
2024-01-10 08:23:19 -06:00
5b1238f038 Support for number charts, transposition when generating charts. 0.5.0 2023-07-19 13:26:01 -05:00
9ca5a1b99c Support additional text on the same lines as section headings. 2023-07-19 13:23:59 -05:00
e832b91443 Bugfix: recognize Cb as a valid pitch. 0.4.1 2023-02-07 12:07:55 -06:00
2acfb42a38 Add support for specifying the song order in the metadata section. 0.4.0 2023-02-06 21:44:47 -06:00
4833cc4f37 Better column support, redefine keys.
- Fix transposition bug (wrap around past G->A)
- Better chord parsing and handling (bass transposed correctly)
- Add column and page break support.
0.3.1
2022-10-29 10:56:56 -05:00
4a6519b1a7 Refactors to support key transposition. 2022-10-05 10:48:05 -05:00
6a3793cb0a Refactor to support naked chords. 2022-10-05 08:59:24 -05:00
8515546c89 Initial commit: initial implementation. 2022-08-20 07:23:03 -05:00