audio-correction
v1.0.1
Published
Audio stream correction utilities
Downloads
5
Readme
audio-correction
Audio stream correction utilities.
Installation
Install audio-correction
by running:
$ npm install --save audio-correction
Documentation
Stream audioCorrection.skew(Object options)
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.
options
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)
Tests
Run the test suite by doing:
$ gulp test
TODO
- Improve unit testing in some areas of the code.
Contribute
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
Support
If you're having any problem, please raise an issue on GitHub.
License
The project is licensed under the MIT license.