Socket
Socket
Sign inDemoInstall

bpm-tick

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bpm-tick

A metronome for rhythmic callbacks


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
394 kB
Created
Weekly downloads
 

Readme

Source

How to use it

var Tick = requrie("bpm-tick");
var b = new Tick(128);
b.register('beat', function (x) { console.log("bam");   });
b.register('bar' , function (x) { console.log("badam"); });
b.play();

It uses Date so it shouldn't drift (aka. it won't fall out of tempo). It's not guaranteed to be 100% precise on the note though.

Available callbacks

You can register any of these:

Word key    Power key     Number (res. available)

sub         1/64          0
div         1/16          1
beat        1/4           2
bar         1             3
word        4             4
verse       16            5
song        64            6

Registering beat, 1/4, and 2 are exaclty the same thing. Registration overwrites.

Resolution

By default, resolution 2 is used. You can set your own resolution with

var b = beat(128 [, resolution]);

where resolution is an integer from 0 to 6.

At resolution 2, only callbacks for beat (1/4) and longer are called. To get sub (1/64) resolutions to be be called, you have to use resolution 0. (See table above)

Other stuff

b.on is an alias for b.register.

b.devlog = true will log numbers.

Keywords

FAQs

Last updated on 02 Jan 2015

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