TwelveToneRow

class pitchtools.TwelveToneRow(items=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))

Twelve-tone row.

Initializes from defaults:

>>> row = TwelveToneRow()
>>> show(row) 

Initializes from integers:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Interpreter representation:

>>> row
TwelveToneRow([1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0])

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_datastructuretools { graph [label=datastructuretools]; "abjad.tools.datastructuretools.TypedCollection.TypedCollection" [color=3, group=2, label=TypedCollection, shape=oval, style=bold]; "abjad.tools.datastructuretools.TypedTuple.TypedTuple" [color=3, group=2, label=TypedTuple, shape=box]; "abjad.tools.datastructuretools.TypedCollection.TypedCollection" -> "abjad.tools.datastructuretools.TypedTuple.TypedTuple"; } subgraph cluster_pitchtools { graph [label=pitchtools]; "abjad.tools.pitchtools.PitchClassSegment.PitchClassSegment" [color=4, group=3, label=PitchClassSegment, shape=box]; "abjad.tools.pitchtools.Segment.Segment" [color=4, group=3, label=Segment, shape=oval, style=bold]; "abjad.tools.pitchtools.TwelveToneRow.TwelveToneRow" [color=black, fontcolor=white, group=3, label=<<B>TwelveToneRow</B>>, shape=box, style="filled, rounded"]; "abjad.tools.pitchtools.PitchClassSegment.PitchClassSegment" -> "abjad.tools.pitchtools.TwelveToneRow.TwelveToneRow"; "abjad.tools.pitchtools.Segment.Segment" -> "abjad.tools.pitchtools.PitchClassSegment.PitchClassSegment"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.datastructuretools.TypedCollection.TypedCollection"; "abjad.tools.datastructuretools.TypedTuple.TypedTuple" -> "abjad.tools.pitchtools.Segment.Segment"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Attribute summary

count(item) Counts item in row.
from_selection(class_, selection[, item_class]) Makes row from selection.
has_duplicates() Is false for all rows.
index(item) Gets index of item in row.
invert([axis]) Inverts row about optional axis.
item_class Gets item class of row.
items Gets items in row.
make_notes([n, written_duration]) Makes first n notes in segment.
multiply([n]) Multiplies pitch-classes in row by n.
permute([row]) Permutes segment by twelve-tone row.
retrograde() Gets retrograde of row.
rotate([n, stravinsky]) Rotates row by index n.
to_pitch_classes() Changes to pitch-classes.
to_pitches() Changes to pitches.
transpose([n]) Transposes row by index n.
voice_horizontally([initial_octave]) Voices segment with each pitch as close to the previous pitch as possible.
voice_vertically([initial_octave]) Voices segment with each pitch higher than the previous.
__add__(argument) Adds argument to segment.
__call__(pitch_classes) Calls row on pitch_classes.
__contains__(item) Is true if typed tuple contains item.
__eq__(argument) Is true when argument is a typed collection with items that compare equal to those of this typed collection.
__format__([format_specification]) Formats segment.
__getitem__(argument) Gets item or slice identified by argument.
__hash__() Hashes typed tuple.
__illustrate__(**keywords) Illustrates row.
__iter__() Iterates typed collection.
__len__() Gets length of typed collection.
__mul__(argument) Multiplies row by argument.
__ne__(argument) Is true when argument is not a typed collection with items equal to this typed collection.
__radd__(argument) Right-adds argument to typed tuple.
__repr__() Gets interpreter representation.
__rmul__(argument) Multiplies argument by row.
__str__() Gets string representation of pitch-class segment.

Read-only properties

TwelveToneRow.item_class

Gets item class of row.

Gets item class:

>>> row = TwelveToneRow()
>>> show(row) 
>>> row.item_class
<class 'abjad.tools.pitchtools.NumberedPitchClass.NumberedPitchClass'>

Gets item class:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 
>>> row.item_class
<class 'abjad.tools.pitchtools.NumberedPitchClass.NumberedPitchClass'>

Returns numbered pitch-class class:

>>> type(row.item_class)
<class 'abc.ABCMeta'>
TwelveToneRow.items

Gets items in row.

Gets items in row:

>>> row = TwelveToneRow()
>>> show(row) 
>>> for item in row.items:
...     item
... 
NumberedPitchClass(0)
NumberedPitchClass(1)
NumberedPitchClass(2)
NumberedPitchClass(3)
NumberedPitchClass(4)
NumberedPitchClass(5)
NumberedPitchClass(6)
NumberedPitchClass(7)
NumberedPitchClass(8)
NumberedPitchClass(9)
NumberedPitchClass(10)
NumberedPitchClass(11)

Gets items in row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 
>>> for item in row.items:
...     item
... 
NumberedPitchClass(1)
NumberedPitchClass(11)
NumberedPitchClass(9)
NumberedPitchClass(3)
NumberedPitchClass(6)
NumberedPitchClass(7)
NumberedPitchClass(5)
NumberedPitchClass(4)
NumberedPitchClass(10)
NumberedPitchClass(2)
NumberedPitchClass(8)
NumberedPitchClass(0)

Returns list:

>>> isinstance(row.items, list)
True

Methods

TwelveToneRow.count(item)

Counts item in row.

Example row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Counts pitch-class 11 in row:

>>> row.count(11)
1

Counts pitch-class 9 in row:

>>> row.count(9)
1

Counts string in row:

>>> row.count('text')
0

Returns nonnegative integer equal to 0 or 1:

>>> isinstance(row.count('text'), int)
True
TwelveToneRow.has_duplicates()

Is false for all rows.

Is false:

>>> row = TwelveToneRow()
>>> show(row) 
>>> row.has_duplicates()
False

Is false:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 
>>> row.has_duplicates()
False

Twelve-tone rows have no duplicates.

Returns false.

TwelveToneRow.index(item)

Gets index of item in row.

Example row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Gets index of pitch-class 11:

>>> row.index(11)
1

Gets index of pitch-class 9:

>>> row.index(9)
2

Returns nonnegative integer less than 12:

>>> isinstance(row.index(9), int)
True
TwelveToneRow.invert(axis=None)

Inverts row about optional axis.

Example row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Inverts row about first pitch-class when axis is none:

>>> inversion = row.invert()
>>> show(inversion) 

First pitch-classes are equal:

>>> row[0] == inversion[0]
True

Inverts row about pitch-class 1:

>>> inversion = row.invert(axis=1)
>>> show(inversion) 

Same result as above.

Inverts row about pitch-class 0:

>>> inversion = row.invert(axis=0)
>>> show(inversion) 

Inverts row about pitch-class 5:

>>> inversion = row.invert(axis=5)
>>> show(inversion) 

Returns twelve-tone row:

>>> inversion
TwelveToneRow([9, 11, 1, 7, 4, 3, 5, 6, 0, 8, 2, 10])
(PitchClassSegment).make_notes(n=None, written_duration=None)

Makes first n notes in segment.

Example segment:

>>> items = [2, 4.5, 6, 11, 4.5, 10]
>>> segment = PitchClassSegment(items=items)
>>> show(segment) 

Makes eighth notes:

>>> notes = segment.make_notes()
>>> staff = Staff(notes)
>>> show(staff) 

Makes notes with nonassignable durations:

>>> notes = segment.make_notes(4, Duration(5, 16))
>>> staff = Staff(notes)
>>> time_signature = TimeSignature((5, 4))
>>> attach(time_signature, staff)
>>> show(staff) 

Interprets none-valued n equal to length of segment.

Interprets none-valued written_duration equal to 1/8.

Returns selection:

>>> isinstance(segment.make_notes(), selectiontools.Selection)
True
TwelveToneRow.multiply(n=1)

Multiplies pitch-classes in row by n.

Example row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Multiplies pitch-classes in row by 5:

>>> multiplication = row.multiply(n=5)
>>> show(multiplication) 

Multiplies pitch-classes in row by 7:

>>> multiplication = row.multiply(n=7)
>>> show(multiplication) 

Multiplies pitch-classes in row by 1:

>>> multiplication = row.multiply(n=1)
>>> show(multiplication) 

Returns twelve-tone row:

>>> multiplication
TwelveToneRow([1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0])
(PitchClassSegment).permute(row=None)

Permutes segment by twelve-tone row.

>>> PitchClassSegment([-2, -1, 6, 7, -1, 7])
PitchClassSegment([10, 11, 6, 7, 11, 7])
>>> segment = PitchClassSegment([-2, -1, 6, 7, -1, 7])
>>> show(segment) 
>>> segment.permute([10, 0, 2, 6, 8, 7, 5, 3, 1, 9, 4, 11])
PitchClassSegment([4, 11, 5, 3, 11, 3])
>>> segment = segment.permute([10, 0, 2, 6, 8, 7, 5, 3, 1, 9, 4, 11])
>>> show(segment) 
>>> expression = Expression(name='J')
>>> expression = expression.pitch_class_segment()
>>> row = [10, 0, 2, 6, 8, 7, 5, 3, 1, 9, 4, 11]
>>> expression = expression.permute(row)
>>> expression([-2, -1, 6, 7, -1, 7])
PitchClassSegment([4, 11, 5, 3, 11, 3])
>>> expression.get_string()
'permute(J, row=[10, 0, 2, 6, 8, 7, 5, 3, 1, 9, 4, 11])'
>>> segment = expression([-2, -1, 6, 7, -1, 7])
>>> markup = expression.get_markup()
>>> show(segment, figure_name=markup) 

Returns new segment.

TwelveToneRow.retrograde()

Gets retrograde of row.

Example row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Gets retrograde of row:

>>> retrograde = row.retrograde()
>>> show(retrograde) 

Gets retrograde of retrograde of row:

>>> retrograde = row.retrograde().retrograde()
>>> show(retrograde) 
>>> retrograde == row
True

Returns row:

>>> retrograde
TwelveToneRow([1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0])
TwelveToneRow.rotate(n=0, stravinsky=False)

Rotates row by index n.

Example row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Rotates row to the right:

>>> rotation = row.rotate(n=1)
>>> show(rotation) 

Rotates row to the left:

>>> rotation = row.rotate(n=-1)
>>> show(rotation) 

Rotates row by zero:

>>> rotation = row.rotate(n=0)
>>> show(rotation) 
>>> rotation == row
True

Stravinsky-style rotation back-transposes row to zero:

>>> rotation = row.rotate(n=-1, stravinsky=True)
>>> show(rotation) 

Returns row:

>>> rotation
TwelveToneRow([0, 10, 4, 7, 8, 6, 5, 11, 3, 9, 1, 2])
(PitchClassSegment).to_pitch_classes()

Changes to pitch-classes.

To numbered pitch-class segment:

>>> items = [-2, -1.5, 6, 7, -1.5, 7]
>>> segment = PitchClassSegment(items=items)
>>> segment
PitchClassSegment([10, 10.5, 6, 7, 10.5, 7])
>>> show(segment) 
>>> segment = segment.to_pitch_classes()
>>> segment
PitchClassSegment([10, 10.5, 6, 7, 10.5, 7])
>>> show(segment) 

To named pitch-class segment:

>>> items = [-2, -1.5, 6, 7, -1.5, 7]
>>> segment = PitchClassSegment(
...     items=items,
...     item_class=NamedPitchClass,
...     )
>>> segment
PitchClassSegment("bf bqf fs g bqf g")
>>> show(segment) 
>>> segment = segment.to_pitch_classes()
>>> segment
PitchClassSegment("bf bqf fs g bqf g")
>>> show(segment) 

Returns new segment.

(PitchClassSegment).to_pitches()

Changes to pitches.

To numbered pitch segment:

>>> items = [-2, -1.5, 6, 7, -1.5, 7]
>>> segment = PitchClassSegment(items=items)
>>> segment
PitchClassSegment([10, 10.5, 6, 7, 10.5, 7])
>>> show(segment) 
>>> segment = segment.to_pitches()
>>> segment
PitchSegment([10, 10.5, 6, 7, 10.5, 7])
>>> show(segment) 

To named pitch segment:

>>> items = [-2, -1.5, 6, 7, -1.5, 7]
>>> segment = PitchClassSegment(
...     items=items,
...     item_class=NamedPitchClass,
...     )
>>> segment
PitchClassSegment("bf bqf fs g bqf g")
>>> show(segment) 
>>> segment = segment.to_pitches()
>>> segment
PitchSegment("bf' bqf' fs' g' bqf' g'")
>>> show(segment) 

Returns new segment.

TwelveToneRow.transpose(n=0)

Transposes row by index n.

Example row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Transposes row by positive index:

>>> transposition = row.transpose(n=13)
>>> show(transposition) 

Transposes row by negative index:

>>> transposition = row.transpose(n=-13)
>>> show(transposition) 

Transposes row by zero index:

>>> transposition = row.transpose(n=0)
>>> show(transposition) 
>>> transposition == row
True

Returns row:

>>> transposition
TwelveToneRow([1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0])
(PitchClassSegment).voice_horizontally(initial_octave=4)

Voices segment with each pitch as close to the previous pitch as possible.

Todo

Should be implemented somewhere else.

Voices horizontally:

>>> items = "c b d e f g e b a c"
>>> segment = PitchClassSegment(items=items)
>>> show(segment) 
>>> voiced_segment = segment.voice_horizontally()
>>> show(voiced_segment) 

Returns pitch segment:

>>> voiced_segment
PitchSegment("c' b d' e' f' g' e' b a c'")
(PitchClassSegment).voice_vertically(initial_octave=4)

Voices segment with each pitch higher than the previous.

Todo

Should be implemented somewhere else.

Voices vertically:

>>> scale_degree_numbers = [1, 3, 5, 7, 9, 11, 13]
>>> scale = tonalanalysistools.Scale('c', 'minor')
>>> segment = PitchClassSegment((
...     scale.scale_degree_to_named_pitch_class(x)
...     for x in scale_degree_numbers))
>>> show(segment) 
>>> voiced_segment = segment.voice_vertically()
>>> show(voiced_segment) 

Returns pitch segment:

>>> voiced_segment
PitchSegment("c' ef' g' bf' d'' f'' af''")

Class & static methods

classmethod TwelveToneRow.from_selection(class_, selection, item_class=None)

Makes row from selection.

Not yet implemented.

Returns twelve-tone row.

Special methods

(PitchClassSegment).__add__(argument)

Adds argument to segment.

Example segments:

>>> pitch_numbers = [-2, -1.5, 6, 7, -1.5, 7]
>>> PitchClassSegment(items=pitch_numbers)
PitchClassSegment([10, 10.5, 6, 7, 10.5, 7])
>>> J = PitchClassSegment(items=pitch_numbers)
>>> show(J) 
>>> pitch_names = ['c', 'ef', 'bqs,', 'd']
>>> PitchClassSegment(items=pitch_names)
PitchClassSegment("c ef bqs d")
>>> K = PitchClassSegment(items=pitch_names)
>>> show(K) 

Adds J and K:

>>> J + K
PitchClassSegment([10, 10.5, 6, 7, 10.5, 7, 0, 3, 11.5, 2])
>>> segment = J + K
>>> show(segment) 
>>> expression_J = Expression(name='J')
>>> expression_J = expression_J.pitch_class_segment()
>>> expression_K = Expression(name='K')
>>> expression_K = expression_K.pitch_class_segment()
>>> expression = expression_J + expression_K
>>> expression(pitch_numbers, pitch_names)
PitchClassSegment([10, 10.5, 6, 7, 10.5, 7, 0, 3, 11.5, 2])
>>> expression.get_string()
'J + K'
>>> segment = expression(pitch_numbers, pitch_names)
>>> markup = expression.get_markup()
>>> show(segment, figure_name=markup) 

Adds K and J:

>>> K + J
PitchClassSegment("c ef bqs d bf bqf fs g bqf g")
>>> segment = K + J
>>> show(segment) 
>>> expression_J = Expression(name='J')
>>> expression_J = expression_J.pitch_class_segment()
>>> expression_K = Expression(name='K')
>>> expression_K = expression_K.pitch_class_segment()
>>> expression = expression_K + expression_J
>>> expression(pitch_names, pitch_numbers)
PitchClassSegment("c ef bqs d bf bqf fs g bqf g")
>>> expression.get_string()
'K + J'
>>> segment = expression(pitch_names, pitch_numbers)
>>> markup = expression.get_markup()
>>> show(segment, figure_name=markup) 

Adds J repeatedly:

>>> J + J + J
PitchClassSegment([10, 10.5, 6, 7, 10.5, 7, 10, 10.5, 6, 7, 10.5, 7, 10, 10.5, 6, 7, 10.5, 7])
>>> segment = J + J + J
>>> show(segment) 
>>> expression_J = Expression(name='J')
>>> expression_J = expression_J.pitch_class_segment()
>>> expression = expression_J + expression_J + expression_J
>>> expression(pitch_numbers, pitch_numbers, pitch_numbers)
PitchClassSegment([10, 10.5, 6, 7, 10.5, 7, 10, 10.5, 6, 7, 10.5, 7, 10, 10.5, 6, 7, 10.5, 7])
>>> expression.get_string()
'J + J + J'
>>> list_ = [pitch_numbers, pitch_numbers, pitch_numbers]
>>> segment = expression(*list_)
>>> markup = expression.get_markup()
>>> show(segment, figure_name=markup) 

Adds transformed segments:

>>> J.rotate(n=1) + K.rotate(n=2)
PitchClassSegment([7, 10, 10.5, 6, 7, 10.5, 11.5, 2, 0, 3])
>>> segment = J.rotate(n=1) + K.rotate(n=2)
>>> show(segment) 
>>> expression_J = Expression(name='J')
>>> expression_J = expression_J.pitch_class_segment()
>>> expression_J = expression_J.rotate(n=1)
>>> expression_K = Expression(name='K')
>>> expression_K = expression_K.pitch_class_segment()
>>> expression_K = expression_K.rotate(n=2)
>>> expression = expression_J + expression_K
>>> expression(pitch_numbers, pitch_names)
PitchClassSegment([7, 10, 10.5, 6, 7, 10.5, 11.5, 2, 0, 3])
>>> expression.get_string()
'r1(J) + r2(K)'
>>> segment = expression(pitch_numbers, pitch_names)
>>> markup = expression.get_markup()
>>> show(segment, figure_name=markup) 

Reverses result:

>>> segment = J.rotate(n=1) + K.rotate(n=2)
>>> segment.retrograde()
PitchClassSegment([3, 0, 2, 11.5, 10.5, 7, 6, 10.5, 10, 7])
>>> segment = segment.retrograde()
>>> show(segment) 
>>> expression_J = Expression(name='J')
>>> expression_J = expression_J.pitch_class_segment()
>>> expression_J = expression_J.rotate(n=1)
>>> expression_K = Expression(name='K')
>>> expression_K = expression_K.pitch_class_segment()
>>> expression_K = expression_K.rotate(n=2)
>>> expression = expression_J + expression_K
>>> expression = expression.retrograde()
>>> expression(pitch_numbers, pitch_names)
PitchClassSegment([3, 0, 2, 11.5, 10.5, 7, 6, 10.5, 10, 7])
>>> expression.get_string()
'R(r1(J) + r2(K))'
>>> segment = expression(pitch_numbers, pitch_names)
>>> markup = expression.get_markup()
>>> show(segment, figure_name=markup) 

Establishes equivalence:

>>> expression_J = Expression(name='J')
>>> expression_J = expression_J.pitch_class_segment()
>>> expression_J = expression_J.rotate(n=1)
>>> expression_K = Expression(name='K')
>>> expression_K = expression_K.pitch_class_segment()
>>> expression_K = expression_K.rotate(n=2)
>>> expression = expression_J + expression_K
>>> expression = expression.establish_equivalence(name='Q')
>>> expression(pitch_numbers, pitch_names)
PitchClassSegment([7, 10, 10.5, 6, 7, 10.5, 11.5, 2, 0, 3])
>>> expression.get_string()
'Q = r1(J) + r2(K)'
>>> segment = expression(pitch_numbers, pitch_names)
>>> markup = expression.get_markup()
>>> show(segment, figure_name=markup) 

Transforms equivalence:

>>> expression = expression.transpose(n=1)
>>> expression(pitch_numbers, pitch_names)
PitchClassSegment([8, 11, 11.5, 7, 8, 11.5, 0.5, 3, 1, 4])
>>> expression.get_string()
'T1(Q)'
>>> segment = expression(pitch_numbers, pitch_names)
>>> markup = expression.get_markup()
>>> show(segment, figure_name=markup) 

Returns new segment.

TwelveToneRow.__call__(pitch_classes)

Calls row on pitch_classes.

Example row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Permutes pitch-classes:

>>> row([NumberedPitchClass(2)])
[NumberedPitchClass(9)]
>>> row([NumberedPitchClass(3)])
[NumberedPitchClass(3)]
>>> row([NumberedPitchClass(4)])
[NumberedPitchClass(6)]

Permutes pitch-class segment:

>>> items = [-2, -1, 6, 7, -1, 7]
>>> segment = PitchClassSegment(items=items)
>>> show(segment) 
>>> segment_ = row(segment)
>>> show(segment_) 

Permutes row:

>>> numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
>>> row_2 = TwelveToneRow(numbers)
>>> show(row_2) 
>>> row_3 = row(row_2)
>>> show(row_3) 

Permutes row:

>>> numbers = [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
>>> row_2 = TwelveToneRow(numbers)
>>> show(row_2) 
>>> row_3 = row(row_2)
>>> show(row_3) 

Permutes row:

>>> numbers = [10, 0, 2, 6, 8, 7, 5, 3, 1, 9, 4, 11]
>>> row_2 = TwelveToneRow(numbers)
>>> show(row_2) 
>>> row_3 = row(row_2)
>>> show(row_3) 

Returns permuted pitch-classes in object of type pitch_classes.

(TypedTuple).__contains__(item)

Is true if typed tuple contains item.

Coerces item.

Returns none.

(TypedCollection).__eq__(argument)

Is true when argument is a typed collection with items that compare equal to those of this typed collection. Otherwise false.

Returns true or false.

(PitchClassSegment).__format__(format_specification='')

Formats segment.

With numbered pitch-classes:

>>> pitch_numbers = [-2, -1.5, 6, 7, -1.5, 7]
>>> J = PitchClassSegment(items=pitch_numbers)
>>> f(J)
pitchtools.PitchClassSegment(
    (
        pitchtools.NumberedPitchClass(10),
        pitchtools.NumberedPitchClass(10.5),
        pitchtools.NumberedPitchClass(6),
        pitchtools.NumberedPitchClass(7),
        pitchtools.NumberedPitchClass(10.5),
        pitchtools.NumberedPitchClass(7),
        ),
    item_class=pitchtools.NumberedPitchClass,
    )
>>> show(J) 

With named pitch-classes:

>>> pitch_names = ['c', 'ef', 'bqs,', 'd']
>>> K = PitchClassSegment(
...     items=pitch_names,
...     item_class=NamedPitchClass,
...     )
>>> f(K)
pitchtools.PitchClassSegment(
    (
        pitchtools.NamedPitchClass('c'),
        pitchtools.NamedPitchClass('ef'),
        pitchtools.NamedPitchClass('bqs'),
        pitchtools.NamedPitchClass('d'),
        ),
    item_class=pitchtools.NamedPitchClass,
    )
>>> show(K) 

Returns string.

TwelveToneRow.__getitem__(argument)

Gets item or slice identified by argument.

Example row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Gets first hexachord:

>>> show(row[:6]) 

Gets second hexachord:

>>> show(row[-6:]) 

Returns pitch-class segment:

>>> row[-6:]
PitchClassSegment([5, 4, 10, 2, 8, 0])
(TypedTuple).__hash__()

Hashes typed tuple.

Returns integer.

TwelveToneRow.__illustrate__(**keywords)

Illustrates row.

Illustrates row:

>>> row = TwelveToneRow()
>>> show(row) 

Illustrates row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 

Returns LilyPond file:

>>> type(row.__illustrate__())
<class 'abjad.tools.lilypondfiletools.LilyPondFile.LilyPondFile'>
(TypedCollection).__iter__()

Iterates typed collection.

Returns generator.

(TypedCollection).__len__()

Gets length of typed collection.

Returns nonnegative integer.

TwelveToneRow.__mul__(argument)

Multiplies row by argument.

Multiplies row:

>>> row = TwelveToneRow()
>>> show(row) 
>>> segment = row * 2
>>> show(segment) 

Multiplies row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 
>>> segment = row * 2
>>> show(segment) 

Returns pitch-class segment:

>>> segment
PitchClassSegment([1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0, 1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0])

Returns pitch-class segment.

(TypedCollection).__ne__(argument)

Is true when argument is not a typed collection with items equal to this typed collection. Otherwise false.

Returns true or false.

(TypedTuple).__radd__(argument)

Right-adds argument to typed tuple.

(PitchClassSegment).__repr__()

Gets interpreter representation.

Interpreter representation:

>>> items = [-2, -1.5, 6, 7, -1.5, 7]
>>> PitchClassSegment(items=items)
PitchClassSegment([10, 10.5, 6, 7, 10.5, 7])

Returns string.

TwelveToneRow.__rmul__(argument)

Multiplies argument by row.

Multiplies integer by row:

>>> row = TwelveToneRow()
>>> show(row) 
>>> segment = 2 * row
>>> show(segment) 

Multiplies integer by row:

>>> numbers = [1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0]
>>> row = TwelveToneRow(numbers)
>>> show(row) 
>>> segment = 2 * row
>>> show(segment) 

Returns pitch-class segment:

>>> segment
PitchClassSegment([1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0, 1, 11, 9, 3, 6, 7, 5, 4, 10, 2, 8, 0])
(PitchClassSegment).__str__()

Gets string representation of pitch-class segment.

Gets string represenation of numbered pitch class:

>>> segment = PitchClassSegment([-2, -1.5, 6, 7, -1.5, 7])
>>> str(segment)
'PC<10, 10.5, 6, 7, 10.5, 7>'

Gets string represenation of named pitch class:

>>> segment = PitchClassSegment(
...     items=[-2, -1.5, 6, 7, -1.5, 7],
...     item_class=NamedPitchClass,
...     )
>>> str(segment)
'PC<bf bqf fs g bqf g>'

Returns string.