harmony
harmony copied to clipboard
RomanText
Recently, I have realized that pickup measures are difficult to handle in the current input representation for this algorithm. Then, I thought that the RomanText notation, which is already included with music21, can help mitigating this problem in the long run.
The RomanText is a notation introduced in 2019 for dealing with Roman Numeral Analysis.
It is currently integrated with music21 and it allows to parse a file like this:
Composer: Eric Zhang
Title: Example progression
Time signature: 6/8
m1 b1 Bb: I b1.66 I6 b2 IV b2.66 V43/ii
m2 b1 ii b1.67 V b2 V7 b2.33 I
into a music21 stream like this:
In [1]: import music21
In [2]: s = music21.converter.parse('example.rntxt')
In [3]: s.show('text')
{0.0} <music21.metadata.Metadata object at 0x7f5df0f1b2b0>
{0.0} <music21.stream.Part 0x7f5e165bff70>
{0.0} <music21.stream.Measure 1 offset=0.0>
{0.0} <music21.key.Key of B- major>
{0.0} <music21.meter.TimeSignature 6/8>
{0.0} <music21.roman.RomanNumeral I in B- major>
{1.0} <music21.roman.RomanNumeral I6 in B- major>
{1.5} <music21.roman.RomanNumeral IV in B- major>
{2.5} <music21.roman.RomanNumeral V43/ii in B- major>
{3.0} <music21.stream.Measure 2 offset=3.0>
{0.0} <music21.roman.RomanNumeral ii in B- major>
{1.0} <music21.roman.RomanNumeral V in B- major>
{1.5} <music21.roman.RomanNumeral V7 in B- major>
{2.0} <music21.roman.RomanNumeral I in B- major>
and a score like this one:
In [4]: s.show()
More specifically, it can provide a mechanism to enter
- Key (and key changes)
- Time Signature (and time signature changes)
- Durations
- Roman Numerals
Which are the same parameters used for this project. The advantage is that a stream parsed from a RomanText file provides other parameters, such as pickup measures and time offsets for each RomanNumeral
object.
The file format is well documented, it is super easy to parse using music21, and it ensures that certain things work without extra effort (e.g., len(durations) == len(chord_progression)
). Also, there is a good collection of scores in this format, which would be immediately available to try out with this algorithm.
This PR just adds a superficial compatibility at the entry point. If you get on board with the idea, I can suggest some ways to make it work in a nicer way (but requiring more changes).