@libraz/libcantus - v1.1.0
    Preparing search index...

    Function playability

    • Judge whether a passage can be played on an instrument, and how hard it is.

      Inspection is deliberately separate from generation: this answers "can this be played" for a chart handed to a player or a practice tool, and never rewrites or rejects anything. The three layers are reported together but stay distinct — an out-of-range note or an impossible stretch is not the bottom of the difficulty scale but a different axis, since no amount of skill puts a note on an instrument that does not have it. Only the third layer consults bpm, so omitting the tempo reports what the instrument alone decides.

      Parameters

      • notes: readonly NoteEvent[]

        The passage, in any order. Drum hits qualify as note events.

      • profile: InstrumentProfileLike

        The instrument to play it on.

      • Optionalbpm: number

        Tempo in quarter-note beats per minute; enables the third layer.

      Returns PlayabilityReport

      Difficulty, the issues found, and each note's string/fret or limb.

      If the notes are not note events, the tempo is not a finite positive number of beats per minute, or the profile describes no instrument — a neck with no strings or a kit no limb reaches, whatever the passage holds.

      import { BASS_4_STRING, playability } from '@libraz/libcantus';
      const report = playability([{ pitch: 27, startBeat: 0, durationBeat: 1 }], BASS_4_STRING);
      report.issues[0]?.type; // 'noteOutOfRange'