Class defining a single note in TinyNotation. The “note” attribute returns a Note object.
See docs for TinyNotationStream for usage.
Simple example:
>>> tnN = tinyNotation.TinyNotationNote("c8")
>>> m21Note = tnN.note
>>> m21Note
<music21.note.Note C>
>>> m21Note.octave
4
>>> m21Note.duration
<music21.duration.Duration 0.5>
Very complex example:
>>> tnN = tinyNotation.TinyNotationNote("AA-4.~=aflat_hel-")
>>> m21Note = tnN.note
>>> m21Note.name
'A-'
>>> m21Note.octave
2
>>> m21Note.lyric
'hel'
>>> m21Note.id
'aflat'
The optional third element is a dictionary of stored information from previous notes that might affect parsing of this note:
>>> storedDict = {}
>>> storedDict['lastNoteTied'] = True
>>> storedDict['inTrip'] = True
>>> tnN = tinyNotation.TinyNotationNote("d''#4", storedDict)
>>> tnN.note.tie
<music21.tie.Tie stop>
>>> tnN.note.duration.quarterLength
0.6666666...
TinyNotationNote read-only properties
TinyNotationNote methods
method to create a note object in sub classes of tiny notation. Should return a Note-like object or None
Subclassable method to set the dots attributes of the duration object.
It is subclassed in music21.trecento.cadencebook.TrecentoNote where double dots are redefined as referring to multiply by 2.25 (according to a practice used by some Medieval musicologists).
helper method that takes the dictionary self.regularExpressions (which should be a shared, class-level object) and compiles each one if it hasn’t already been compiled and makes it an attribute of the class. See setupRegularExpressions() in TinyNotationStream for more details.
A TinyNotationStream takes in a string representation similar to Lilypond format but simplified somewhat.
Can also take in an optional time signature string (or TimeSignature object) as a second argument, but this is mostly for historical reasons.
Example in 3/4:
>>> stream1 = tinyNotation.TinyNotationStream("3/4 E4 r f# g=lastG trip{b-8 a g} c4~ c")
>>> stream1.show('text')
{0.0} <music21.meter.TimeSignature 3/4>
{0.0} <music21.note.Note E>
{1.0} <music21.note.Rest rest>
{2.0} <music21.note.Note F#>
{3.0} <music21.note.Note G>
{4.0} <music21.note.Note B->
{4.3333} <music21.note.Note A>
{4.6667} <music21.note.Note G>
{5.0} <music21.note.Note C>
{6.0} <music21.note.Note C>
>>> stream1.getElementById("lastG").step
'G'
>>> stream1.notesAndRests[1].isRest
True
>>> stream1.notesAndRests[0].octave
3
>>> stream1.notes[-2].tie.type
'start'
>>> stream1.notes[-1].tie.type
'stop'
Changing time signatures are supported:
>>> s1 = converter.parse('tinynotation: 3/4 C4 D E 2/4 F G A B 1/4 c')
>>> s1.show('t')
{0.0} <music21.meter.TimeSignature 3/4>
{0.0} <music21.note.Note C>
{1.0} <music21.note.Note D>
{2.0} <music21.note.Note E>
{3.0} <music21.meter.TimeSignature 2/4>
{3.0} <music21.note.Note F>
{4.0} <music21.note.Note G>
{5.0} <music21.note.Note A>
{6.0} <music21.note.Note B>
{7.0} <music21.meter.TimeSignature 1/4>
{7.0} <music21.note.Note C>
>>> s2 = s1.makeMeasures()
>>> s2.show('t')
{0.0} <music21.stream.Measure 1 offset=0.0>
{0.0} <music21.clef.BassClef>
{0.0} <music21.meter.TimeSignature 3/4>
{0.0} <music21.note.Note C>
{1.0} <music21.note.Note D>
{2.0} <music21.note.Note E>
{3.0} <music21.stream.Measure 2 offset=3.0>
{0.0} <music21.meter.TimeSignature 2/4>
{0.0} <music21.note.Note F>
{1.0} <music21.note.Note G>
{5.0} <music21.stream.Measure 3 offset=5.0>
{0.0} <music21.note.Note A>
{1.0} <music21.note.Note B>
{7.0} <music21.stream.Measure 4 offset=7.0>
{0.0} <music21.meter.TimeSignature 1/4>
{0.0} <music21.note.Note C>
{1.0} <music21.bar.Barline style=final>
TinyNotationStream bases
TinyNotationStream read-only properties
Read-only properties inherited from Stream:
Read-only properties inherited from Music21Object:
TinyNotationStream read/write properties
Read/write properties inherited from Stream:
Read/write properties inherited from Music21Object:
TinyNotationStream methods
called out so as to be subclassable, returns a TinyNotationNote object
helper method that takes the dictionary self.regularExpressions (which should be a shared, class-level object) and compiles each one if it hasn’t already been compiled and makes it an attribute of the class.
For instance, if you have:
>>> regularExpressions = {'PUNCTUS': 'p', 'BREVE': 'b+'}
calling self.setupRegularExpressions will replace p and b+ with re.compile versions of the same and make self.PUNCTUS = re.compile(‘p’), etc.
from music21 import tinyNotation dummy = reload(tinyNotation) # show before and after print(tinyNotation.TinyNotationStream.regularExpressions)
<_sre.SRE_Pattern object at 0x...>
Methods inherited from Stream:
Methods inherited from Music21Object:
TinyNotationStream instance variables
Instance variables inherited from Stream:
Instance variables inherited from Music21Object:
HarmonyStream provides an example of subclassing TinyNotationStream to include harmonies and lyrics encoded in a simple format.
>>> michelle = "c2*F*_Mi- c_chelle r4*B-m7* d-_ma A-2_belle "
>>> michelle += "G4*E-*_these c_are A-_words G_that "
>>> michelle += "F*Ddim*_go A-_to- Bn_geth- A-_er"
>>> hns = tinyNotation.HarmonyStream(michelle, "4/4")
>>> ns = hns.notesAndRests
>>> ns[0].step
'C'
>>> ns[0].editorial.misc['harmony']
'F'
>>> ns[0].lyric # note that hyphens are removed
'Mi'
>>> ns[2].isRest
True
>>> ns[5].name
'G'
>>> ns[7].name
'A-'
HarmonyStream bases
HarmonyStream read-only properties
Read-only properties inherited from Stream:
Read-only properties inherited from Music21Object:
HarmonyStream read/write properties
Read/write properties inherited from Stream:
Read/write properties inherited from Music21Object:
HarmonyStream methods
Methods inherited from TinyNotationStream:
Methods inherited from Stream:
Methods inherited from Music21Object:
HarmonyStream instance variables
Instance variables inherited from TinyNotationStream:
|
|
|
Instance variables inherited from Stream:
Instance variables inherited from Music21Object:
HarmonyNote bases
HarmonyNote read-only properties
Read-only properties inherited from TinyNotationNote:
HarmonyNote methods
checks to see if a note has markup in the form TEXT and if so, stores TEXT in the notes editorial.misc[] dictionary object
See the demonstration in the docs for class HarmonyLine.
Methods inherited from TinyNotationNote: