import { computeAudioLevel } from '@nonstrict/recordkit';
const streamCallback = (audioBuffer) => {
const { peakDb } = computeAudioLevel(audioBuffer);
meterElement.style.height = `${Math.max(0, 100 + peakDb)}%`; // -100 dB..0 dB -> 0%..100%
};
Generated using TypeDoc
Computes RMS and peak audio levels from an AudioStreamBuffer, for rendering a microphone (or system-audio) level meter.
Electron has no dedicated microphone-preview component; the supported way to render a live level meter is to use a microphone/system-audio
streamoutput and call this helper in yourstreamCallback.