notes_and_chords_are_on_expected_clefs

instrumenttools.notes_and_chords_are_on_expected_clefs(expr, percussion_clef_is_allowed=True)

Is true when notes and chords in expr are on expected clefs.

Todo

Move to WellformednessManager.

Example 1. Expected clef:

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> clef = Clef(name='treble')
>>> attach(clef, staff)
>>> violin = instrumenttools.Violin()
>>> attach(violin, staff)
>>> show(staff) 
>>> instrumenttools.notes_and_chords_are_on_expected_clefs(staff)
True

Example 2. Unexpected clef:

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> clef = Clef(name='alto')
>>> attach(clef, staff)
>>> violin = instrumenttools.Violin()
>>> attach(violin, staff)
>>> show(staff) 
>>> instrumenttools.notes_and_chords_are_on_expected_clefs(staff)
False

Example 3. Allows percussion clef:

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> clef = Clef(name='percussion')
>>> attach(clef, staff)
>>> violin = instrumenttools.Violin()
>>> attach(violin, staff)
>>> show(staff) 
>>> instrumenttools.notes_and_chords_are_on_expected_clefs(
...     staff, percussion_clef_is_allowed=True)
True

Example 4. Forbids percussion clef:

>>> instrumenttools.notes_and_chords_are_on_expected_clefs(
...     staff, percussion_clef_is_allowed=False)
False

Returns true or false.