Pedal Point

This module illustrates how to identify and analyze a pedal point. A pedal point is a tone that is sustained (or repeated) through several different chords or harmonies. It is often, but not always, in the lowest voice. Typically, it will function as a chord tone in some of these harmonies, and a non-chord tone […]

Scale Degrees

This module explores how to identify the scale degree of notes in a melody. All major and minor scales (known collectively as “diatonic” scales) contain seven different notes. After the seventh note, the first note repeats again. For example, the C major scale contains the notes C-D-E-F-G-A-B, then repeats C at the top. We often […]

Cantus Firmus, Part II

This module is a continuation of the previous module on composing a cantus firmus. In this module, we will continue our algorithmic approach to generating a well-formed cantus firmus based on clearly defined rules and guidelines. In the previous module, we created a function that was responsive the following principles: Our cantus firmus will span […]

Cantus Firmus, Part I

This module explores the basics of composing a cantus firmus. The cantus firmus is a melody that forms the basis for polyphonic music and other musical textures that employ strict counterpoint, including specifies counterpoint exercises. The cantus firmus must exhibit certain musical qualities to be considered “well-formed,” including smoothness, motion, and variety. We’ll use the […]

While Loop (Python)

This tutorial module explains the syntax and usage of while loops. While loops are loops that continue to run while a given condition is satisfied. This stands in contrast to for loops, which run over a range or sequence. (Compare the use of conditional logic here with if statements.) This block of code prints the […]

Importing Notation

This brief tutorial module illustrates how to import music notation files into the music21 environment. There are two main approaches to importing notation: importing from a file on your computer, or from a file in the music21 corpus. To import from a file (whether you created it or downloaded it), replace the directory in quotation […]

Voice Roles, Part II

This module is a continuation of the previous module exploring the roles of the different voices in a four-part texture. We’ll continue with J. S. Bach’s Jesu, meine Freude: Let’s load the chorale in music21: The four voices are aligned vertically in the score to reflect their usual relationship to one another in terms of […]

Voice Roles, Part I

This module explores the roles of the different parts in four-voice Baroque counterpoint. J. S. Bach’s chorales are often used as a model for musical textures with four voices. The voices are perceived as independent from one another through the unique roles they take on in the composition. By comparing the voices within a single […]

Viewing Notation

This brief tutorial module explains how to view notation in the music21 environment. After you install music21, you must configure it for your system. As part of this process, you must install or specify a software program to display notation in the MusicXML format. The instructions for this configuration process are included as part of […]

Key Signatures

This module explores the relationship between keys and key signatures. In musical notation, different musical keys are represented by patterns of sharps and flats on the staff called key signatures. The relationship between keys and key signatures is illustrated through a diagram called the circle of fifths: In the circle of fifths above, major keys […]