Socket
Socket
Sign inDemoInstall

bpm

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bpm

Calculate BPM by tapping


Version published
Weekly downloads
10
increased by11.11%
Maintainers
1
Install size
19.9 kB
Created
Weekly downloads
 

Readme

Source

BPM

Calculate BPM by tapping

Install

Install the command line tool bpm

npm install -g bpm

Install locally to use as a module

npm install bpm

Usage

Command line

bpm

As a module

var BPM = require('bpm');
var b = new BPM();

Example

Command line tool

Run bpm on the command line to tap out the beats, and let it calculate the average BPM

$ bpm
Tap when ready... ctrl-c to break
{ count: 1 }
{ avg: 69.52491309385863, ms: 863, count: 2 }
{ avg: 67.6056338028169, ms: 912, count: 3 }
{ avg: 66.98920729438035, ms: 912, count: 4 }
{ avg: 66.6851903306474, ms: 912, count: 5 }
{ avg: 66.386368665634, ms: 920, count: 6 }
{ avg: 66.4819944598338, ms: 896, count: 7 }

In the output above you can see that it sits there waiting for you to tap. When you start tapping, it starts calculating the average BPM, and every tap it prints 3 fields.

  • avg - The average BPM
  • ms - The time in milliseconds from the previous to the current tap
  • count - How many times you have tapped

It's also possible for bpm to read a stream on stdin. The following is possible, but not recommended

$ yes | bpm

Node Module

var BPM = require('bpm'),
    b = new BPM();

b.tap();
setTimeout(function() {
  console.log(b.tap());
}, 1000);

yields

{
  "avg": 59.46481665014866,
  "ms": 1009,
  "count": 2
}

Functions

var b = new BPM()

Create a new BPM object

b.tap()

Trigger the tap event, it returns an object showing the current BPM statistics

b.reset()

Reset the obj

Test

npm test

License

MIT Licensed

Keywords

FAQs

Last updated on 10 Jan 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc