# StaffPosition¶

class `abjad.pitch.StaffPosition.``StaffPosition`(number=0)

Staff position.

Initializes staff position at middle line of staff:

```>>> abjad.StaffPosition(0)
StaffPosition(0)
```

Initializes staff position one space below middle line of staff:

```>>> abjad.StaffPosition(-1)
StaffPosition(-1)
```

Initializes staff position one line below middle line of staff:

```>>> abjad.StaffPosition(-2)
StaffPosition(-2)
```

Initializes from other staff position:

```>>> staff_position = abjad.StaffPosition(-2)
StaffPosition(-2)
```

Attributes Summary

 `__eq__` Is true when argument is a staff position with the same number as this staff position. `__ge__` Return a >= b. `__gt__` Return a > b. `__hash__` Hashes staff position. `__le__` Return a <= b. `__lt__` Is true when staff position is less than argument. `__str__` Gets string representation of staff position. `number` Gets staff position number. `to_pitch` Makes named pitch from staff position and clef.

Special methods

`(AbjadValueObject).``__copy__`(*arguments)

`__eq__`(argument)

Is true when argument is a staff position with the same number as this staff position.

```>>> staff_position_1 = abjad.StaffPosition(-2)
```
```>>> staff_position_1 == staff_position_1
True
>>> staff_position_1 == staff_position_2
True
>>> staff_position_1 == staff_position_3
False
```
```>>> staff_position_2 == staff_position_1
True
>>> staff_position_2 == staff_position_2
True
>>> staff_position_2 == staff_position_3
False
```
```>>> staff_position_3 == staff_position_1
False
>>> staff_position_3 == staff_position_2
False
>>> staff_position_3 == staff_position_3
True
```

Returns true or false.

`(AbjadObject).``__format__`(format_specification='')

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

Returns string.

`__ge__`(other, NotImplemented=NotImplemented)

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

`__gt__`(other, NotImplemented=NotImplemented)

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

`__hash__`()

Hashes staff position.

Returns integer.

`__le__`(other, NotImplemented=NotImplemented)

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

`__lt__`(argument)

Is true when staff position is less than argument.

```>>> staff_position_1 = abjad.StaffPosition(-2)
```
```>>> staff_position_1 < staff_position_1
False
>>> staff_position_1 < staff_position_2
False
>>> staff_position_1 < staff_position_3
True
```
```>>> staff_position_2 < staff_position_1
False
>>> staff_position_2 < staff_position_2
False
>>> staff_position_2 < staff_position_3
True
```
```>>> staff_position_3 < staff_position_1
False
>>> staff_position_3 < staff_position_2
False
>>> staff_position_3 < staff_position_3
False
```

Returns true or false.

`(AbjadObject).``__repr__`()

Gets interpreter representation of Abjad object.

Returns string.

`__str__`()

Gets string representation of staff position.

```>>> str(abjad.StaffPosition(-2))
'StaffPosition(-2)'
```

Returns string.

Methods

`to_pitch`(clef='treble')

Makes named pitch from staff position and clef.

Treble clef:

```>>> clef = abjad.Clef('treble')
>>> for n in range(-6, 6):
...     pitch = staff_position.to_pitch(clef=clef)
...     message = '{!s}     {}'.format(staff_position, pitch)
...     print(message)
...
StaffPosition(-6)   c'
StaffPosition(-5)   d'
StaffPosition(-4)   e'
StaffPosition(-3)   f'
StaffPosition(-2)   g'
StaffPosition(-1)   a'
StaffPosition(0)    b'
StaffPosition(1)    c''
StaffPosition(2)    d''
StaffPosition(3)    e''
StaffPosition(4)    f''
StaffPosition(5)    g''
```

Bass clef:

```>>> clef = abjad.Clef('bass')
>>> for n in range(-6, 6):
...     pitch = staff_position.to_pitch(clef=clef)
...     message = '{!s}     {}'.format(staff_position, pitch)
...     print(message)
...
StaffPosition(-6)   e,
StaffPosition(-5)   f,
StaffPosition(-4)   g,
StaffPosition(-3)   a,
StaffPosition(-2)   b,
StaffPosition(-1)   c
StaffPosition(0)    d
StaffPosition(1)    e
StaffPosition(2)    f
StaffPosition(3)    g
StaffPosition(4)    a
StaffPosition(5)    b
```

Alto clef:

```>>> clef = abjad.Clef('alto')
>>> for n in range(-6, 6):
...     pitch = staff_position.to_pitch(clef=clef)
...     message = '{!s}     {}'.format(staff_position, pitch)
...     print(message)
...
StaffPosition(-6)   d
StaffPosition(-5)   e
StaffPosition(-4)   f
StaffPosition(-3)   g
StaffPosition(-2)   a
StaffPosition(-1)   b
StaffPosition(0)    c'
StaffPosition(1)    d'
StaffPosition(2)    e'
StaffPosition(3)    f'
StaffPosition(4)    g'
StaffPosition(5)    a'
```

Percussion clef:

```>>> clef = abjad.Clef('percussion')
>>> for n in range(-6, 6):
...     pitch = staff_position.to_pitch(clef=clef)
...     message = '{!s}     {}'.format(staff_position, pitch)
...     print(message)
...
StaffPosition(-6)   d
StaffPosition(-5)   e
StaffPosition(-4)   f
StaffPosition(-3)   g
StaffPosition(-2)   a
StaffPosition(-1)   b
StaffPosition(0)    c'
StaffPosition(1)    d'
StaffPosition(2)    e'
StaffPosition(3)    f'
StaffPosition(4)    g'
StaffPosition(5)    a'
```

Returns new named pitch.

`number`

Gets staff position number.

```>>> abjad.StaffPosition(-2).number
-2
```

Returns number.