0.1.4 • Published 2 years ago
zyklus v0.1.4
Zyklus
Zyklus a small (380 Byte) library to get an accurate Web Audio Clock without hassle.
Installation
npm i zyklus --saveUsage
import 'zyklus';
const clock = ctx
.createClock((time, duration, tick) => {
console.log(time, duration, tick);
}, 0.2)
.start();API
createClock(callback, duration, interval?, overlap?) -> Clock
callback((time, duration, tick) => void): called for each tick withtimeprecise AudioContext time when the tick should happendurationseconds between each ticktickcount of the current tick
durationseconds between each tickinterval(optional) seconds used for the interval. Change this to tune the latencyoverlap(optional) seconds of overlap between intervals. Change this to tune the latency and resilience
Clock.start()
Start the clock.
Clock.stop()
Stop the clock.
Clock.pause()
Stop the clock without resetting the tick.