pctheory.pset

class Sieve
property base_pitch

The base pitch of the Sieve (pitch 0)

property intervals

The intervallic succession of the Sieve

property pc_mod

The pitch class mod of the Sieve (which specifies the pitch type)

property period

The period of the Sieve

property tuples

The tuples in the Sieve

__init__(self, tuples, base_pitch: int, pc_mod=12)

Creates a Sieve

Parameters:
  • tuples – A collection of tuples to add to the sieve.

  • base_pitch – Pitch 0 for the sieve. This pitch does not actually have to be

in the sieve - it will just serve as the 0 reference point. :param pc_mod: The pitch-class mod of the Sieve

add_tuples(self, *args)

Adds one or more tuples to the Sieve12

Parameters:

args – One or more tuples

get_range(self, p0, p1)

Gets all pitches in the sieve between p0 and p1

Parameters:
  • p0 – The low pitch

  • p1 – The high pitch

Returns:

A pset

intersection(self, sieve)

Intersects two Sieves

Parameters:

sieve – A Sieve

Returns:

A new Sieve. It will have the same base pitch as self.

is_in_sieve(self, p)

Whether or not a pitch or pset is in the sieve

Parameters:

p – A pitch (Pitch or int) or pset

Returns:

True or False

union(self, sieve)

Unions two Sieves

Parameters:

sieve – A Sieve

Returns:

A new Sieve. It will have the same base pitch as self.

calculate_pm_similarity(pset1: set, pset2: set, ic_roster1=None, ic_roster2=None)

Gets the pitch-measure (PM) similarity between pset1 and pset2

Parameters:
  • pset1 – A pset

  • pset2 – A pset

  • ic_roster1 – The ic_roster for pset 1. If None, will be calculated.

  • ic_roster2 – The ic_roster for pset 2. If None, will be calculated.

Returns:

The PM similarity as a tuple of integers

*Compatible with all Pitch modulos

generate_random_pset_realizations(pcset: set, lower_boundary: int, upper_boundary: int, num_realizations: int = 1, num_duplicate_pitches: int = 0, filter_func=None)

Generates random pset realizations of a given pcset, within the specified upper and lower boundaries

Parameters:
  • pcset – The pcset to realize

  • lower_boundary – The lower boundary

  • upper_boundary – The upper boundary

  • num_realizations – The number of random realizations to generate

  • num_duplicate_pitches – The number of additional duplicate pitches to include (for doubling)

  • filter_func – A function for filtering the pset realizations to force them to match specified criteria

Returns:

One or more random pset realizations of the pcset within the given boundaries. If the number of realizations

is greater than 1, returns a list of psets. Otherwise returns a single pset. *Compatible with all Pitch modulos

get_fb_class(pset: set, p0: int)

Gets the FB-class of a pset

Parameters:
  • pset – The pset

  • p0 – The lowest pitch

Returns:

The FB-class as a list of integers

*Compatible with all Pitch modulos

get_ic_matrix(pset: set)

Gets the pitch ic-matrix

Parameters:

pset – The pset

Returns:

The ic-matrix as a list of lists

*Compatible with all Pitch modulos

get_ic_roster(pset: set)

Gets the pitch ic-roster

Parameters:

pset – The pset

Returns:

The ic-roster as a dictionary

*Compatible with all Pitch modulos

get_pcint_class(pset: set)

Gets the PCINT-class of a pset

Parameters:

pset – The pset

Returns:

The PCINT-class as a list of integers

*Compatible with all Pitch modulos

get_set_class(pset: set)

Gets the set-class of a pset

Parameters:

pset – The pset

Returns:

The set-class as a list of integers

*Compatible with all Pitch modulos

invert(pset: set)

Inverts a pset

Parameters:

pset – The pset

Returns:

The inverted pset

*Compatible with all Pitch modulos

make_pset12(*args)

Makes a pset

Parameters:

*args

Pitches

Returns:

A pset

*Compatible only with chromatic psegs

make_pset24(*args)

Makes a pset

Parameters:

*args

Pitches

Returns:

A pset

*Compatible only with microtonal psegs

subsets(pset: set)

Gets all subsets of a pset

Parameters:

pset – A pset

Returns:

A list containing all subsets of the pset

*Compatible with all Pitch modulos

to_pcset(pset: set)

Makes a pcset out of a pset

Parameters:

pset – A pset

Returns:

A pcset

*Compatible with all Pitch modulos

transform(pset: set, transformation: transformations.UTO)

Transforms a pset

Parameters:
  • pset – A pset

  • transformation – A transformation

Returns:

The transformed set

*Compatible with all Pitch modulos

transpose(pset: set, n: int)

Transposes a pset

Parameters:
  • pset – The pset

  • n – The index of transposition

Returns:

The transposed pset

*Compatible with all Pitch modulos