Home

In the past months, I have brought a number of changes to my Python package OPYCLEID for transformational music analysis. Let’s review them here !

The package is available on GitHub, but I have also registered it on PyPi, which means that you now can install it very easily with pip.

pip install opycleid


Now for the main changes:

• As one can see on GitHub, the package is now fully commented, which should make it easier for improving it.
• I have separated the MonoidAction class from the usual musical groups which are built on top of it, resulting in two different files monoidaction.py and musicmonoids.py. Thus, if you want to go straight to analyzing chord progression, you can just import musicmonoids and start using your favorite monoids.
from opycleid.musicmonoids import PRL_Group

my_group = PRL_Group()
print my_group.get_operation("C","b")
>>>['(RL)^10R']

• If you wish to create your own group, then you’ll have to import the MonoidAction class to instantiate it.
from opycleid.monoidaction import MonoidAction


Recall that the MonoidAction class comes equipped with useful functions to generate the monoid from generators, determine automorphisms, obtain R- and L- classes (in the sense of Green’s relations), sieves and cosieves, etc.
Those of the readers who are inclined to category theory surely have recognized that the MonoidAction class really encodes a functor $M \to \mathbf{Rel}$, where $M$ is a one-object category. In fact, since we store the monoid elements as matrices, it encodes faithful actions, which is not a problem in transformational music theory (since that, roughly speaking, we are interested in operations which effectively do something on musical elements). It would be possible to be more general, by encoding $M$ in a specific class on one hand, and encoding the functor in another class on the other hand, but the amount of work is simply not worth it for now.

• As said before, musicmonoids contains the usual monoids used in transformational music theory. As of now, this includes: Noll’s monoid (see this post), the T/I group acting on pitch classes, the T/I group acting on major/minor triads, the PRL group acting on major/minor triads, Hook’s UTT group acting on major/minor triads, two simply transitive groups (called Left_Z3Q8_Group, and Right_Z3Q8_Group) acting on major/minor triads which are extensions of $\mathbb{Z}_{12}$ by $\mathbb{Z}_2$. There is also the UPL, S, T, K, W, and S/T monoids relating major/minor/augmented triads (more on these monoids in a later post).
• OPYCLEID now features a class MonoidActionMorphism which encodes a morphism between functors $M \to \mathbf{Rel}$ and $M' \to \mathbf{Rel}$. This will prove useful for transferring an analysis made in one context (i.e. one monoid acting on a given set) to another.
• K-Net analysis can be performed using OPYCLEID, by importing knetanalysis. If you have defined your own K-Net by specifying vertices and edges, you can check if it is a valid one by calling the is_valid() method. Before, this method wasn’t very sophisticated, and in particular would fail if your K-Net had cycles. Cycle checking is now implemented, as well as path consistency (i.e. associativity). Also, you can use a MonoidActionMorphism class for obtaining new K-Nets through the apply_knet_morphism method.

I do realize that many terms and concepts above are still unclear, and I promise I will explain them in later posts. My co-workers and I are waiting for the corresponding articles to be published (which should happen before August) so that I can post the appropriate references here.