The instrument's name, as its profile carries it.
Which family the instrument belongs to.
Greatest number of notes that can sound at once.
A copy of the techniques the instrument can produce.
A copy of the underlying plain profile.
StaticofWrap a plain instrument profile, whether a built-in one or a caller's own.
An Instrument is accepted too, and comes back as an equal one: the
factory is the boundary a profile crosses everywhere in the library, so it
takes the same InstrumentProfileLike every other entry point does
rather than making a caller unwrap what it already holds.
The plain profile, or an instrument standing for one.
The wrapped instrument.
StaticguitarStaticguitarSix-string guitar in drop D: the lowest string down a tone to D2, the rest standard.
The instrument.
Staticbass4Staticbass5StaticfromRebuild an instrument from the plain profile Instrument.data hands out.
The plain profile.
The wrapped instrument.
If the profile describes no instrument; see Instrument.of.
StaticfromRebuild an instrument from its Instrument.toJSON output.
The serialized profile.
The wrapped instrument.
If the profile describes no instrument; see Instrument.of.
The lowest and highest pitch the instrument sounds.
Derived from the tuning and the fret count, or from the voices the player's limbs reach, rather than stored — and not necessarily gapless, so Instrument.canSound answers for one pitch.
The extreme sounding pitches as MIDI numbers, inclusive.
Whether the instrument has this pitch at all.
MIDI pitch.
True when some string and fret, or some limb the player has, produces it.
Every position on the neck that sounds a pitch, lowest string first.
MIDI pitch.
One entry per string that reaches the pitch; empty when none does.
Move a pitch by whole octaves until the instrument can sound it, which is what a player does with a line written below the instrument.
MIDI pitch to place.
The nearest octave transposition the instrument sounds, taking the upper one when two are equally near; the pitch unchanged when no transposition is available.
The pitch this instrument sounds for a note written in its part.
Most parts are written at the pitch they sound, but some are not: a guitar part is printed an octave above concert pitch, and a part for an instrument in B flat or in A is printed in a different key altogether. The instrument is looked up by its own name, so an instrument the transposition table carries needs nothing said; name a transposition to read a part for one it does not, which is every instrument whose profile is the caller's own.
The interval decides the letter, so the spelling of the part survives: on a clarinet in A a written D sharp sounds B sharp, where a semitone count alone would answer C natural and lose the letter the part is written on.
A note name, a MIDI number, plain note data, or a Note, as
the player reads it.
The written-to-sounding transposition to read the part under; the instrument's own name by default.
The sounding note, at concert pitch.
Judge whether a passage can be played on this instrument, and how hard it is.
Nothing is rewritten or rejected: the report names what stands in the way,
and only the tempo-dependent layer consults bpm, so omitting the tempo
reports what the instrument alone decides.
The passage, in any order. Drum hits qualify as note events.
Optionalbpm: number
Tempo in quarter-note beats per minute; enables the layer that asks whether there is time for the movement.
Difficulty, the issues found, and each note's string/fret or limb.
Whether another instrument is described identically.
The instrument to compare with.
True when both profiles name the same instrument, string for string or voice for voice.
The plain profile, for JSON serialization.
Private class fields do not serialize, so an explicit toJSON keeps
JSON.stringify(instrument) from collapsing to {}.
A copy of the underlying profile, its lists included.
An immutable instrument: what it physically is — an open-string tuning and a fret count, or the voices each limb reaches — with the range, the positions and the playability checks of the instrument module bound to it. A thin convenience wrapper over a plain InstrumentProfile.
Example