lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"Instrument" as first class citizen (Was: ...)


From: Gilles
Subject: "Instrument" as first class citizen (Was: ...)
Date: Thu, 23 Apr 2015 04:28:22 +0200
User-agent: Scarlet Webmail

On Wed, 22 Apr 2015 19:17:53 -0700, Flaming Hakama by Elaine wrote:
[...]
Without getting too technical, objects are things that you can create, have
properties and relationships with other well-defined objects.

This is true for things like staves, staff groups, scores, books, etc. You can say: \new Staff = { ... } to create a new staff because there is
an object class called Staff that is well-defined.
It has known properties like Staff.TimeSignature, Staff.extraNatural, etc. Other objects (Staff Groups, Books, etc.) know how to handle this Staff
object, or several Staff objects.

However, in the case of "instrument", there is no such object so you cannot
create one.
There are certainly properties of other objects (namely, staves) that have
"instrument" in the name, like Staff.instrumentName,
Staff.shortInstrumentName, Staff,midiInstrument.
However, these are *properties of a Staff object*.
There is no way to create an "instrument" outside the context of a staff,
or identify or change its properties.
You cannot add an instrument to a staff or any other object.

If there were, the syntax might be more like:

violin = \new Instrument {
    Instrument.name = 'violin'
    Instrument.shortName = 'v.'
    Instrument.midi = 'violin'
    Instrument.clef = treble
    ...
}

\new Staff {
    Staff.Instrument = \violin
    \violinMusic
}

From the viewpoint of the encoder, this is quite sensible.
This would be a nice syntax simplification.

Best,
Gilles


As an aside, an outstanding problem with lilypond is that it is difficult
to write multi-instrument parts.
This points to a lack of clarity of design around the distinction between a
voice, instrument and staff.
At its core is the lack of a coherent concept of instrument.

Which is to say, while you might point to the Staff as the place where most instrument information is situated, Staff and Instrument are clearly not
identical concepts, nor is Instrument a proper subset of a Staff.

Perhaps the reason there is no such Instrument object in lilypond is that
an "instrument" is not a grob.
There is no place that an "instrument" appears on the page, except as a
label for a staff.

Yet, for the purpose of this discussion, it is clear that everyone thinks
in terms of "instruments".
So, the documentation ought to explain exactly how this commonsense
conceptual notion of "instrument" maps to the actual objects and properties
that are available.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]