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

    Function extractGrooveTemplate

    • Extract a groove template from a set of note events: for each grid slot, the average timing deviation from the quantized grid and the average velocity of events landing on it. Slots with no velocity-carrying event record velocity: null (the "unrecorded" sentinel); empty slots default to { timingOffset: 0, velocity: null }. The time signature is stored on the template so applyGrooveTemplate can verify the meter matches.

      Parameters

      • events: readonly NoteEvent[]

        The (typically "groovy", human-played) events to analyze.

      • ts: MeterLike

        The time signature, used to compute the bar length.

      • subdivision: number = DEFAULT_GROOVE_SUBDIVISION

        Grid resolution: equal grid steps per quarter-note beat. Defaults to a sixteenth-note grid, which is where the timing deviations a template records — swing, push, drag — are audible.

      Returns GrooveTemplate

      The extracted groove template.