tinyNotation is 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/

Here are the most important rules:

  1. Note names are: a,b,c,d,e,f,g and r for rest

  2. 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.

  3. 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.

  4. 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.

  5. 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.)

  6. 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.)

an alpha complete rewrite of tinyNotation.

tinyNotation was one of the first modules of music21 and one of my first attempts to program in Python. and it shows.

this is what the module should have been... from mistakes learned and insights from ABC etc. parsing.

keeping both until this becomes stable.

>>> tnc = tinyNotation.Converter("3/4 E4 r f# g=lastG trip{b-8 a g} c4~ c")
>>> stream1 = tnc.parse().stream
{0.0} < 1 offset=0.0>
    {0.0} <music21.clef.TrebleClef>
    {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} < 2 offset=3.0>
    {0.0} <music21.note.Note G>
    {1.0} <music21.note.Note B->
    {1.3333} <music21.note.Note A>
    {1.6667} <music21.note.Note G>
    {2.0} <music21.note.Note C>
{6.0} < 3 offset=6.0>
    {0.0} <music21.note.Note C>
    {1.0} < style=final>
>>> stream1.flat.getElementById("lastG").step
>>> stream1.flat.notesAndRests[1].isRest
>>> stream1.flat.notesAndRests[0].octave
>>> stream1.flat.notes[-2].tie.type
>>> stream1.flat.notes[-1].tie.type

Changing time signatures are supported:

>>> s1 = converter.parse('tinynotation: 3/4 C4 D E 2/4 F G A B 1/4 c')
{0.0} < 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} < 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} < 3 offset=5.0>
    {0.0} <music21.note.Note A>
    {1.0} <music21.note.Note B>
{7.0} < 4 offset=7.0>
    {0.0} <music21.meter.TimeSignature 1/4>
    {0.0} <music21.note.Note C>
    {1.0} < style=final>


class music21.tinyNotation.Converter(stringRep='', **keywords)

Main conversion object for TinyNotation.

Accepts one keyword: makeNotation=False to get “classic” TinyNotation formats.

Converter methods


splitPreTokens, setupRegularExpressions, then run through each preToken, and run postParse.

Converter.parseOne(i, t)

parse a single token at position i, with text t.

Checks for state changes, modifiers, tokens, and end-state brackets.


Call postParse calls on .stream, currently just .makeMeasures.


Regular expressions get compiled for faster usage.


splits the string into textual tokens.

Right now just splits on spaces, but might be smarter to ignore spaces in quotes, etc. later.


class music21.tinyNotation.IdModifier(modifierData, modifierString, parent)

sets the .id of the m21Obj, called with =

IdModifier bases

IdModifier methods


Methods inherited from Modifier:


class music21.tinyNotation.LyricModifier(modifierData, modifierString, parent)

sets the .lyric of the m21Obj, called with _

LyricModifier bases

LyricModifier methods


Methods inherited from Modifier:


class music21.tinyNotation.Modifier(modifierData, modifierString, parent)

a modifier is something that changes the current token, like setting the Id or Lyric.

Modifier methods


called after the tokenString has been truend into an m21Obj. m21Obj may be None


called before the tokenString has been turned into an object


class music21.tinyNotation.NoteOrRestToken(token='')

represents a Note or Rest. Chords are represented by Note objects

NoteOrRestToken bases

NoteOrRestToken methods

NoteOrRestToken.applyDuration(n, t, parent)

takes the information in the string t and creates a Duration object for the note or rest n.

NoteOrRestToken.dots(n, search, pm, t, parent)

adds the appropriate number of dots to the right place.

Subclassed in TrecentoNotation where two dots has a different meaning.

NoteOrRestToken.durationType(n, search, pm, t, parent)

The result of a successful search for a duration type: puts a Duration in the right place.

Methods inherited from Token:


class music21.tinyNotation.NoteToken(token='')

A NoteToken represents a single Note with pitch

NoteToken bases

NoteToken methods

NoteToken.editorialAccidental(n, search, pm, t)

indicates that the accidental is in parentheses, so set it up to be stored in ficta.

NoteToken.flats(n, search, pm, t)

called when one or more flats have been found.

NoteToken.getPitch(n, t)
NoteToken.highOctave(n, search, pm, t)

Called when a note of octave 4 or higher is encountered.

NoteToken.lowOctave(n, search, pm, t)

Called when a note of octave 3 or below is encountered.

NoteToken.natural(n, search, pm, t)

called when an explicit natural has been found. All pitches are natural without being specified, so not needed.


Extract the pitch from the note.

NoteToken.sharps(n, search, pm, t)

called when one or more sharps have been found.

Methods inherited from NoteOrRestToken:


class music21.tinyNotation.QuadrupletState(parent, stateInfo)

a 4:3 tuplet

QuadrupletState bases

QuadrupletState methods

Methods inherited from TupletState:

Methods inherited from State:


class music21.tinyNotation.RestToken(token='')

A token starting with ‘r’, representing a rest.

RestToken bases

RestToken methods


Methods inherited from NoteOrRestToken:


class music21.tinyNotation.StarModifier(modifierData, modifierString, parent)

does nothing, but easily subclassed. Uses ... to make it happen

StarModifier bases

StarModifier methods

Methods inherited from Modifier:


class music21.tinyNotation.State(parent, stateInfo)

State tokens apply something to every note found within it.

State methods


called to modify the tokenObj after parsing

tokenObj may be None if another state has deleted it.


called after the object has been acquired but before modifiers have been applied.


called to modify the string of a token.


called just after removing state


called when the state is initiated


class music21.tinyNotation.TieState(parent, stateInfo)

A TieState is an autoexpiring state that applies a tie start to this note and a tie stop to the next note.

TieState bases

TieState methods


end the tie state by applying tie ties to the appropriate notes

Methods inherited from State:


class music21.tinyNotation.TimeSignatureToken(token='')

Represents a single time signature, like 1/4

TimeSignatureToken bases

TimeSignatureToken methods



class music21.tinyNotation.Token(token='')

A single token made from the parser.

Call .parse(parent) to make it work.

Token methods


do NOT store parent – probably too slow


class music21.tinyNotation.TripletState(parent, stateInfo)

a 3:2 tuplet

TripletState bases

TripletState methods

Methods inherited from TupletState:

Methods inherited from State:


class music21.tinyNotation.TupletState(parent, stateInfo)

a tuplet state applies tuplets to notes while parsing and sets ‘start’ and ‘stop’ on the first and last note when end is called.

TupletState bases

TupletState methods


puts a tuplet on the note


end a tuplet by putting start on the first note and stop on the last.

Methods inherited from State: