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 import basic
>>> doubleBarline = bar.Barline('double')
>>> print(basic.barlineToBraille(doubleBarline))
>>> finalBarline = bar.Barline('final')
>>> print(basic.barlineToBraille(finalBarline))

Heavy gives an “unusual barline” symbol

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


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.

>>> from music21.braille import basic
>>> t1 = basic.brailleAsciiToBrailleUnicode(',ANDANTE ,MAESTOSO4')
>>> t2 = 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 import basic
>>> basic.brailleUnicodeToBrailleAscii('\u2800')
' '
>>> Cs8 = note.Note('C#4', quarterLength=0.5)
>>> Cs8_braille = basic.noteToBraille(Cs8)
>>> basic.brailleUnicodeToBrailleAscii(Cs8_braille)
>>> Eb8 = note.Note('E-4', quarterLength=0.5)
>>> Eb8_braille = basic.noteToBraille(Eb8)
>>> basic.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 import basic
>>> gMajorTriadA = chord.Chord(['G4', 'B4', 'D5', 'G5'], quarterLength=4.0)
>>> print(basic.chordToBraille(gMajorTriadA, descending=True))
>>> gMajorTriadB = chord.Chord(['G2', 'B2', 'D3', 'G3'], quarterLength=4.0)
>>> print(basic.chordToBraille(gMajorTriadB, descending=False))
>>> gMajorTriadRightHand = chord.Chord(['D4', 'B4', 'G5'], quarterLength=4.0)
>>> print(basic.chordToBraille(gMajorTriadRightHand, descending=True))
>>> gMajorTriadLeftHand = chord.Chord(['G2', 'D3', 'B3'], quarterLength=4.0)
>>> print(basic.chordToBraille(gMajorTriadLeftHand, descending=False))
>>> cMajorTriadRightHand = chord.Chord(['C4', 'E5'], quarterLength=4.0)
>>> print(basic.chordToBraille(cMajorTriadRightHand, descending=True))
>>> cMajorTriadLeftHand = chord.Chord(['C2', 'E3'], quarterLength=4.0)
>>> print(basic.chordToBraille(cMajorTriadLeftHand, descending=False))
>>> cMajorSeventhRightHand = chord.Chord(['C6', 'E5', 'B4'], quarterLength=4.0)
>>> print(basic.chordToBraille(cMajorSeventhRightHand, descending=True))
>>> cMajorSeventhLeftHand = chord.Chord(['G2', 'E3', 'E4'], quarterLength=4.0)
>>> print(basic.chordToBraille(cMajorSeventhLeftHand, descending=False))
>>> chordWithoutAccidentals = chord.Chord(['C4', 'E4', 'F4'], quarterLength=4.0)
>>> print(basic.chordToBraille(chordWithoutAccidentals, descending=True))
>>> chordWithAccidentals = chord.Chord(['C4', 'E-4', 'F#4'], quarterLength=4.0)
>>> chordWithAccidentals.pitches[0].accidental = 'natural'
>>> print(basic.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 import basic
>>> trebleClef = clef.TrebleClef()
>>> print(basic.clefToBraille(trebleClef))
>>> print(basic.clefToBraille(trebleClef, keyboardHandSwitched=True))
>>> bassClef = clef.BassClef()
>>> print(basic.clefToBraille(bassClef))
>>> print(basic.clefToBraille(bassClef, keyboardHandSwitched=True))
>>> altoClef = clef.AltoClef()
>>> print(basic.clefToBraille(altoClef))
>>> tenorClef = clef.TenorClef()
>>> print(basic.clefToBraille(tenorClef))
>>> noClef = clef.NoClef()
>>> basic.clefToBraille(noClef) == ''
>>> sopranoClef = clef.SopranoClef()
>>> print(f'{sopranoClef.sign}, {sopranoClef.line}, {basic.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 import basic
>>> print(basic.dynamicToBraille(dynamics.Dynamic('f')))
>>> print(basic.dynamicToBraille(dynamics.Dynamic('pp')))
music21.braille.basic.handleArticulations(music21Note, noteTrans, upperFirstInFingering=True)
music21.braille.basic.handleExpressions(music21Note, noteTrans)

Transcribe the expressions for a Note or Rest (or anything with a .expressions list.

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 import basic
>>> print(basic.instrumentToBraille(instrument.Bassoon()))
>>> print(basic.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 import basic
>>> print(basic.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(basic.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 import basic
>>> mm1 = tempo.MetronomeMark(number=80, referent=note.Note(type='half'))
>>> print(basic.metronomeMarkToBraille(mm1))
>>> mm2 = tempo.MetronomeMark(number=135, referent=note.Note(quarterLength=0.5))
>>> print(basic.metronomeMarkToBraille(mm2))
music21.braille.basic.noteToBraille(music21Note: music21.note.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 import basic
>>> C4 = note.Note('C4')
>>> print(basic.noteToBraille(C4))
>>> C4.quarterLength = 2.0
>>> print(basic.noteToBraille(C4))
>>> Ds4 = note.Note('D#4')
>>> print(basic.noteToBraille(Ds4))
>>> print(basic.noteToBraille(Ds4, showOctave=False))
>>> Ds4.pitch.accidental.displayStatus=False
>>> print(basic.noteToBraille(Ds4))
>>> A2 = note.Note('A2')
>>> A2.quarterLength = 3.0
>>> print(basic.noteToBraille(A2))
>>> B = note.Note('B4')
>>> f = expressions.Fermata()
>>> B.expressions.append(f)
>>> print(basic.noteToBraille(B))
>>> for x in B.editorial.brailleEnglish:
...     print(x)
Octave 4 ⠐
B quarter ⠺
Note-fermata: Shape normal: ⠣⠇
>>> f.shape = 'square'
>>> print(basic.noteToBraille(B))
>>> for x in B.editorial.brailleEnglish:
...     print(x)
Octave 4 ⠐
B quarter ⠺
Note-fermata: Shape square: ⠰⠣⠇
>>> C4 = note.Note('C4')
>>> print(basic.noteToBraille(C4))
>>> C4.duration.appendTuplet(duration.Tuplet(3, 2))  # triplet
>>> print(basic.noteToBraille(C4))
>>> C4.beamStart = True
>>> print(basic.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(basic.noteToBraille(C4))
>>> for x in C4.editorial.brailleEnglish:
...     print(x)
Septuplet ⠸⠶⠄
Octave 4 ⠐
C quarter ⠹
music21.braille.basic.numberToBraille(sampleNumber, withNumberSign=True, lower=False)

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 import basic
>>> print(basic.numberToBraille(12))
>>> print(basic.numberToBraille(7))
>>> print(basic.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.

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

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

>>> print(braille.basic.pitchToOctave(4))

>>> print(braille.basic.pitchToOctave(3))

>>> print(braille.basic.pitchToOctave(2))

>>> print(braille.basic.pitchToOctave(1))

>>> print(braille.basic.pitchToOctave(0))
>>> print(braille.basic.pitchToOctave(-1))
>>> print(braille.basic.pitchToOctave(5))

>>> print(braille.basic.pitchToOctave(6))

>>> print(braille.basic.pitchToOctave(7))

>>> print(braille.basic.pitchToOctave(8))
>>> print(braille.basic.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 import basic
>>> dottedQuarter = note.Rest(quarterLength=1.5)
>>> print(basic.restToBraille(dottedQuarter))
>>> whole = note.Rest(quarterLength=4.0)
>>> print(basic.restToBraille(whole))

This would give a warning and gives the basic_exception symbol:

quarterPlusSixteenth = note.Rest(quarterLength=1.25) print(basic.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 import basic
>>> basic.showOctaveWithNote(note.Note('C4'), note.Note('E4'))
>>> basic.showOctaveWithNote(note.Note('C4'), note.Note('F4'))
>>> basic.showOctaveWithNote(note.Note('C4'), note.Note('F3'))
>>> basic.showOctaveWithNote(note.Note('C4'), note.Note('A4'))

If previousNote is None, it is always True

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

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 import basic
>>> print(basic.tempoTextToBraille(tempo.TempoText('Lento assai, cantante e tranquillo')))
>>> print(basic.tempoTextToBraille(tempo.TempoText('Andante molto grazioso')))
>>> print(basic.tempoTextToBraille(tempo.TempoText('Andante molto grazioso ma cantabile')))
>>> print(basic.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:

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

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

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

Multiple word expression has word symbol at beginning and end.

>>> print(braille.basic.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 import basic
>>> print(basic.timeSigToBraille(meter.TimeSignature('4/4')))
>>> print(basic.timeSigToBraille(meter.TimeSignature('3/4')))
>>> print(basic.timeSigToBraille(meter.TimeSignature('12/8')))
>>> print(basic.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 import basic
>>> print(basic.transcribeHeading(key.KeySignature(5), meter.TimeSignature('3/8'),
...         tempo.TempoText('Allegretto'),
...         tempo.MetronomeMark(number=135, referent=note.Note(type='eighth'))))
>>> print(basic.transcribeHeading(
...          key.KeySignature(-2),
...          meter.TimeSignature('common'),
...          tempo.TempoText('Lento assai, cantante e tranquillo'),
...          None))
>>> print(basic.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 import basic
>>> print(basic.transcribeNoteFingering('4'))

A change of fingering:

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

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

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

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

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

A choice of fingering, first set missing fingermark:

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

A choice of fingering, second set missing fingermark:

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

Missing fingermarks change with upperFirstInFingering

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

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

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

Incorrect fingerings raise a BrailleBasicException:

>>> basic.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 import basic
>>> print(basic.transcribeSignatures(key.KeySignature(5), meter.TimeSignature('3/8'), None))
>>> print(basic.transcribeSignatures(key.KeySignature(0), None, key.KeySignature(-3)))
music21.braille.basic.wordToBraille(sampleWord, isTextExpression=False)

Transcribes a word to UTF-8 braille.

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

Try the German for violin.

>>> print(basic.wordToBraille('Geige'))

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

>>> print(basic.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)