Cantus

chant21.cantus.convertCantusData(data, **kwargs)
chant21.cantus.addTextToChant(chant: chant21.chant.Chant, text: str, strict: bool = False)

Parses the Cantus manuscript text and adds it as lyrics to a Chant object.

The text and music are not always aligned: sometimes the music might have more syllables than the text, or vice versa. This can be the result of transcription errors or of faulty (automatic) syllabification. Misalignments are dealt with differently in strict and normal mode. In strict mode, TextAlignmentError exceptions are raised. In normal mode, misalignments are only flagged in the editorial information, but otherwise ignored. Misalignments are also highlighted in the HTML exports, which is useful in Jupyter notebooks.

The following example illustrates the handling of misalignments hwne there are more syllables in the music than in the text. Othe cases are similar.

>>> from music21 import converter
>>> ch = converter.parse('cantus: 1---a--b--c---d---3')
>>> addTextToChant(ch, 'baca da', strict=True)
Traceback (most recent call last):
...
chant21.converter_cantus_volpiano.SyllableAlignmentError: Section 0, word 0 (baca) cannot be aligned. In the text, the word contains 2 syllables, but there are 3 syllables in the music.
>>> addTextToChant(ch, 'baca da', strict=False)
>>> word = ch[0][1]
>>> word.editorial.misaligned
True
from music21 import converter
import chant21
ch = converter.parse('cantus: 1---a--b--c---d---3/baca da')
ch.show('html', showOptions=False)

Section

1---
 
a--
ba-
b--
ca-
c---
 
d---
da
3
 
Parameters:
  • chant (Chant) – The chant object to which the text is to be added
  • text (str) – The text, should be of the same form as the full_text_manuscript field
  • strict (bool, optional) – When in strict mode, exceptions are raised whenever the music and text are misaligned (e.g. more syllables in the text than in the music). In normal mode such misalignments are accepted but flagged in the editorial information.