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

    Function secondsToBeats

    • The beat reached after a number of seconds — the inverse of beatsToSeconds.

      Parameters

      • seconds: number

        Elapsed seconds from the map's first event; negative for a position before it, such as a pickup.

      • map: TempoMap

        The tempo map.

      Returns number

      The position in quarter-note beats.

      If the map is malformed or seconds is not finite.

      import { secondsToBeats } from '@libraz/libcantus';
      const map = [{ startBeat: 0, bpm: 120 }, { startBeat: 4, bpm: 60 }];
      secondsToBeats(6, map); // 8