Octave

class pitchtools.Octave(number=4)

Octave.

>>> import abjad

Initializes octave from integer:

>>> abjad.Octave(4)
Octave(4)

Initializes octave from octave-tick string:

>>> abjad.Octave(",,")
Octave(1)

Initializes octave from named pitch:

>>> abjad.Octave(abjad.NamedPitch("cs''"))
Octave(5)

Initializes octave from other octave:

>>> abjad.Octave(abjad.Octave(2))
Octave(2)

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.AbjadValueObject.AbjadValueObject" [color=1, group=0, label=AbjadValueObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.AbjadValueObject.AbjadValueObject"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_pitchtools { graph [label=pitchtools]; "abjad.tools.pitchtools.Octave.Octave" [color=black, fontcolor=white, group=2, label=<<B>Octave</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.pitchtools.Octave.Octave"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

from_pitch(pitch) Makes octave from pitch.
number Gets octave number.
pitch_number Gets pitch number of first note in octave.
pitch_range Gets pitch range of octave.
ticks Gets LilyPond octave tick string.
__copy__(*arguments) Copies Abjad value object.
__eq__(argument) Is true when argument is octave with same octave number.
__format__([format_specification]) Formats Abjad object.
__ge__(other[, NotImplemented]) Return a >= b.
__gt__(other[, NotImplemented]) Return a > b.
__hash__() Hashes octave.
__le__(other[, NotImplemented]) Return a <= b.
__lt__(argument) Is true when octave is less than argument.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.
__str__() Gets string representation of octave.

Read-only properties

Octave.number

Gets octave number.

>>> abjad.Octave(5).number
5

Returns integer.

Octave.pitch_number

Gets pitch number of first note in octave.

>>> abjad.Octave(4).pitch_number
0
>>> abjad.Octave(5).pitch_number
12
>>> abjad.Octave(3).pitch_number
-12

Returns integer.

Octave.pitch_range

Gets pitch range of octave.

>>> abjad.Octave(5).pitch_range
PitchRange('[C5, C6)')

Returns pitch range.

Octave.ticks

Gets LilyPond octave tick string.

>>> for i in range(-1, 9):
...     print(i, abjad.Octave(i).ticks)
-1 ,,,,
0  ,,,
1  ,,
2  ,
3
4  '
5  ''
6  '''
7  ''''
8  '''''

Returns string.

Class & static methods

classmethod Octave.from_pitch(pitch)

Makes octave from pitch.

>>> abjad.Octave.from_pitch('cs')
Octave(3)
>>> abjad.Octave.from_pitch("cs'")
Octave(4)
>>> abjad.Octave.from_pitch(1)
Octave(4)
>>> abjad.Octave.from_pitch(13)
Octave(5)

Returns integer.

Special methods

(AbjadValueObject).__copy__(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

Octave.__eq__(argument)

Is true when argument is octave with same octave number. Otherwise False.

>>> octave_1 = abjad.Octave(4)
>>> octave_2 = abjad.Octave(4)
>>> octave_3 = abjad.Octave(5)
>>> octave_1 == octave_1
True
>>> octave_1 == octave_2
True
>>> octave_1 == octave_3
False
>>> octave_2 == octave_1
True
>>> octave_2 == octave_2
True
>>> octave_2 == octave_3
False
>>> octave_3 == octave_1
False
>>> octave_3 == octave_2
False
>>> octave_3 == octave_3
True

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

Octave.__ge__(other, NotImplemented=NotImplemented)

Return a >= b. Computed by @total_ordering from (not a < b).

Octave.__gt__(other, NotImplemented=NotImplemented)

Return a > b. Computed by @total_ordering from (not a < b) and (a != b).

Octave.__hash__()

Hashes octave.

Returns integer.

Octave.__le__(other, NotImplemented=NotImplemented)

Return a <= b. Computed by @total_ordering from (a < b) or (a == b).

Octave.__lt__(argument)

Is true when octave is less than argument.

>>> octave_1 = abjad.Octave(4)
>>> octave_2 = abjad.Octave(4)
>>> octave_3 = abjad.Octave(5)
>>> octave_1 < octave_1
False
>>> octave_1 < octave_2
False
>>> octave_1 < octave_3
True
>>> octave_2 < octave_1
False
>>> octave_2 < octave_2
False
>>> octave_2 < octave_3
True
>>> octave_3 < octave_1
False
>>> octave_3 < octave_2
False
>>> octave_3 < octave_3
False

Returns true or false.

(AbjadObject).__ne__(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

Octave.__str__()

Gets string representation of octave.

Defined equal to LilyPond octave / tick representation of octave.

>>> str(abjad.Octave(4))
"'"
>>> str(abjad.Octave(1))
',,'
>>> str(abjad.Octave(3))
''

Returns string.