Basic tools for working with Braille in music21. Most users will not need to use these. Simply call .show(‘braille’) or .show(‘braille.ascii’)

>>> soprano = corpus.parse('bwv66.6').parts[0]
    #J .DJ [W?<L$ ?W[<L? IJ\]<L[ WW]$ [W?<L?
      "[W?[ \]R<L Q]]@C ]G%F]<L<K

Normally this would open up in a new window. But to store the data, use converter.toData(…, ‘braille’). Here we show this in Unicode braille (the default for format braille)

>>> data = converter.toData(soprano, 'braille')
>>> print(data)

Any Music21Object which cannot be transcribed in basic returns a braille literary question mark and outputs a warning to the console, rather than raising an exception. This is so that a transcription of a Stream in translate is completed as thoroughly as possible.



Takes in a Barline and returns its representation as a braille string in UTF-8 unicode.


Only dashed, double barlines, and final barlines can be transcribed.

>>> from music21.braille.basic import barlineToBraille
>>> doubleBarline = bar.Barline('double')
>>> print(barlineToBraille(doubleBarline))
>>> finalBarline = bar.Barline('final')
>>> print(barlineToBraille(finalBarline))

Heavy gives an “unusual barline” symbol

>>> heavyBarline = bar.Barline('heavy')
>>> print(barlineToBraille(heavyBarline))

music21.braille.basic.brailleAsciiToBrailleUnicode(brailleAscii: str) str

translates a braille ASCII string to braille UTF-8 unicode, which can then be displayed on-screen in braille on compatible systems.


The function works by corresponding ASCII symbols to braille symbols in a very direct fashion. It is not a translator from plain text to braille, because ASCII symbols may not correspond to their equivalents in braille. For example, a literal period is a 4 in braille ASCII. Also, all letters are translated into their lowercase equivalents, and any capital letters are indicated by preceding them with a comma.

>>> t1 = braille.basic.brailleAsciiToBrailleUnicode(',ANDANTE ,MAESTOSO4')
>>> t1
>>> t2 = braille.basic.tempoTextToBraille(tempo.TempoText('Andante Maestoso'))
>>> t1 == t2

translates a braille UTF-8 unicode string into braille ASCII, which is the format compatible with most braille embossers.


The function works by corresponding braille symbols to ASCII symbols. The table which corresponds to said values can be found here. Because of the way in which the braille symbols translate, the resulting ASCII string will look to a non-reader as gibberish. Also, the eighth-note notes in braille music are one-off their corresponding letters in both ASCII and written braille. The written D is really a C eighth-note, the written E is really a D eighth note, etc.

>>> from music21.braille.basic import brailleUnicodeToBrailleAscii, noteToBraille
>>> brailleUnicodeToBrailleAscii('\u2800')
' '
>>> Cs8 = note.Note('C#4', quarterLength=0.5)
>>> Cs8_braille = noteToBraille(Cs8)
>>> brailleUnicodeToBrailleAscii(Cs8_braille)
>>> Eb8 = note.Note('E-4', quarterLength=0.5)
>>> Eb8_braille = noteToBraille(Eb8)
>>> brailleUnicodeToBrailleAscii(Eb8_braille)
music21.braille.basic.brailleUnicodeToSymbols(brailleUnicode, filledSymbol='o', emptySymbol='·')

translates a braille unicode string into symbols (unicode) – for debugging.

>>> print(braille.basic.brailleUnicodeToSymbols('⠜'))

music21.braille.basic.chordToBraille(music21Chord, descending=True, showOctave=True)

Takes in a Chord and returns its representation as a braille string in UTF-8 unicode.

In braille, only one pitch of a chord is brailled, with the rest represented as numeric intervals from that one pitch. If descending is True, the highest (sounding) pitch is brailled, and intervals are labeled in descending order; if descending is False, the lowest (sounding) pitch is brailled, and the intervals are labeled in ascending order. Convention dictates that chords found in the treble clef are brailled descending, and those found in the bass clef are brailled ascending.

If showOctave is True, the octave of the brailled pitch is shown. Other octave marks are shown in context relative to the brailled pitch.

>>> from music21.braille.basic import chordToBraille
>>> gMajorTriadA = chord.Chord(['G4', 'B4', 'D5', 'G5'], quarterLength=4.0)
>>> print(chordToBraille(gMajorTriadA, descending=True))
>>> gMajorTriadB = chord.Chord(['G2', 'B2', 'D3', 'G3'], quarterLength=4.0)
>>> print(chordToBraille(gMajorTriadB, descending=False))
>>> gMajorTriadRightHand = chord.Chord(['D4', 'B4', 'G5'], quarterLength=4.0)
>>> print(chordToBraille(gMajorTriadRightHand, descending=True))
>>> gMajorTriadLeftHand = chord.Chord(['G2', 'D3', 'B3'], quarterLength=4.0)
>>> print(chordToBraille(gMajorTriadLeftHand, descending=False))
>>> cMajorTriadRightHand = chord.Chord(['C4', 'E5'], quarterLength=4.0)
>>> print(chordToBraille(cMajorTriadRightHand, descending=True))
>>> cMajorTriadLeftHand = chord.Chord(['C2', 'E3'], quarterLength=4.0)
>>> print(chordToBraille(cMajorTriadLeftHand, descending=False))
>>> cMajorSeventhRightHand = chord.Chord(['C6', 'E5', 'B4'], quarterLength=4.0)
>>> print(chordToBraille(cMajorSeventhRightHand, descending=True))
>>> cMajorSeventhLeftHand = chord.Chord(['G2', 'E3', 'E4'], quarterLength=4.0)
>>> print(chordToBraille(cMajorSeventhLeftHand, descending=False))
>>> chordWithoutAccidentals = chord.Chord(['C4', 'E4', 'F4'], quarterLength=4.0)
>>> print(chordToBraille(chordWithoutAccidentals, descending=True))
>>> chordWithAccidentals = chord.Chord(['C4', 'E-4', 'F#4'], quarterLength=4.0)
>>> chordWithAccidentals.pitches[0].accidental = 'natural'
>>> print(chordToBraille(chordWithAccidentals, descending=True))
music21.braille.basic.clefToBraille(music21Clef, keyboardHandSwitched=False)

Takes in a Clef and returns its representation as a braille string in UTF-8 unicode.

Only GClef, CClef, FClef, NoClef and their subclasses (such as TrebleClef, BassClef) can be transcribed.

If keyboardHandSwitched is True, the suffix of the brailled clef changes from dots 1-2-3 to dots 1-3. In scores of keyboard instruments, this change indicates that the playing hand differs from which implied by the clef. (E.g. A G clef in the left-hand part of a piano score needs the change of suffix.) Note that changeSuffix works only for G and F clefs.

>>> from music21.braille.basic import clefToBraille
>>> trebleClef = clef.TrebleClef()
>>> print(clefToBraille(trebleClef))
>>> print(clefToBraille(trebleClef, keyboardHandSwitched=True))
>>> bassClef = clef.BassClef()
>>> print(clefToBraille(bassClef))
>>> print(clefToBraille(bassClef, keyboardHandSwitched=True))
>>> altoClef = clef.AltoClef()
>>> print(clefToBraille(altoClef))
>>> tenorClef = clef.TenorClef()
>>> print(clefToBraille(tenorClef))
>>> noClef = clef.NoClef()
>>> clefToBraille(noClef) == ''
>>> sopranoClef = clef.SopranoClef()
>>> print(f'{sopranoClef.sign}, {sopranoClef.line}, {clefToBraille(sopranoClef)}')
C, 1, ⠜⠬⠈⠇
music21.braille.basic.dynamicToBraille(music21Dynamic, precedeByWordSign=True)

Takes in a Dynamic and returns its value as a braille string in UTF-8 unicode.

If precedeByWordSign is True, the value is preceded by a word sign (⠜).

>>> from music21.braille.basic import dynamicToBraille
>>> print(dynamicToBraille(dynamics.Dynamic('f')))
>>> print(dynamicToBraille(dynamics.Dynamic('pp')))
music21.braille.basic.handleArticulations(music21Note, noteTrans: list[str], upperFirstInFingering=True)
music21.braille.basic.handleExpressions(music21Note: GeneralNote, noteTrans: list[str])

Transcribe the expressions for a note.GeneralNote.

music21.braille.basic.handlePitchWithAccidental(music21Pitch, pitchTrans, brailleEnglish)

Takes in a Instrument and returns its “best name” as a braille string in UTF-8 unicode.

>>> from music21.braille.basic import instrumentToBraille
>>> print(instrumentToBraille(instrument.Bassoon()))
>>> print(instrumentToBraille(instrument.BassClarinet()))
music21.braille.basic.keySigToBraille(music21KeySignature, outgoingKeySig=None)

Takes in a KeySignature and returns its representation in braille as a string in UTF-8 unicode.

>>> from music21.braille.basic import keySigToBraille
>>> print(keySigToBraille(key.KeySignature(4)))

If given an old key signature, then its cancellation will be applied before and in relation to the new key signature.

>>> print(keySigToBraille(key.KeySignature(0), outgoingKeySig = key.KeySignature(-3)))

Takes in a MetronomeMark and returns it as a braille string in UTF-8 unicode. The format is (note C with duration of metronome’s referent)(metronome symbol)(number/bpm).

>>> from music21.braille.basic import metronomeMarkToBraille
>>> mm1 = tempo.MetronomeMark(number=80, referent=note.Note(type='half'))
>>> print(metronomeMarkToBraille(mm1))
>>> mm2 = tempo.MetronomeMark(number=135, referent=note.Note(quarterLength=0.5))
>>> print(metronomeMarkToBraille(mm2))
>>> mm3 = tempo.MetronomeMark(numberSounding=80)
>>> metronomeMarkToBraille(mm3)
music21.braille.basic.noteToBraille(music21Note: Note, *, showOctave=True, upperFirstInFingering=True)

Given a Note, returns the appropriate braille characters as a string in UTF-8 unicode.

The format for note display in braille is the accidental (if necessary) + octave (if necessary) + pitch name with length.

If the note has an Accidental, the accidental is always displayed unless its displayStatus is set to False. The octave of the note is only displayed if showOctave is set to True.

>>> from music21.braille.basic import noteToBraille
>>> C4 = note.Note('C4')
>>> print(noteToBraille(C4))
>>> C4.quarterLength = 2.0
>>> print(noteToBraille(C4))
>>> Ds4 = note.Note('D#4')
>>> print(noteToBraille(Ds4))
>>> print(noteToBraille(Ds4, showOctave=False))
>>> Ds4.pitch.accidental.displayStatus=False
>>> print(noteToBraille(Ds4))
>>> A2 = note.Note('A2')
>>> A2.quarterLength = 3.0
>>> print(noteToBraille(A2))
>>> B = note.Note('B4')
>>> f = expressions.Fermata()
>>> B.expressions.append(f)
>>> print(noteToBraille(B))
>>> for x in B.editorial.brailleEnglish:
...     print(x)
Octave 4 ⠐
B quarter ⠺
Note-fermata: Shape normal: ⠣⠇
>>> f.shape = 'square'
>>> print(noteToBraille(B))
>>> for x in B.editorial.brailleEnglish:
...     print(x)
Octave 4 ⠐
B quarter ⠺
Note-fermata: Shape square: ⠰⠣⠇
>>> C4 = note.Note('C4')
>>> print(noteToBraille(C4))
>>> C4.duration.appendTuplet(duration.Tuplet(3, 2))  # triplet
>>> print(noteToBraille(C4))
>>> C4.beamStart = True
>>> print(noteToBraille(C4))
>>> for x in C4.editorial.brailleEnglish:
...     print(x)
Triplet ⠆
Octave 4 ⠐
C quarter ⠹
>>> C4 = note.Note('C4')
>>> C4.duration.appendTuplet(duration.Tuplet(7, 4))  # septuplet
>>> C4.beamStart = True
>>> print(noteToBraille(C4))
>>> for x in C4.editorial.brailleEnglish:
...     print(x)
Septuplet ⠸⠶⠄
Octave 4 ⠐
C quarter ⠹
music21.braille.basic.numberToBraille(sampleNumber: int, withNumberSign=True, lower=False) str

Transcribes a number to UTF-8 braille. By default, the result number occupies the upper two thirds of braille cells with a leading number sign. If withNumberSign is set to False, the leading number sign will be removed. If lower is set to True, the position will be changed from the upper (1245 dots) to the lower (2356 dots).

>>> from music21.braille.basic import numberToBraille
>>> print(numberToBraille(12))
>>> print(numberToBraille(7))
>>> print(numberToBraille(37))

takes a pitch object and returns the brailling for the octave.

Can also be given an int specifying the octave.

Expands the definition given in Degarmo Ch 7 to allow even less commonly used octaves such as -1, and > 8 by tripling, etc. the number of octave marks.

>>> pitchToOctave = braille.basic.pitchToOctave
>>> print(pitchToOctave(pitch.Pitch('C4')))

>>> print(pitchToOctave(pitch.Pitch('B-4')))

>>> print(pitchToOctave(4))

>>> print(pitchToOctave(3))

>>> print(pitchToOctave(2))

>>> print(pitchToOctave(1))

>>> print(pitchToOctave(0))
>>> print(pitchToOctave(-1))
>>> print(pitchToOctave(5))

>>> print(pitchToOctave(6))

>>> print(pitchToOctave(7))

>>> print(pitchToOctave(8))
>>> print(pitchToOctave(9))

Given a Rest, returns the appropriate braille characters as a string in UTF-8 unicode.

Currently, only supports single rests with or without dots. Complex rests are not supported.

>>> from music21.braille.basic import restToBraille
>>> dottedQuarter = note.Rest(quarterLength=1.5)
>>> print(restToBraille(dottedQuarter))
>>> whole = note.Rest(quarterLength=4.0)
>>> print(restToBraille(whole))

This would give a warning and gives the basic_exception symbol:

quarterPlusSixteenth = note.Rest(quarterLength=1.25) print(restToBraille(quarterPlusSixteenth)) ⠜⠦

music21.braille.basic.showOctaveWithNote(previousNote, currentNote)

Determines whether a currentNote carries an octave designation in relation to a previous Note.


  • If currentNote is found within a second or third of previousNote, currentNote does not carry an octave designation.

  • If currentNote is found a sixth or more away from previousNote, currentNote does carry an octave designation.

  • If currentNote is found within a fourth or fifth of previousNote, currentNote carries an octave designation if and only if currentNote and previousNote are not found in the same octave.

Of course, these rules cease to apply in quite a few cases, which are not directly reflected in the results of this function:

  1. If a braille measure goes to a new line, the first note in the measure carries an octave designation regardless of what the previous note was.

  2. If a braille measure contains a new key or time signature, the first note carries an octave designation regardless of what the previous note was.

  3. If a new key or time signature occurs in the middle of a measure, or if a double bar line is encountered, both of which would necessitate a music hyphen, the next note after those cases needs an octave marking.

If any special case happens, previousNote can be set to None and the function will return True.

>>> from music21.braille.basic import showOctaveWithNote
>>> showOctaveWithNote(note.Note('C4'), note.Note('E4'))
>>> showOctaveWithNote(note.Note('C4'), note.Note('F4'))
>>> showOctaveWithNote(note.Note('C4'), note.Note('F3'))
>>> showOctaveWithNote(note.Note('C4'), note.Note('A4'))

If previousNote is None, it is always True

>>> showOctaveWithNote(None, note.Note('A4'))
music21.braille.basic.tempoTextToBraille(music21TempoText: tempo.TempoText, *, maxLineLength=40) str

Takes in a TempoText and returns its representation in braille as a string in UTF-8 unicode. The tempo text is returned uncentered, and is split around the comma, each split returned on a separate line. The literary period required at the end of every tempo text expression in braille is also included.

>>> from music21.braille.basic import tempoTextToBraille
>>> print(tempoTextToBraille(tempo.TempoText('Lento assai, cantante e tranquillo')))
>>> print(tempoTextToBraille(tempo.TempoText('Andante molto grazioso')))
>>> print(tempoTextToBraille(tempo.TempoText('Andante molto grazioso ma cantabile')))
>>> print(tempoTextToBraille(tempo.TempoText('Andante molto grazioso ma cantabile'),
...                          maxLineLength=20))
music21.braille.basic.textExpressionToBraille(music21TextExpression, precedeByWordSign=True)

Takes in a TextExpression and returns its representation in UTF-8 unicode.

From the lookup table:

>>> from music21.braille.basic import textExpressionToBraille
>>> print(textExpressionToBraille(expressions.TextExpression('cresc.')))

Single word expression has word symbol (⠜) only at beginning:

>>> print(textExpressionToBraille(expressions.TextExpression('dolce')))

Multiple word expression has word symbol at beginning and end.

>>> print(textExpressionToBraille(expressions.TextExpression('dim. e rall.')))

Takes in a TimeSignature and returns its representation in braille as a string in UTF-8 unicode.

>>> from music21.braille.basic import timeSigToBraille
>>> print(timeSigToBraille(meter.TimeSignature('4/4')))
>>> print(timeSigToBraille(meter.TimeSignature('3/4')))
>>> print(timeSigToBraille(meter.TimeSignature('12/8')))
>>> print(timeSigToBraille(meter.TimeSignature('c')))
music21.braille.basic.transcribeHeading(music21KeySignature=None, music21TimeSignature=None, music21TempoText=None, music21MetronomeMark=None, maxLineLength=40)

Takes in a KeySignature, TimeSignature, TempoText, and MetronomeMark and returns its representation in braille as a string in UTF-8 unicode. The contents are always centered on a line, whose width is 40 by default.

In most cases, the format is (tempo text)(space)(metronome mark)(space)(key/time signature), centered, although all of these need not be included. If all the contents do not fit on one line with at least 3 blank characters on each side, then the tempo text goes on the first line (and additional lines if necessary), and the metronome mark + key and time signature goes on the last line.

If the resulting heading is of length zero, a BrailleBasicException is raised.

>>> from music21.braille.basic import transcribeHeading
>>> print(transcribeHeading(
...         key.KeySignature(5),
...         meter.TimeSignature('3/8'),
...         tempo.TempoText('Allegretto'),
...         tempo.MetronomeMark(number=135, referent=note.Note(type='eighth'))))
>>> print(transcribeHeading(
...          key.KeySignature(-2),
...          meter.TimeSignature('common'),
...          tempo.TempoText('Lento assai, cantante e tranquillo'),
...          None))
>>> print(transcribeHeading(
...          key.KeySignature(-2),
...          meter.TimeSignature('common'),
...          tempo.TempoText('Lento assai, cantante e tranquillo'),
...          None,
...          maxLineLength=10))
music21.braille.basic.transcribeNoteFingering(sampleNoteFingering='1', upperFirstInFingering=True)

Takes in a note fingering and returns its correct transcription to braille.

>>> from music21.braille.basic import transcribeNoteFingering
>>> print(transcribeNoteFingering('4'))

A change of fingering:

>>> print(transcribeNoteFingering('2-1'))

A choice of fingering, both on either the top or bottom of the staff:

>>> print(transcribeNoteFingering('5|4', upperFirstInFingering=True))
>>> print(transcribeNoteFingering('5|4', upperFirstInFingering=False))

A choice of fingering, one on top and one below the staff:

>>> print(transcribeNoteFingering('2,1', upperFirstInFingering=True))
>>> print(transcribeNoteFingering('2,1', upperFirstInFingering=False))

A choice of fingering, first set missing fingermark:

>>> print(transcribeNoteFingering('2,x'))

A choice of fingering, second set missing fingermark:

>>> print(transcribeNoteFingering('x,2'))

Missing fingermarks change with upperFirstInFingering

>>> print(transcribeNoteFingering('x,4', upperFirstInFingering=True))
>>> print(transcribeNoteFingering('x,4', upperFirstInFingering=False))
>>> print(transcribeNoteFingering('4,x', upperFirstInFingering=True))
>>> print(transcribeNoteFingering('4,x', upperFirstInFingering=False))

A change of fingering and a choice of fingering combined (thanks to Bo-cheng Jhan for the patch):

>>> print(transcribeNoteFingering('1-2|3-4'))

Incorrect fingerings raise a BrailleBasicException:

>>> transcribeNoteFingering('6')
Traceback (most recent call last):
music21.braille.basic.BrailleBasicException: Cannot translate note fingering: 6
music21.braille.basic.transcribeSignatures(music21KeySignature, music21TimeSignature, outgoingKeySig=None)

Takes in a KeySignature and TimeSignature and returns its representation in braille as a string in UTF-8 unicode. If given an old key signature, then its cancellation will be applied before and in relation to the new key signature.

Raises a BrailleBasicException if the resulting key and time signature is empty, which happens if the time signature is None and (a) the key signature is None or (b) the key signature has zero sharps and there is no previous key signature.

>>> from music21.braille.basic import transcribeSignatures
>>> print(transcribeSignatures(key.KeySignature(5), meter.TimeSignature('3/8'), None))
>>> print(transcribeSignatures(key.KeySignature(0), None, key.KeySignature(-3)))
music21.braille.basic.wordToBraille(sampleWord: str, isTextExpression=False) str

Transcribes a word to UTF-8 braille.

>>> from music21.braille.basic import wordToBraille
>>> print(wordToBraille('Andante'))

Try the German for violin.

>>> print(wordToBraille('Geige'))

Tests number symbol at beginning, punctuation in number and switch back to letters.

>>> print(wordToBraille('25.4cm'))

Generator that yields braille before note articulations from a given note. Might yield nothing.

“When a staccato or staccatissimo is shown with any of the other [before note expressions], it is brailled first.”

“The up-bow and down-bow marks for bowed string instruments are brailled before any other signs from Column A and before an ornament.” (BMTM, 114)

Beyond that, we yield in alphabetical order, which happens to satisfy this: “When an accent is shown with a tenuto, the accent is brailled first.” (BMTM, 113)

For reference:

>>> brailleArt = braille.lookup.beforeNoteExpr
>>> print(brailleArt['tenuto'])
>>> print(brailleArt['staccato'])

>>> print(brailleArt['accent'])
>>> brailleBowings = braille.lookup.bowingSymbols
>>> print(brailleBowings['down bow'])
>>> print(brailleBowings['up bow'])
>>> n = note.Note()
>>> n.articulations.append(articulations.DownBow())
>>> n.articulations.append(articulations.Tenuto())
>>> n.articulations.append(articulations.Staccato())
>>> n.articulations.append(articulations.Accent())
>>> n.articulations.append(articulations.Scoop())  # example unsupported articulation

This will yield in order: DownBow, Staccato, Accent, Tenuto.

>>> for brailleArt in braille.basic.yieldBrailleArticulations(n):
...     print(brailleArt)


Generator that yields symbol[‘dot’] characters for each row of a braille character that where the left dot is filled. These are used in many places in Braille Music Code.

>>> B = braille.lookup.brailleDotDict
>>> gen = braille.basic.yieldDots(B[1])
>>> gen
<generator object yieldDots at 0x10aee5f68>
>>> for dot in gen:
...     print(dot)

>>> gen = braille.basic.yieldDots(B[1235])
>>> for dot in gen:
...     print(dot)