Table Of Contents

Previous topic

music21.tempo

Next topic

music21.xmlnode

music21.tinyNotation

tinyNotation – a simple way of specifying single line melodies that uses a notation somewhat similar to Lilypond but with WAY fewer options. It was originally developed to notate trecento (medieval Italian) music, but it is pretty useful for a lot of short examples, so we have made it a generally supported music21 format N.B.: TinyNotation is not meant to expand to cover every single case. Instead it is meant to be subclassable to extend to the cases your project needs. See for instance the harmony examples in HarmonyStream and HarmonyNote or the Trecento specific examples in trecento/cadencebook.py Here are the most important rules: Note names are: a,b,c,d,e,f,g and r for rest Flats, sharps, and naturals are notated as #,- (not b), and (if needed) n. If the accidental is above the staff (i.e., editorial), enclose it in parentheses: (#), etc. Make sure that flats in the key signatures are explicitly specified. Note octaves are specified as follows: CC to BB = from C below bass clef to second-line B in bass clef C to B = from bass clef C to B below middle C. c to b = from middle C to the middle of treble clef c’ to b’ = from C in treble clef to B above treble clef Octaves below and above these are specified by further doublings of letter (CCC) or apostrophes (c’‘) – this is one of the note name standards found in many music theory books. After the note name, a number may be placed indicating the note length: 1 = whole note, 2 = half, 4 = quarter, 8 = eighth, 16 = sixteenth. etc. If the number is omitted then it is assumed to be the same as the previous note. I.e., c8 B c d is a string of eighth notes. After the number, a ~ can be placed to show a tie to the next note. A “.” indicates a dotted note. (If you are entering data via Excel or other spreadsheet, be sure that “capitalize the first letter of sentences” is turned off under “Tools->AutoCorrect,” otherwise the next letter will be capitalized, and the octave will be screwed up. For triplets use this notation: trip{c4 d8} indicating that these two notes both have “3s” over them. For 4 in the place of 3, use quad{c16 d e8}. No other tuplets are supported. Again, see the HarmonyStream (below) and trecento.cadencebook examples to see how to make TinyNotation useful for your own needs. (Currently, final notes with fermatas (or any very long final note), take 0 for the note length. But expect this to disappear from the TinyNotation specification soon, as it’s too Trecento specific.)

TinyNotationNote

class music21.tinyNotation.TinyNotationNote(stringRep, storedDict={})
>>> from music21 import *
>>> tcN = tinyNotation.TinyNotationNote("AA-4.~=aflat_hel-")
>>> note1 = tcN.note
>>> note1.name
'A-'
>>> note1.octave
2
>>> note1.lyric
'hel'
>>> note1.id
'aflat'

TinyNotationNote methods

customNotationMatch(m21NoteObject, stringRep, storedDict)
No documentation.
customPitchMatch(stringRep, storedDict)
method to create a note object in sub classes of tiny notation. Should return a Note-like object or None
getDots(stringRep, noteObj)
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).

TinyNotationStream

Inherits from: Stream, Music21Object, JSONSerializer

class music21.tinyNotation.TinyNotationStream(stringRep=, timeSignature=None)

A TinyNotationStream takes in a string representation similar to Lilypond format but simplified somewhat and an optional time signature string (or TimeSignature object). example in 3/4:

>>> stream1 = TinyNotationStream("E4 r f# g=lastG trip{b-8 a g} c", "3/4")
>>> 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.33333333333} <music21.note.Note A>
{4.66666666667} <music21.note.Note G>
{5.0} <music21.note.Note C>
>>> stream1.getElementById("lastG").step
'G'
>>> stream1.notes[1].isRest
True
>>> stream1.notes[0].octave
3

TinyNotationStream attributes

Attributes without Documentation: stringRep

Attributes inherited from Stream: isMeasure, isFlat, autoSort, isSorted, flattenedRepresentationOf

Attributes inherited from Music21Object: classSortOrder, hideObjectOnPrint, id, groups

TinyNotationStream properties

Properties inherited from Stream: notes, pitches, beat, beatDuration, beatStr, beatStrength, derivationChain, derivationMethod, derivesFrom, duration, elements, flat, highestOffset, highestTime, isGapless, lily, lowestOffset, metadata, midiFile, midiTracks, musicxml, mx, offsetMap, rootDerivation, semiFlat, sorted, spanners, voices

Properties inherited from Music21Object: activeSite, classes, derivationHierarchy, measureNumber, offset, priority

Properties inherited from JSONSerializer: json

TinyNotationStream methods

getNote(stringRep, storedDict={})
called out so as to be subclassable

Methods inherited from Stream: append(), insert(), insertAndShift(), transpose(), augmentOrDiminish(), scaleOffsets(), scaleDurations(), addGroupForElements(), allPlayingWhileSounding(), analyze(), attachIntervalsBetweenStreams(), attributeCount(), bestClef(), expandRepeats(), explode(), extendDuration(), extractContext(), findConsecutiveNotes(), findGaps(), getClefs(), getElementAfterElement(), getElementAfterOffset(), getElementAtOrAfter(), getElementAtOrBefore(), getElementBeforeElement(), getElementBeforeOffset(), getElementById(), getElementByObjectId(), getElementsByClass(), getElementsByGroup(), getElementsByOffset(), getElementsNotOfClass(), getInstrument(), getKeySignatures(), getOffsetByElement(), getOverlaps(), getSimultaneous(), getTimeSignatures(), groupCount(), groupElementsByOffset(), hasElement(), hasMeasures(), hasPartLikeStreams(), hasVoices(), index(), indexList(), insertAtNativeOffset(), internalize(), invertDiatonic(), isSequence(), makeAccidentals(), makeBeams(), makeChords(), makeMeasures(), makeNotation(), makeRests(), makeTies(), makeTupletBrackets(), measure(), measureOffsetMap(), measures(), melodicIntervals(), mergeElements(), pitchAttributeCount(), playingWhenAttacked(), plot(), pop(), quantize(), recurse(), remove(), repeatAppend(), repeatInsert(), replace(), setDerivation(), setupPickleScaffold(), shiftElements(), simultaneousAttacks(), sliceAtOffsets(), sliceByBeat(), sliceByGreatestDivisor(), sliceByQuarterLengths(), sort(), splitByClass(), storeAtEnd(), stripTies(), teardownPickleScaffold(), transferOffsetToElements(), trimPlayingWhileSounding(), voicesToParts()

Methods inherited from Music21Object: addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextAttr(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), searchParentByAttr(), setContextAttr(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

HarmonyStream

Inherits from: TinyNotationStream, Stream, Music21Object, JSONSerializer

class music21.tinyNotation.HarmonyStream(stringRep=, timeSignature=None)

example of subclassing TinyNotationStream to include a possible harmonic representation of the note

>>> 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 = HarmonyStream(michelle, "4/4")
>>> ns = hns.notes
>>> 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-'

HarmonyNote

Inherits from: TinyNotationNote

class music21.tinyNotation.HarmonyNote(stringRep, storedDict={})

HarmonyNote methods

customNotationMatch(m21NoteObject, stringRep, storedDict)
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: customPitchMatch(), getDots()