normalizer for time values, given a start time and duration
This is a normalizer for time-based stuff. The module is a function that takes 4 arguments: *start time *duration *min *max
min and max are optional, and wil default to 0 and 1 respectively.
It returns a function that takes a single param, time
npm install normalize-time
var tnorm = require'normalize-time';var time = getTime;var duration = 3000;var normalize = tnormtime durationforvar t = time; t < time + durationconsole.lognormalizet;t = getTime;
What we have done here is created a function that will normalize 3 seconds of time to values between zero and one. We could have passed min and max values to normalize between any two values.
You may find this useful with such modules as [jsynth](https://npmjs.org/package/jsynth]
wow johnny wrote a test. to run the tests:
npm install tapenode test.js