This Python package takes a multi-voice score and annotates each part with lyrics showing the harmonic interval and motion type between adjacent parts. Useful for counterpoint analysis, teaching, and checking student work.
Built on music21 — a toolkit for computer-aided musical analysis.
Bach BWV 66.6:
| Symbol | Motion |
|---|---|
| (none) | Oblique motion |
= |
Parallel motion |
< |
Contrary motion (outward) |
> |
Contrary motion (inward) |
↗ |
Direct motion (ascending) |
↘ |
Direct motion (descending) |
In the example above the notation on the Soprano refers to the relation between Soprano and Alto; at the Alto part, the cipher corresponds to the relation Alto-Tenor and so on. The Bass part cipher reflects Soprano-Bass relation.
pip install git+https://github.com/matiasnm/voiceCipher.gitOr for development:
git clone https://github.com/matiasnm/voiceCipher.git
cd voiceCipher
pip install -e .from voiceCipher import voiceCipher
from music21 import corpus
score = corpus.parse("bwv66.6")
result = voiceCipher(score, measureBreak=4)
result.show()# Run demo with Bach BWV 66.6
python -m voiceCipher
# Cipher your own MusicXML file
python -m voiceCipher my_score.xmlAfter pip install -e ., you also get a voicecipher command:
voicecipher my_score.xmlIf you have MuseScore 4 installed:
python render_to_png.py
python render_to_png.py my_score.xml- Python ≥ 3.10
- music21 ≥ 10.5.0
- (optional) MuseScore 4 for PNG rendering
