wave-visualizer
v1.0.6
Published
Audio visualizer library for javascript
Downloads
751
Maintainers
Readme
Wave.js
Minimal wave visualizer for javascript from wave.js Visual audio from element or micro phone stream
Installation
npm i wave-visualizer
Setup
import Wave from 'wave-visualizer';
var wave = new Wave();
let [wave] = useState(new Wave());
Usage
wave.fromElement('audio_element_id', 'canvas_id');
Documentation
<html>
<head></head>
<body>
<canvas id="output" height="500" width="500"></canvas>
<script src="../dist/bundle.cjs.js"></script>
<script>
let wave = new Wave();
navigator.mediaDevices
.getUserMedia({
audio: true,
})
.then(function (stream) {
wave.fromStream(stream, 'output', {
colors: ['red', 'white', 'blue'],
});
})
.catch(function (err) {
console.log(err.message);
});
</script>
</body>
</html>