Performer

class instrumenttools.Performer(name=None, instruments=None)

A performer.

>>> performer = instrumenttools.Performer(name='flutist')
>>> performer.instruments.append(instrumenttools.Flute())
>>> performer.instruments.append(instrumenttools.Piccolo())
>>> print(format(performer))
instrumenttools.Performer(
    name='flutist',
    instruments=instrumenttools.InstrumentInventory(
        [
            instrumenttools.Flute(
                instrument_name='flute',
                short_instrument_name='fl.',
                instrument_name_markup=markuptools.Markup(
                    contents=('Flute',),
                    ),
                short_instrument_name_markup=markuptools.Markup(
                    contents=('Fl.',),
                    ),
                allowable_clefs=indicatortools.ClefInventory(
                    [
                        indicatortools.Clef(
                            name='treble',
                            ),
                        ]
                    ),
                pitch_range=pitchtools.PitchRange(
                    range_string='[C4, D7]',
                    ),
                sounding_pitch_of_written_middle_c=pitchtools.NamedPitch("c'"),
                ),
            instrumenttools.Piccolo(
                instrument_name='piccolo',
                short_instrument_name='picc.',
                instrument_name_markup=markuptools.Markup(
                    contents=('Piccolo',),
                    ),
                short_instrument_name_markup=markuptools.Markup(
                    contents=('Picc.',),
                    ),
                allowable_clefs=indicatortools.ClefInventory(
                    [
                        indicatortools.Clef(
                            name='treble',
                            ),
                        ]
                    ),
                pitch_range=pitchtools.PitchRange(
                    range_string='[D5, C8]',
                    ),
                sounding_pitch_of_written_middle_c=pitchtools.NamedPitch("c''"),
                ),
            ]
        ),
    )

Performer models instrument doublings.

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.Performer.Performer" [color=black, fontcolor=white, group=2, label=<<B>Performer</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.Performer.Performer"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

get_instrument(instrument_name) Gets instrument in performer with instrument_name.
instrument_count Gets count of instruments to be played by performer.
instruments Gets and sets instruments to be played by performer.
is_doubling Is true when performer is to play more than one instrument.
likely_instruments_based_on_performer_name Gets likely instruments based on performer name.
list_performer_names() Lists performer names.
list_primary_performer_names() Lists primary performer names.
make_performer_name_instrument_dictionary() Makes performer name / instrument dictionary.
most_likely_instrument_based_on_performer_name Gets most likely instrument based on performer name.
name Gets and sets score name of performer.
__eq__(expr) Is true when expr is a performer with name and instruments equal to those of this performer.
__format__([format_specification]) Formats performer.
__hash__() Hashes performer.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

Performer.instrument_count

Gets count of instruments to be played by performer.

>>> performer = instrumenttools.Performer(name='flutist')
>>> performer.instruments.append(instrumenttools.Flute())
>>> performer.instruments.append(instrumenttools.Piccolo())
>>> performer.instrument_count
2

Returns nonnegative integer

Performer.is_doubling

Is true when performer is to play more than one instrument. Otherwise false.

>>> performer = instrumenttools.Performer(name='flutist')
>>> performer.instruments.append(instrumenttools.Flute())
>>> performer.instruments.append(instrumenttools.Piccolo())
>>> performer.is_doubling
True

Returns true or false.

Performer.likely_instruments_based_on_performer_name

Gets likely instruments based on performer name.

>>> performer = instrumenttools.Performer(name='flutist')
>>> performer.instruments.append(instrumenttools.Flute())
>>> performer.instruments.append(instrumenttools.Piccolo())
>>> for likely_instrument in \
...     performer.likely_instruments_based_on_performer_name:
...     likely_instrument.__name__
...
'AltoFlute'
'BassFlute'
'ContrabassFlute'
'Flute'
'Piccolo'

Returns list.

Performer.most_likely_instrument_based_on_performer_name

Gets most likely instrument based on performer name.

>>> performer = instrumenttools.Performer(name='flutist')
>>> performer.instruments.append(instrumenttools.Flute())
>>> performer.instruments.append(instrumenttools.Piccolo())
>>> performer.most_likely_instrument_based_on_performer_name
<class 'abjad.tools.instrumenttools.Flute.Flute'>

Returns instrument class.

Read/write properties

Performer.instruments

Gets and sets instruments to be played by performer.

>>> performer = instrumenttools.Performer(name='flutist')
>>> performer.instruments.append(instrumenttools.Flute())
>>> performer.instruments.append(instrumenttools.Piccolo())
>>> for instrument in performer.instruments:
...     instrument
Flute()
Piccolo()

Returns instrument inventory.

Performer.name

Gets and sets score name of performer.

>>> performer = instrumenttools.Performer(name='flutist')
>>> performer.instruments.append(instrumenttools.Flute())
>>> performer.instruments.append(instrumenttools.Piccolo())
>>> performer.name
'flutist'

Returns string.

Methods

Performer.get_instrument(instrument_name)

Gets instrument in performer with instrument_name.

For examples:

>>> flutist = instrumenttools.Performer(name='flutist')
>>> flutist.instruments.append(instrumenttools.Flute())
>>> flutist.instruments.append(instrumenttools.Piccolo())

Example 1. Gets instrument with instrument name:

>>> flutist.get_instrument('piccolo')
Piccolo()

Example 2. Gets instrument with short instrument name:

>>> flutist.get_instrument('picc.')
Piccolo()

Example 3. Gets instrument regardless of case:

>>> flutist.get_instrument('PICCOLO')
Piccolo()

Example 4. Returns none when no match is found:

>>> flutist.get_instrument('xyl.') is None
True

Returns instrument or none.

Class & static methods

static Performer.list_performer_names()

Lists performer names.

>>> for name in instrumenttools.Performer.list_performer_names():
...     name
...
'accordionist'
'alto'
'baritone'
'bass'
'bassist'
'bassoonist'
'cellist'
'clarinetist'
'flutist'
'guitarist'
'harpist'
'harpsichordist'
'hornist'
'mezzo-soprano'
'oboist'
'percussionist'
'pianist'
'saxophonist'
'soprano'
'tenor'
'trombonist'
'trumpeter'
'tubist'
'vibraphonist'
'violinist'
'violist'
'xylophonist'

Returns list.

static Performer.list_primary_performer_names()

Lists primary performer names.

>>> for pair in instrumenttools.Performer.list_primary_performer_names():
...     pair
...
('accordionist', 'acc.')
('alto', 'alto')
('baritone', 'bar.')
('bass', 'bass')
('bassist', 'cb.')
('bassoonist', 'bsn.')
('cellist', 'vc.')
('clarinetist', 'cl.')
('flutist', 'fl.')
('guitarist', 'gt.')
('harpist', 'hp.')
('harpsichordist', 'hpschd.')
('hornist', 'hn.')
('mezzo-soprano', 'ms.')
('oboist', 'ob.')
('pianist', 'pf.')
('saxophonist', 'alt. sax.')
('soprano', 'sop.')
('tenor', 'ten.')
('trombonist', 'ten. trb.')
('trumpeter', 'tp.')
('tubist', 'tb.')
('violinist', 'vn.')
('violist', 'va.')

Returns list.

static Performer.make_performer_name_instrument_dictionary()

Makes performer name / instrument dictionary.

>>> dictionary = \
...     performer.make_performer_name_instrument_dictionary()
>>> for key, value in sorted(dictionary.items()):
...     print(key + ':')
...     for x in value:
...         print('\t{}'.format(x.__name__))
accordionist:
    Accordion
alto:
    AltoVoice
baritone:
    BaritoneVoice
bass:
    BassVoice
bassist:
    Contrabass
bassoonist:
    Bassoon
    Contrabassoon
brass player:
    AltoTrombone
    BassTrombone
    FrenchHorn
    TenorTrombone
    Trumpet
    Tuba
cellist:
    Cello
clarinetist:
    BassClarinet
    ClarinetInA
    ClarinetInBFlat
    ClarinetInEFlat
    ContrabassClarinet
clarinettist:
    BassClarinet
    ClarinetInA
    ClarinetInBFlat
    ClarinetInEFlat
    ContrabassClarinet
contrabassist:
    Contrabass
double reed player:
    Bassoon
    Contrabassoon
    EnglishHorn
    Oboe
flautist:
    AltoFlute
    BassFlute
    ContrabassFlute
    Flute
    Piccolo
flutist:
    AltoFlute
    BassFlute
    ContrabassFlute
    Flute
    Piccolo
guitarist:
    Guitar
harpist:
    Harp
harpsichordist:
    Harpsichord
hornist:
    FrenchHorn
instrumentalist:
    Accordion
    AltoFlute
    AltoSaxophone
    AltoTrombone
    AltoVoice
    BaritoneSaxophone
    BaritoneVoice
    BassClarinet
    BassFlute
    Bassoon
    BassSaxophone
    BassTrombone
    BassVoice
    Cello
    ClarinetInA
    ClarinetInBFlat
    ClarinetInEFlat
    Contrabass
    ContrabassClarinet
    ContrabassFlute
    Contrabassoon
    ContrabassSaxophone
    EnglishHorn
    Flute
    FrenchHorn
    Glockenspiel
    Guitar
    Harp
    Harpsichord
    Marimba
    MezzoSopranoVoice
    Oboe
    Percussion
    Piano
    Piccolo
    SopraninoSaxophone
    SopranoSaxophone
    SopranoVoice
    TenorSaxophone
    TenorTrombone
    TenorVoice
    Trumpet
    Tuba
    Vibraphone
    Viola
    Violin
    Xylophone
keyboardist:
    Accordion
    Harpsichord
    Piano
mezzo-soprano:
    MezzoSopranoVoice
oboist:
    EnglishHorn
    Oboe
percussionist:
    Glockenspiel
    Marimba
    Percussion
    Vibraphone
    Xylophone
pianist:
    Piano
reed player:
    AltoSaxophone
    BaritoneSaxophone
    BassClarinet
    Bassoon
    BassSaxophone
    ClarinetInA
    ClarinetInBFlat
    ClarinetInEFlat
    ContrabassClarinet
    Contrabassoon
    ContrabassSaxophone
    EnglishHorn
    Oboe
    SopraninoSaxophone
    SopranoSaxophone
    TenorSaxophone
saxophonist:
    AltoSaxophone
    BaritoneSaxophone
    BassSaxophone
    ContrabassSaxophone
    SopraninoSaxophone
    SopranoSaxophone
    TenorSaxophone
single reed player:
    AltoSaxophone
    BaritoneSaxophone
    BassClarinet
    BassSaxophone
    ClarinetInA
    ClarinetInBFlat
    ClarinetInEFlat
    ContrabassClarinet
    ContrabassSaxophone
    SopraninoSaxophone
    SopranoSaxophone
    TenorSaxophone
soprano:
    SopranoVoice
string player:
    Cello
    Contrabass
    Guitar
    Harp
    Viola
    Violin
tenor:
    TenorVoice
trombonist:
    AltoTrombone
    BassTrombone
    TenorTrombone
trumpeter:
    Trumpet
tubist:
    Tuba
vibraphonist:
    Vibraphone
violinist:
    Violin
violist:
    Viola
vocalist:
    AltoVoice
    BaritoneVoice
    BassVoice
    MezzoSopranoVoice
    SopranoVoice
    TenorVoice
wind player:
    AltoFlute
    AltoSaxophone
    BaritoneSaxophone
    BassClarinet
    BassFlute
    Bassoon
    BassSaxophone
    ClarinetInA
    ClarinetInBFlat
    ClarinetInEFlat
    ContrabassClarinet
    ContrabassFlute
    Contrabassoon
    ContrabassSaxophone
    EnglishHorn
    Flute
    FrenchHorn
    Oboe
    Piccolo
    SopraninoSaxophone
    SopranoSaxophone
    TenorSaxophone
xylophonist:
    Xylophone

Returns ordered dictionary.

Special methods

Performer.__eq__(expr)

Is true when expr is a performer with name and instruments equal to those of this performer. Otherwise false.

Returns true or false.

Performer.__format__(format_specification='')

Formats performer.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

Performer.__hash__()

Hashes performer.

Returns string.

(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.