Audio stream correction utilities.
Install audio-correction
by running:
$ npm install --save audio-correction
Audio skew correction based on an specific date. It'll make sure an audio stream keeps playing on time.
Useful to keep multiple audio players in sync.
start
is a date representing the intended audio start time.format
is a PCM format object.maximumSkew
is a number (in milliseconds) representing the maximum skew allowed.onSkew(skew, maximumSkew)
is a function called when a skew occurs.
Example:
Speaker = require('speaker')
Lame = require('lame')
audioCorrection = require('audio-correction')
decoder = new Lame.Decoder()
# stream is an audio stream from somewhere
stream.pipe(decoder)
decoder.on 'format', (format) ->
speaker = new Speaker(format)
decoder
.pipe audioCorrection.skew
start: new Date()
format: format
maximumSkew: 300
onSkew: (skew, maximumSkew) =>
console.warn("Error: Exceeds maximum skew of #{skew} (#{maximumSkew}ms.)")
.pipe(speaker)
Run the test suite by doing:
$ gulp test
- Improve unit testing in some areas of the code.
We're looking forward to support more operating systems. Please raise an issue or even better, send a PR to increase support!
- Issue Tracker: github.com/resin-io/audio-correction/issues
- Source Code: github.com/resin-io/audio-correction
Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:
$ gulp lint
If you're having any problem, please raise an issue on GitHub.
The project is licensed under the MIT license.