0.0.6 • Published 8 years ago

webtimer v0.0.6

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

webtimer

Minimal framework to create client-side timers with audio alarms

Create alarms that use the web audio API and set timers in the browser.

The alarm consists of an oscillator, a LFO, lowpass filter, and utility methods.

Install

With yarn:

$ yarn add webtimer

With npm:

$ npm install --save webtimer

Usage

const webtimer = require('webtimer');

// Create a basic timer with defaults
const alarm = webtimer();

// You can also pass in initial custom settings
const customAlarm = webtimer(500, 2000, 5);
// In the above example, the first argument sets the oscillator
// frequency to 500; the second argument sets the filter frequency
// to 2000, and the third parameter sets the LFO rate to 5.

// There are several getter/setter methods baked in
alarm.rate();         // Returns the current LFO freq, default is 1.5
alarm.rate(10);       // Sets the LFO freq to 10
alarm.freqency();     // Returns the current oscillator freq, default is 1500
alarm.frequency(500); // Sets the oscillator freq to 500
alarm.lowpass();      // Returns the current filter freq, default is 1000
alarm.lowpass(1500);  // Sets the lowpass filter freq to 1500

// Methods are provided to start and stop the alarm
alarm.start();
alarm.stop();

// Set a timer to sound the alarm in 2 minutes
alarm.set(2); // "Timer set for 2 minute(s)."
0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago