Getting started

Let’s convert a simple Volpiano chant, and show it as html. Note that this only works if you have the Volpiano typeface installed.

from music21 import converter
import chant21
ch = converter.parse('cantus: 1---f-g--h---g--f--h---3/Abra cadabra')
ch.show('html')

Section

1---
 
f-g--
A-
h---
bra
g--
ca-
f--
da-
h---
bra
3
 

We have included the lyrics after the slash: chant21 can automatically align Latin text to the music.

When chant21 converts a chant, the result is a chant21.chant.Chant object. This is a music21 object (a music21.part.Part) tweaked to better represent chants by retaining the exact division in sections, words, syllables and neumes using other custom music21 elements. You can inspect the structure using ch.show('text'):

ch.show('text')
{0.0} <chant21.chant.Section>
    {0.0} <chant21.chant.Word>
        {0.0} <chant21.chant.Syllable>
            {0.0} <chant21.chant.Clef>
    {0.0} <chant21.chant.Word>
        {0.0} <chant21.chant.Syllable lyrics=A>
            {0.0} <chant21.chant.Neume>
                {0.0} <chant21.chant.Note F>
            {1.0} <chant21.chant.Neume>
                {0.0} <chant21.chant.Note G>
        {2.0} <chant21.chant.Syllable lyrics=bra>
            {0.0} <chant21.chant.Neume>
                {0.0} <chant21.chant.Note A>
    {3.0} <chant21.chant.Word>
        {0.0} <chant21.chant.Syllable lyrics=ca>
            {0.0} <chant21.chant.Neume>
                {0.0} <chant21.chant.Note G>
        {1.0} <chant21.chant.Syllable lyrics=da>
            {0.0} <chant21.chant.Neume>
                {0.0} <chant21.chant.Note F>
        {2.0} <chant21.chant.Syllable lyrics=bra>
            {0.0} <chant21.chant.Neume>
                {0.0} <chant21.chant.Note A>
    {6.0} <chant21.chant.Word>
        {0.0} <chant21.chant.Syllable>
            {0.0} <chant21.chant.PausaMajor>

Chants imported from the gabc format are represented in the same way:

ch2 = converter.parse('gabc: (c2) a(f)b(g) (::)')
ch2.show('html')
ch2.show('text')

Section

1---
 
k--
a-
l---
b
4
 
{0.0} <chant21.chant.Section>
    {0.0} <chant21.chant.Word>
        {0.0} <chant21.chant.Syllable>
            {0.0} <chant21.chant.Clef>
    {0.0} <chant21.chant.Word>
        {0.0} <chant21.chant.Syllable lyrics=a>
            {0.0} <chant21.chant.Neume>
                {0.0} <chant21.chant.Note C>
        {1.0} <chant21.chant.Syllable lyrics=b>
            {0.0} <chant21.chant.Neume>
                {0.0} <chant21.chant.Note D>
    {2.0} <chant21.chant.Word>
        {0.0} <chant21.chant.Syllable>
            {0.0} <chant21.chant.PausaFinalis>

You can of course also convert complete files. A handful of GABC and Cantus examples are included in chant21. Here is one:

from chant21.examples import kyrie as kyrieFilename
kyrie = converter.parse(kyrieFilename)
kyrie.show('html')

Section

1---
 
hj--
KY-
hg--
ri-
hd---
e
7---
*
fhged--
e-
c--
-
d--
i-
d---
son.

Section

4---
iij.
hg--
Chrí-
l-klkhgh---
ste
7---
 
hg-fed--
e-
c--
-
d--
i-
d---
son.

Section

4---
iij.
h--
-
g--
ri-
hghd---
e
7---
 
fhged--
e-
c--
-
d--
i-
d---
son.

Section

4---
ij.
dfd--
-
cd--
ri-
d-gfed---
e
7---
*
cefed--
e-
c--
-
d--
i-
d---
son.
4