@vapurrmaid/bpm

Lightweight package for working with beats per minute (BPM) calculations.

Usage no npm install needed!

<script type="module">
  import vapurrmaidBpm from 'https://cdn.skypack.dev/@vapurrmaid/bpm';
</script>

README

@vapurrmaid/bpm

A simple zero-dependency package for working with BPM calculations.

BPM class

Constructor

new BPM(bpm);
  • bpm: number - A number greater than 0

Public Properties

  • value: number - Number of beats per minute (BPM)

Public Methods

durationFor

Calculates the duration (in seconds) for a particular note at the BPM.

  durationFor(aNote, beatNote = "quarter"): number
  • aNote: NoteDuration - the note to calculate the duration for
  • beatNote: NoteDuration - the note that's considered 1 beat

numberOfBeatsFor

Calculates the number of beats for the given note duration at this BPM.

numberOfBeatsFor(aNote, beatNote = "quarter"): number
  • aNote: NoteDuration - the note to calculate the duration for
  • beatNote: NoteDuration - the note that's considered 1 beat