Instruments
===========


Initializing instruments
------------------------

Use ``instrumenttools`` to initialize instruments:

<abjad>
violin = instrumenttools.Violin()
</abjad>

<abjad>
violin
</abjad>


Attaching instruments to a component
------------------------------------

Use ``attach()`` to attach instruments to a component:

<abjad>
staff = Staff("c'4 d'4 e'4 f'4")
violin.attach(staff)
show(staff)
</abjad>


Getting the instrument attached to a component
----------------------------------------------

Use the inspector to get the instrument attached to a component:

<abjad>
inspect(staff).get_mark(instrumenttools.Instrument)
</abjad>


Getting the instrument in effect for a component
------------------------------------------------

Use the inspector to get the instrument currently in effect for a component:

<abjad>
inspect(staff[1]).get_effective_context_mark(instrumenttools.Instrument)
</abjad>


Detaching instruments from a component
--------------------------------------

Use ``detach()`` to detach an instrument from a component:

<abjad>
violin.detach()
show(staff)
</abjad>


Inspecting the component to which an instrument is attached
-----------------------------------------------------------

Use ``start_component`` to inspect the component to which an instrument is
attached:

<abjad>
flute = instrumenttools.Flute()
flute.attach(staff)
show(staff)
</abjad>

<abjad>
flute.start_component
</abjad>


Inspecting the instrument name of an instrument
-----------------------------------------------

Use ``instrument_name`` to get the name of any instrument:

<abjad>
flute.instrument_name
</abjad>

And use ``instrument_name_markup`` to get the instrument name markup of
any instrument:

<abjad>
flute.instrument_name_markup
</abjad>


Inspecting the short instrument name of an instrument
-----------------------------------------------------

Use ``short_instrument_name`` to get the short instrument name of any
instrument:

<abjad>
flute.short_instrument_name
</abjad>

And use ``short_instrument_name_markup`` to get the short instrument name
markup of any instrument:

<abjad>
flute.short_instrument_name_markup
</abjad>
