Skip to content

Instruments

Per-instrument physical modeling was removed

Earlier versions included detailed physical performer models (bow direction, hand spans, fret positions, fatigue, harmonics, and so on) that scored how playable each note was. The composer engine does not use these. Instrument handling is now intentionally simpler: a General MIDI program, a playable range, and an ornament-density profile. This page describes what the engine actually does today.

What an Instrument Selects

Choosing an instrument affects three things:

  1. General MIDI program — the sound written into the MIDI file.
  2. Playable range — the pitch window the candidate search keeps the generated lines within. Notes are folded back into range rather than modeled for ergonomic difficulty.
  3. Ornament density — how heavily the opt-in ornament pass decorates the line (combined with the character).

The voice count, meter, and structure come from the form, not from the instrument. Each form has a default instrument, but any instrument may be substituted.

Instrument vs voice

An instrument is the playback sound and range profile. A voice is the musical line being generated. A single instrument, such as organ, can carry several voices.

General MIDI Programs

InstrumentStringGM ProgramSound
Organ"organ"19Church Organ
Harpsichord"harpsichord"6Harpsichord
Piano"piano"0Acoustic Grand Piano
Violin"violin"40Violin
Cello"cello"42Cello
Guitar"guitar"24Acoustic Guitar (Nylon)

An unknown instrument string is rejected (it throws) rather than silently falling back to a default.

Default Instrument per Form

FormDefault Instrument
fugue, prelude_and_fugue, trio_sonata, chorale_prelude, toccata_and_fugue, passacaglia, fantasia_and_fugueOrgan
cello_preludeCello
chaconneViolin
goldberg_variationsHarpsichord

Ornament Density

The deterministic ornament pass adds trills, mordents, and Nachschlag. How densely it decorates depends on both the character and the instrument, and some lines are never ornamented:

Trill, mordent, Nachschlag

These are short Baroque decorative figures around a structural note. They are added after the main composition is validated, so they are tagged as source: "ornament" rather than "material" or "compose".

  • Ground-bass lines (passacaglia, chaconne, Goldberg bass) are never ornamented.
  • Cantus-firmus lines (chorale prelude) are never ornamented.

Notes added here carry the source: "ornament" provenance tag.

Expression Output

Beyond ornaments, the engine writes form-appropriate expression:

  • Organ registration — a CC#7/#11 curve that follows the form's energy arc.
  • Closing ritardando — tempo events that slow the final cadence.
  • Time signature — 3/4 for passacaglia and chaconne, 4/4 otherwise.

TIP

See Voice Architecture for how voices map to instruments and tracks, and the Generation Pipeline for where the ornament and expression passes sit.

Dual-licensed: AGPL-3.0 · commercial licensing available. Generated MIDI is yours to use freely.