Simplemusic and Pitch Class Sets

Simplemusic

simplemusic.mod12(n)
>>> simplemusic.mod12(13)
1
simplemusic.interval(x, y)

Return the numeric interval between two notes.

simplemusic.transposition(notes, index)

Transpose a set of notes by a numerical index.

simplemusic.transposition_startswith(notes, start)

Transpose a set of notes so it begins with start note.

Check if two groups of notes are related by transposition.

We use brute force here; the best way is to check for the normal or prime forms.

simplemusic.inversion(notes, index=0)

Invert a set of notes though an inversion index.

The inversion index is not very musical. the function inversion_startswith() is probably more useful.

simplemusic.inversion_startswith(notes, start)

Invert a set of notes so it begins with start note.

>>> simplemusic.inversion_startswith([0, 4, 7], 2)
[2, 10, 7]
simplemusic.rotate_set(notes)

Return all rotations of a collection of notes.

Pitch Class Set

simplemusic.name_to_diatonic(note_string)

Return a number from 0 to 6 for the note name without the accidental.

simplemusic.dotted_duration(duration, dots)

Sn = a(1 - r^n)/1 - r where a is the first term, r is the common ration (1/2 in our case) and n is the number of terms.