audio-oscilloscope
Waveform audio visualizer using html5 canvas.
Require the module with browserify, or simply include oscilloscope.min.js
Methods
- addSignal(source:AudioNode, color)
- start()
- stop()
Example
oscilloscope = require('..')
var context = new window.AudioContext()
var canvas = document.querySelector('.visualizer')
canvas.width = window.innerWidth
canvas.height = window.innerHeight
var options = {
stroke: 3,
glow: 0.1,
buffer: 1024
}
var scope = new Oscilloscope(canvas, options)
var constraints = { video: false, audio: true };
navigator.getUserMedia(constraints, function(stream) {
var source = context.createMediaStreamSource(stream)
scope.addSignal(source, '#00ffff')
}, function (error) {
console.error("getUserMedia error:", error);
});