pctheory.pcseg¶
- adjacent_search(pcseg: list, corpus: list)¶
Performs an adjacent search on a corpus of pcsegs. Returns all pcsegs in the corpus that contain pcseg as an ordered sublist.
- Parameters:
pcseg – A pcseg to search for
corpus – The corpus of pcsegs to search
- Returns:
A sublist of pcsegs from the corpus that have pcseg in them. If an entry in the original corpus contains pcseg more than once, it will only be included once in this sublist. If no entries have pcseg in them, returns an empty list.
*Compatible with all PitchClass modulos
- are_combinatorial2(row1: list, row2: list)¶
Determines if two rows are hexachordally combinatorial
- Parameters:
row1 – A row
row2 – A row
- Returns:
True or False
*Compatible only with chromatic pcsegs
- are_combinatorial3(row1: list, row2: list, row3: list)¶
Determines if three rows are tetrachordally combinatorial
- Parameters:
row1 – A row
row2 – A row
row3 – A row
- Returns:
True or False
*Compatible only with chromatic pcsegs
- are_combinatorial4(row1: list, row2: list, row3: list, row4: list)¶
Determines if four rows are trichordally combinatorial
- Parameters:
row1 – A row
row2 – A row
row3 – A row
row4 – A row
- Returns:
True or False
*Compatible only with chromatic pcsegs
- bip_n(imb: list)¶
Gets the BIP_n of a list of set-classes generated by IMB_n
- Parameters:
imb – The IMB_n list
- Returns:
The BIP_n
*Compatible only with chromatic pcsegs
- create_ormap(pcseg: list)¶
Creates the ORMAP of a row
- Parameters:
pcseg – A row
- Returns:
The ORMAP
*Compatible with all PitchClass modulos
- generate_pcseg12_from_interval_list(interval_list: list, starting_pc=None)¶
Generates a pcseg from an interval list
- Parameters:
interval_list – The interval list
starting_pc – The starting pitch-class. If None, a random starting pitch-class is used.
- Returns:
A pcseg
*Compatible only with chromatic pcsegs
- generate_pcseg24_from_interval_list(interval_list: list, starting_pc=None)¶
Generates a pcseg from an interval list
- Parameters:
interval_list – The interval list
starting_pc – The starting pitch-class. If None, a random starting pitch-class is used.
- Returns:
A pcseg
*Compatible only with microtonal pcsegs
- generate_random_all_interval_row(starting_pc=None)¶
Generates a random all-interval row
- Parameters:
starting_pc – The starting pitch-class. If None, a random starting pitch-class is used.
- Returns:
An all-interval row
*Compatible only with chromatic pcsegs
- generate_random_all_trichord_row(starting_pc=None)¶
Generates a random all-trichord row
- Parameters:
starting_pc – The starting pitch-class. If None, a random starting pitch-class is used.
- Returns:
An all-trichord row
*Compatible only with chromatic pcsegs
- generate_random_all_trichord_babbitt_row(starting_pc=None)¶
Generates a random all-trichord (Babbitt) row
- Parameters:
starting_pc – The starting pitch-class. If None, a random starting pitch-class is used.
- Returns:
An all-trichord (Babbitt) row
*Compatible only with chromatic pcsegs
- generate_random_pcseg12(length: int, non_duplicative=False, starting_pc=None)¶
Generates a random pcseg
- Parameters:
length – The length of the pcseg
non_duplicative – Whether or not duplicate pcs may occur (must be True to generate a row)
starting_pc – The starting pitch-class. If None, a random starting pitch-class is used.
- Returns:
A random pcseg
*Compatible only with chromatic pcsegs
- generate_random_pcseg24(length: int, non_duplicative=False, starting_pc=None)¶
Generates a random pcseg
- Parameters:
length – The length of the pcseg
non_duplicative – Whether or not duplicate pcs may occur (must be True to generate a row)
starting_pc – The starting pitch-class. If None, a random starting pitch-class is used.
- Returns:
A random pcseg
*Compatible only with microtonal pcsegs
- generate_random_pcseg_from_pcset(pcset: set)¶
Generates a random pcseg from a pcset
- Parameters:
pcset – A pcset
- Returns:
A pcseg
*Compatible with all PitchClass modulos
- generate_random_ten_trichord_row(starting_pc=None)¶
Generates a random ten-trichord row
- Parameters:
starting_pc – The starting pitch-class. If None, a random starting pitch-class is used.
- Returns:
A ten-trichord row
*Compatible only with chromatic pcsegs
- get_intervals(pcseg: list)¶
Gets the interval sequence of a pcseg
- Parameters:
pcseg – The pcseg
- Returns:
The interval sequence
*Compatible with all PitchClass modulos
- get_row_class(row: list)¶
Gets all of the rows in a row-class
- Parameters:
row – A row
- Returns:
The row-class, as a set of rows
*Compatible with PitchClasses mod 12 and 24
- get_row_dsym(row: list)¶
Gets the degree of symmetry of a row
- Parameters:
row – A row
- Returns:
The degree of symmetry of the row
*Compatible with PitchClasses mod 12 and 24
- imb_n(pcseg: list, n: int)¶
Gets the IMB_n of a pcseg. The IMB_n is the segment of imbricated set-classes of cardinality n.
- Parameters:
pcseg – The pcseg
n – The cardinality of imbrication
- Returns:
The IMB_n
*Compatible with all PitchClass modulos
- invert(pcseg: list)¶
Inverts a pcseg
- Parameters:
pcseg – The pcseg
- Returns:
The inverted pcseg
*Compatible with all PitchClass modulos
- is_all_interval_row(pcseg: list)¶
Determines if a pcseg is an all-interval row
- Parameters:
pcseg – The pcseg
- Returns:
Whether or not the pcseg is an all-interval row
*Compatible with PitchClasses mod 12 and 24
- is_all_trichord_row(pcseg: list)¶
Determines if a pcseg is an all-trichord row
- Parameters:
pcseg – The pcseg
- Returns:
Whether or not the pcseg is an all-trichord row
*Compatible only with chromatic pcsegs
- is_all_trichord_babbitt_row(pcseg: list)¶
Determines if a pcseg is an “all-trichord” row (after Babbitt). This kind of row contains ten unique imbricated trichords, none of which are set-classes [036] or [048]. Rotation is not considered.
- Parameters:
pcseg – The pcseg
- Returns:
Whether or not the pcseg is an “all-trichord” row (after Babbitt)
*Compatible only with chromatic pcsegs
- is_link_chord(pcseg: list)¶
Determines if a row is a Link chord (an all-interval row containing the all-trichord hexachord as a subset)
- Parameters:
pcseg – A pcset
- Returns:
True or False
*Compatible only with chromatic pcsegs
- is_row(pcseg: list)¶
Determines if a pcseg is a row
- Parameters:
pcseg – The pcseg
- Returns:
Whether or not the pcseg is a row
*Compatible with PitchClasses mod 12 and 24
- is_row_generator(rgen: list)¶
Determines if a row generator is valid
- Parameters:
rgen – A row generator
- Returns:
True if the row generator is valid; false otherwise
*Compatible only with chromatic pcsegs
- is_ten_trichord_row(pcseg: list)¶
Determines if a pcseg is a ten-trichord row. This kind of row contains ten unique imbricated trichords. Rotation is not considered.
- Parameters:
pcseg – The pcseg
- Returns:
Whether or not the pcseg is an “all-trichord” row (after Babbitt)
*Compatible only with chromatic pcsegs
- make12(*args)¶
Makes a pcseg
- Parameters:
args – Pcs
- Returns:
A pcseg
*Compatible only with chromatic pcsegs
- make_pcseg12(*args)¶
Makes a pcseg. Alias for make12.
- Parameters:
args – Pcs
- Returns:
A pcseg
*Compatible only with chromatic pcsegs
- make24(*args)¶
Makes a pcseg
- Parameters:
args – Pcs
- Returns:
A pcseg
*Compatible only with microtonal pcsegs
- make_pcseg24(*args)¶
Makes a pcseg. Alias for make24.
- Parameters:
args – Pcs
- Returns:
A pcseg
*Compatible only with microtonal pcsegs
- multiply(pcseg: list, n: int)¶
Multiplies a pcseg
- Parameters:
pcseg – The pcseg
n – The multiplier
- Returns:
The multiplied pcseg
*Compatible with all PitchClass modulos
- multiply_order(pcseg: list, n: int)¶
Multiplies a pcseg’s order
- Parameters:
pcseg – The pcseg
n – The multiplier
- Returns:
The order-multiplied pcseg
*Compatible with all PitchClass modulos
- ormap(row: list, ormap: dict)¶
Performs the ORMAP mapping on a row, given a provided ORMAP
- Parameters:
row – A row
ormap
- Returns:
The ORMAP mapping for the row
*Compatible with all PitchClass modulos
- prot(pcseg: list)¶
Generates the protocol pairs for a pcseg
- Parameters:
pcseg – A pcseg
- Returns:
A set of protocol pairs
*Compatible with all PitchClass modulos
- retrograde(pcseg: list)¶
Retrogrades a pcseg
- Parameters:
pcseg – The pcseg
- Returns:
The retrograded pcseg
*Compatible with all PitchClass modulos
- rotate(pcseg: list, n: int)¶
Rotates a pcseg
- Parameters:
pcseg – The pcseg
n – The index of rotation
- Returns:
The rotated pcseg
*Compatible with all PitchClass modulos
- transform(pcseg, string)¶
Transforms a pcseg with a provided transformation string - Tn: transpose - I: invert - Mn: multiply - R: retrograde - rn: rotate
- Parameters:
pcseg – The pcseg to transform
string – The transformation string
- Returns:
The transformed pcseg
- transform_hstack(pcseg, transformation_list)¶
Generates a really long pcseg by horizontally stacking transformed versions of it
- Parameters:
pcseg – The pcseg to stack
transformation_list – A list of transformations to stack
- Returns:
The stacked and transformed pcseg
- transpose(pcseg: list, n: int)¶
Transposes a pcseg
- Parameters:
pcseg – The pcseg
n – The index of transposition
- Returns:
The transposed pcseg
*Compatible with all PitchClass modulos
- transpositional_combination(pcseg1: list, pcseg2: list)¶
Transpositionally combines (TC) two pcsegs. This is Boulez’s “multiplication.”
- Parameters:
pcseg1 – A pcseg
pcseg2 – A pcseg
- Returns:
The TC pcset
*Compatible with all PitchClass modulos
- class InvarianceMatrix¶
Represents an invariance matrix. Compatible with all PitchClass modulos for T and I matrices, and compatible with mod 12 and mod 24 for various M matrices (M5, M7 for mod 12; M5, M7, M11, M13, M17, M19 for mod 24)
- property mx¶
The matrix
- property pcseg_a¶
The pcseg A
- property pcseg_b¶
The pcseg B
- property pcseg_c¶
The pcseg C
- __init__(self, mx_type='T', a=None, c=None)¶
Creates an invariance matrix
- Parameters:
mx_type – The matrix type (T, I, M, or MI)
a – Pcseg A
c – Pcseg B
- __getitem__(self, i, j)¶
Gets the pc at the specified row and column
- Parameters:
i – The row
j – The column
- Returns:
The pc
- __repr__(self)¶
Gets a representation of the InvarianceMatrix object
- Returns:
A string representation of the InvarianceMatrix object
- __str__(self)¶
Converts the InvarianceMatrix object to string
- Returns:
A string conversion of the InvarianceMatrix object
- get_column(self, j)¶
Gets a column of the matrix
- Parameters:
j – The column index
- Returns:
The column
- get_row(self, i)¶
Gets a row of the matrix
- Parameters:
i – The row index
- Returns:
The row
- load_matrix(self, a: list, c: list)¶
Loads the matrix
- Parameters:
a – Pcseg A
c – Pcseg C
- print(self, include: list = None)¶
Prints the invariance matrix. You can specify to only print certain pcs to highlight invariance.
- Parameters:
include – The pcs to include (if None, all pcs will be printed)
- Returns:
None
- class TwelveToneMatrix¶
Represents a twelve-tone matrix. Compatible only with mod 12 PitchClasses.
- property labels_bottom¶
Gets the labels for the bottom of the matrix
- property labels_left¶
Gets the labels for the left of the matrix
- property labels_right¶
Gets the labels for the right of the matrix
- property labels_top¶
Gets the labels for the top of the matrix
- property matrix¶
Gets the matrix
- property row¶
Gets the row
- __init__(self, row=None)¶
Creates a twelve-tone matrix
- Parameters:
row – A row to import
- __getitem__(self, i, j)¶
Gets the pc at the specified row and column
- Parameters:
i – The row
j – The column
- Returns:
The pc
- __repr__(self)¶
Generates a string representation of the TwelveToneMatrix that can be printed
- Returns:
A string representation of the TwelveToneMatrix
- __str__(self)¶
Generates a string representation of the TwelveToneMatrix that can be printed
- Returns:
A string representation of the TwelveToneMatrix
- get_column(self, j)¶
Gets a column of the matrix
- Parameters:
j – The column index
- Returns:
The column
- get_row(self, i)¶
Gets a row of the matrix
- Parameters:
i – The row index
- Returns:
The row
- import_row(self, row: list)¶
Imports a row
- Parameters:
row – The row to import