pitchtools.get_pitches — Abjad v1.1.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »

# pitchtools.get_pitches

`abjad.tools.pitchtools.` `get_pitches`(expr)

  Get tuple of zero or more Abjad `Pitch` instances from almost any expression.

      abjad> t = FixedDurationTuplet((2, 8), construct.scale(3))
      abjad> pitchtools.get_pitches(t)
      ((Pitch(c, 4), Pitch(d, 4), Pitch(e, 4))

      abjad> t = Staff(construct.scale(4))
      abjad> beam = Beam(t[:])
      abjad> pitchtools.get_pitches(beam)
      ((Pitch(c, 4), Pitch(d, 4), Pitch(e, 4), Pitch(f, 4))

      abjad> pitch = Pitch('df', 5)
      abjad> pitchtools.get_pitches(pitch)
      (Pitch(df, 5),)

      abjad> note = Note(('df', 5), (1, 4))
      abjad> pitchtools.get_pitches(note)
      (Pitch(df, 5),)

      abjad> chord = Chord([0, 2, 10], (1, 4))
      abjad> pitchtools.get_pitches(chord)
      (Pitch(c, 4), Pitch(d, 4), Pitch(bf, 4))

      abjad> pitchtools.get_pitches('foo')
      ()

      abjad> pitchtools.get_pitches(Rest((1, 4)))
      ()

  Raises neither `MissingPitchError` nor `ExtraPitchError`.

  Note

  The logic implemented here to iterate over the contents of spanners is unusual but useful.

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »