CalPyTools is a set of tools to work with pitch class sets, pitch matrices and other ways to control musical discourse. All of them written in python.

PCS()

The class to analyse pitch sets and look for their Allen Forte's classification. The program has all the functions needed to get ordered forms, prime forms and interval vectors.

pcs_cmd.py

An utility to run PCS() directly on a terminal.

Chain()

The class to build constant pitch class set notes sequences. The program takes a base pcs a look for common subsets in all states space. When it is possible, it creates a sequence of your desired number of links.

chain_cmd.py

An utility to create Chain()s directly on a terminal.

Matrix()

The class to build and operate with pitch matrices. You can build several types of matrix. You can invert, shuffle or translate them.

m = Matrix(12, "")
m.random_matrix(max_cell, w, h)
m.translation(5)
m.invert()

Counterpoint()

The class to build random counterpoints of any number of voices. They can be totally random or you can use control lists or Markov chains. The counterpoints are built in a score from music21.

c = Counterpoint(title, ...)
c.add_cycle()
c.save_score("name")

Texture()

The class to create musial textures from a matrix (an instance of Matrix()). Pitch is then controlled, the rhythm is random. There are 3 types of textures. The textures are built in a score from music21.

t = Texture(title, ..., matrix, ...)
for i in range(10):
  m.shuffle_status()
  m.translation(3)
  t.add_cycle()
t.save_score("name")

+ info

All the code is here. Look the examples folder! If you need help feel free to contact me. If you find errors in the code, please tell me.