npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsynth-sync

v0.15.0

Published

syncopator for audio scripting

Downloads

14

Readme

jsynth-sync

A syncopation module for jsynth, baudio, and webaudio;

how to use it

see also the example

The constructor requires beatsPerMinute and SampleRate values.

var sync = require('jsynth-sync');

var timer = sync(72, 8000) // 72 bpm, samplRate 8000 (8k samples per second)
var t = timer.on(1, function(time, beatCount, clearFN, swingFN){
	// do something every beat
})
var i = timer.on(1/2, function(t, b, clrFN){
	// do something every half beat
})

function synth(t){

	timer.tick.apply(timer, arguments)

};

methods

###sync.on(beatValue, fn)

timer will call fn every beatValue. the return of sync.on() is a function which clears fn from being called any more. Your function will be called with the actual clock time of the call, a count for the beatValue, and a function you can call to clear the current call for good.

var quarter = sync.on(1/4, function(time, beatCount, clear, swing){
	// do something every quarter-beat
	// beatCount is the # of times this beatValue has been called.
	if(beatCount % 4 == 0) // only do something every 4th quarter beat
	if(forSomeReason) clear() // clear the timer 
  //new!
  // the siwng function allows you to have the next beat (or all beats)
  // changed to a new interval
  if(true) swing(interval)
  else if(true) swing(0) // you must set it back manually
}

setTimeout(function(){
	quarter() // clears it
}, 4000)

###timer.tick() Timer tick does not require any arguments, but will pass them on to your function. Simply call it for every sample.

###timer.clearAll() clear all the timered functions