The Note object
Everything you can do with a Note, using as an example gvn:14.1.3.1.1.
Constructor
Note("gvn:14.1.3.1.1")makes a note from a short URN.Note("urn:cite2:zst:gvn:14.1.3.1.1")makes the same note from the full URN.Note("gvn:14.1")works too. The missing values default to length 1, no arsis and no hyphen.Note("gcn:1")makes the rest. ItssharpeningisNone.- An invalid URN raises
ValueError. That covers a pitch not in the table, a length outside 1–5, an arsis or hyphen value other than 0 or 1, and badly formed URNs.
Properties of a Note
n.collectiongives'gvn'.n.basegives14.n.sharpeninggives1, meaning no sharp. 2 is the first sharp and 3 the second.n.lengthgives3. 1 means no length sign; 2 to 5 are diseme, triseme, tetraseme and pentaseme.n.arsisgivesTrue.n.hyphengivesTrue.n.unicodegives'Ι', the written symbol. It depends only on the pitch.n.namegives"vocal d′".
Identity
n.urngives'gvn:14.1.3.1.1'. It always includes all five values.n.full_urngives'urn:cite2:zst:gvn:14.1.3.1.1'.str(n)gives the same asn.urn.repr(n)givesNote('gvn:14.1.3.1.1').
Vocal or instrumental
n.vocalgivesTrue.n.instrumentalgivesFalse.
Comparison
==compares all six values, soNote("gvn:11.1") == Note("gvn:11.1.1.0.0")isTrue.- Notes can go in sets and be dictionary keys.
- Notes can’t be changed after creation; assigning to an attribute raises
AttributeError.
Working with lists of notes
parse_notes(s)turns a notation-edition string into a flat list ofNoteobjects.parse_note_groups(s)gives one list per syllable, with notes joined by~kept together.groups_to_unicode(groups)turns those groups back into a Unicode string, with spaces between groups.- In an alignment, each syllable’s
note_groupholds itsNoteobjects.
TBD
- The Unicode string shows only the pitch symbol. Length, arsis and hyphen aren’t drawn in it.
- Notes can’t be sorted by pitch.