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

    Function beatsToTicks

    • Convert quarter-note beats to MIDI ticks.

      Ticks are whole units of a sequencer's grid, so the result is rounded to the nearest tick; a beat that is not on the grid is not representable and comes back quantized.

      A position before the first downbeat is a negative tick count, which is how a pickup crosses the MIDI boundary and comes back. A position that rounds to the downbeat from below comes back as positive zero: -0 and 0 are the same tick, and only one of them keys as it under Object.is.

      Parameters

      • beat: number

        Position or length in quarter-note beats.

      • ppq: number

        Pulses (ticks) per quarter note, e.g. 96, 480, or 960.

      Returns number

      The whole tick count.

      If beat is not finite or ppq is not a positive integer.

      import { beatsToTicks } from '@libraz/libcantus';
      beatsToTicks(1.5, 480); // 720