Skip to content

[Enhancement] Add local audio level monitoring utility for microphone input visualization #516

Description

@deepgram-robot

Summary

Add a lightweight audio level monitoring utility that wraps the Web Audio API AnalyserNode to provide real-time microphone volume levels, frequency data, and speaking/silent state detection alongside Deepgram streaming transcription.

Problem it solves

Voice agent UIs universally need visual feedback showing microphone activity — animated waveforms, volume meters, and speaking indicators. Currently, developers must implement Web Audio API AnalyserNode setup, volume calculation (RMS), silence threshold detection, and animation frame loops from scratch every time they build a Deepgram-powered voice interface. This is a solved problem that should be a one-line SDK utility.

Proposed API

import { createAudioLevelMonitor } from '@deepgram/sdk/browser';

const monitor = createAudioLevelMonitor(mediaStream, {
  fftSize: 2048,
  silenceThreshold: -50, // dB
  smoothingTimeConstant: 0.8,
});

monitor.on('level', ({ volume, isSpeaking, frequencyData }) => {
  // Update UI — volume is 0-1 normalized, frequencyData is Float32Array
});

monitor.on('silence', ({ duration }) => {
  // User stopped speaking for `duration` ms
});

monitor.on('speech', () => {
  // User started speaking
});

monitor.stop();

Acceptance criteria

  • Provides normalized volume level (0-1) from microphone MediaStream
  • Emits speaking/silence state transitions with configurable threshold
  • Exposes raw frequency data for custom visualizations
  • Works alongside ListenLiveClient without conflicts
  • Zero dependencies beyond Web Audio API
  • Documented with usage example
  • Compatible with existing API

Raised by the DX intelligence system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions