WoodwindFingering

class instrumenttools.WoodwindFingering(instrument_name=None, center_column=None, left_hand=None, right_hand=None)

A woodwind fingering.

Initializes from a valid instrument name and up to three keyword lists or tuples:

>>> center_column = ('one', 'two', 'three', 'five')
>>> left_hand = ('R', 'thumb')
>>> right_hand = ('e',)
>>> woodwind_fingering = instrumenttools.WoodwindFingering(
...     instrument_name='clarinet',
...     center_column=center_column,
...     left_hand=left_hand,
...     right_hand=right_hand,
...     )
>>> print(format(woodwind_fingering, 'storage'))
instrumenttools.WoodwindFingering(
    instrument_name='clarinet',
    center_column=('one', 'two', 'three', 'five'),
    left_hand=('R', 'thumb'),
    right_hand=('e',),
    )

Initializes a WoodwindFingering from another WoodwindFingering:

>>> woodwind_fingering_2 = instrumenttools.WoodwindFingering(
...     woodwind_fingering)
>>> print(format(woodwind_fingering_2))
instrumenttools.WoodwindFingering(
    instrument_name='clarinet',
    center_column=('one', 'two', 'three', 'five'),
    left_hand=('R', 'thumb'),
    right_hand=('e',),
    )

Calls a WoodwindFingering to create a woodwind diagram MarkupCommand:

>>> fingering_command = woodwind_fingering()
>>> print(format(fingering_command))
markuptools.MarkupCommand(
    'woodwind-diagram',
    schemetools.Scheme(
        'clarinet',
        quoting="'",
        ),
    schemetools.Scheme(
        schemetools.SchemePair('cc', ('one', 'two', 'three', 'five')),
        schemetools.SchemePair('lh', ('R', 'thumb')),
        schemetools.SchemePair('rh', ('e',)),
        quoting="'",
        )
    )

Attaches the MarkupCommand to score components, such as a chord representing a multiphonic sound:

>>> markup = markuptools.Markup(contents=fingering_command, direction=Down)
>>> chord = Chord("<ds' fs''>4")
>>> attach(markup, chord)
>>> show(chord) 

Initializes fingerings for eight different woodwind instruments:

>>> instrument_names = [
...     'piccolo', 'flute', 'oboe', 'clarinet', 'bass-clarinet',
...     'saxophone', 'bassoon', 'contrabassoon',
...     ]
>>> for name in instrument_names:
...    instrumenttools.WoodwindFingering(name)
...
WoodwindFingering(instrument_name='piccolo', center_column=(), left_hand=(), right_hand=())
WoodwindFingering(instrument_name='flute', center_column=(), left_hand=(), right_hand=())
WoodwindFingering(instrument_name='oboe', center_column=(), left_hand=(), right_hand=())
WoodwindFingering(instrument_name='clarinet', center_column=(), left_hand=(), right_hand=())
WoodwindFingering(instrument_name='bass-clarinet', center_column=(), left_hand=(), right_hand=())
WoodwindFingering(instrument_name='saxophone', center_column=(), left_hand=(), right_hand=())
WoodwindFingering(instrument_name='bassoon', center_column=(), left_hand=(), right_hand=())
WoodwindFingering(instrument_name='contrabassoon', center_column=(), left_hand=(), right_hand=())

An override displays diagrams symbolically instead of graphically:

>>> chord = Chord("<e' as' gqf''>1")
>>> fingering = instrumenttools.WoodwindFingering(
...     'clarinet',
...     center_column=['one', 'two', 'three', 'four'],
...     left_hand=['R','cis'],
...     right_hand=['fis'])
>>> diagram = fingering()
>>> not_graphical = markuptools.MarkupCommand(
...     'override',
...     schemetools.SchemePair('graphical', False))
>>> markup = markuptools.Markup(contents=
...     [not_graphical, diagram], direction=Down)
>>> attach(markup, chord)
>>> show(chord) 

The thickness and size of diagrams can also be changed with overrides:

>>> chord = Chord("<e' as' gqf''>1")
>>> fingering = instrumenttools.WoodwindFingering(
...     'clarinet',
...     center_column=('one', 'two', 'three', 'four'),
...     left_hand=('R','cis'),
...     right_hand=('fis',),
...     )
>>> diagram = fingering()
>>> not_graphical = markuptools.MarkupCommand(
...     'override',
...     schemetools.SchemePair('graphical', False))
>>> size = markuptools.MarkupCommand(
...     'override', schemetools.SchemePair('size', .5))
>>> thickness = markuptools.MarkupCommand(
...     'override', schemetools.SchemePair('thickness', .4))
>>> markup = markuptools.Markup(contents=
...     [not_graphical, size, thickness, diagram], direction=Down)
>>> attach(markup, chord)
>>> show(chord) 

Inspired by Mike Solomon’s LilyPond woodwind diagrams.

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.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_instrumenttools { graph [label=instrumenttools]; "abjad.tools.instrumenttools.WoodwindFingering.WoodwindFingering" [color=black, fontcolor=white, group=2, label=<<B>WoodwindFingering</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.AbjadObject.AbjadObject" -> "abjad.tools.instrumenttools.WoodwindFingering.WoodwindFingering"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

center_column Tuple of contents of key strings in center
instrument_name String of valid woodwind instrument name:
left_hand Tuple of contents of key strings in left
print_guide() Print read-only string containing instrument’s valid key strings, instrument diagram, and syntax explanation.
right_hand Tuple of contents of key strings in right
__call__() Calls woodwind fingering.
__eq__(expr) Is true when ID of expr equals ID of Abjad object.
__format__([format_specification]) Formats woodwind fingering.
__hash__() Hashes Abjad object.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

WoodwindFingering.center_column
Tuple of contents of key strings in center
column key group:
>>> woodwind_fingering.center_column
('one', 'two', 'three', 'five')

Returns tuple.

WoodwindFingering.instrument_name

String of valid woodwind instrument name:

>>> woodwind_fingering.instrument_name
'clarinet'

Returns string.

WoodwindFingering.left_hand
Tuple of contents of key strings in left
hand key group:
>>> woodwind_fingering.left_hand
('R', 'thumb')

Returns tuple.

WoodwindFingering.right_hand
Tuple of contents of key strings in right
hand key group:
>>> woodwind_fingering.right_hand
('e',)

Returns tuple.

Methods

WoodwindFingering.print_guide()

Print read-only string containing instrument’s valid key strings, instrument diagram, and syntax explanation.

Returns string.

Special methods

WoodwindFingering.__call__()

Calls woodwind fingering.

Returns markup command.

(AbjadObject).__eq__(expr)

Is true when ID of expr equals ID of Abjad object. Otherwise false.

Returns true or false.

WoodwindFingering.__format__(format_specification='')

Formats woodwind fingering.

Set format_specification to ‘’ or ‘storage’.

Returns string.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(AbjadObject).__ne__(expr)

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

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.