Sound Meter
Read volume input level from a media stream.
import { SoundMeter } from 'eyeson';
const soundMeter = new SoundMeter();
soundMeter
.connectToSource(stream) // bind stream, listen for audio
.onUpdate(event => { // listen on updates
if (event.error) {
// an error occurred, default: null
return;
}
console.log(event.value); // audio level between 0 and 100
};
soundMeter.stop(); // stop checking the stream for audio