Transposition

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.pitch" { graph [label="abjad.pitch"]; node [color=1]; "abjad.pitch.Transposition.Transposition" [URL="../api/abjad/pitch/Transposition.html#abjad.pitch.Transposition.Transposition", color=black, fontcolor=white, label=Transposition, target=_top]; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/pitch/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjad/pitch/../system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadValueObject.AbjadValueObject" -> "abjad.pitch.Transposition.Transposition"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.pitch.Transposition.Transposition(*, n=0)

Transposition operator.

>>> abjad.Transposition()
Transposition(n=0)
>>> abjad.Transposition(n=2)
Transposition(n=2)

Object model of twelve-tone transposition operator.


Attributes Summary

__add__ Composes transposition and operator.
__call__ Calls transposition on argument.
__radd__ Right-addition not defined on transposition.
__str__ Gets string representation of operator.
n Gets index of transposition.

Special methods

__add__(operator)

Composes transposition and operator.

Example segment:

>>> items = [0, 2, 4, 5]
>>> segment = abjad.PitchClassSegment(items=items)
>>> abjad.show(segment) 

Example operators:

>>> T_1 = abjad.Transposition(n=1)
>>> T_3 = abjad.Transposition(n=3)

Successive transposition:

>>> operator = T_1 + T_3
>>> str(operator)
'T1T3'
>>> segment_ = operator(segment)
>>> abjad.show(segment_) 

Same as above because transposition commutes:

>>> operator = T_3 + T_1
>>> str(operator)
'T3T1'
>>> segment_ = operator(segment)
>>> abjad.show(segment_) 

Returns compound operator.

__call__(argument)

Calls transposition on argument.

Transposes pitch-class:

>>> transposition = abjad.Transposition(n=2)
>>> pitch_class = abjad.NumberedPitchClass(1)
>>> transposition(pitch_class)
NumberedPitchClass(3)

Transposes pitch:

>>> transposition = abjad.Transposition(n=2)
>>> pitch = abjad.NumberedPitch(15)
>>> transposition(pitch)
NumberedPitch(17)

Transposes list of pitches:

>>> transposition = abjad.Transposition(n=2)
>>> pitches = [abjad.NumberedPitch(_) for _ in [15, 16]]
>>> transposition(pitches)
[NumberedPitch(17), NumberedPitch(18)]

Returns new object with type equal to that of argument.

(AbjadValueObject).__copy__(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(argument)

Is true when all initialization values of Abjad value object equal the initialization values of argument.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

__radd__(operator)

Right-addition not defined on transposition.

>>> abjad.Transposition().__radd__(abjad.Transposition())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/pitch/Transposition.py", line 170, in __radd__
    raise NotImplementedError(message)
NotImplementedError: right-addition not defined on Transposition.

Raises not implemented error.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__str__()

Gets string representation of operator.

>>> str(abjad.Transposition())
'T0'
>>> str(abjad.Transposition(n=2))
'T2'

Read-only properties

n

Gets index of transposition.

>>> transposition = abjad.Transposition()
>>> transposition.n
0
>>> transposition = abjad.Transposition(n=2)
>>> transposition.n
2

Set to integer, interval or none.