/** * Configuration options for the audio signal analyzer */ export interface AudioSignalAnalyzerConfig { /** Threshold for detecting audio signal (0-255) */ detectionThreshold?: number; /** Minimum consecutive frames with signal to trigger detection */ minConsecutiveDetections?: number; /** Threshold for detecting silence (0-255) */ silenceThreshold?: number; /** Duration of silence in ms before triggering silence detection */ silenceDurationMs?: number; /** FFT size for frequency analysis (smaller = less CPU, less precision) */ fftSize?: 256 | 512 | 1024 | 2048 | 4096 | 8192 | 16384 | 32768; /** Analysis interval in ms (higher = less CPU usage) */ analysisIntervalMs?: number; /** Whether to optimize for speech frequencies */ optimizeForSpeech?: boolean; /** Whether to skip processing silent frames entirely */ skipSilentFrameProcessing?: boolean; } /** * Analyzes audio signals for detection and silence monitoring * Optimized for speech processing and low CPU usage */ export declare class AudioSignalAnalyzer { private audioContext; private analyser; private source; private bandpassFilter; private isAnalyzing; private detectionThreshold; private minConsecutiveDetections; private consecutiveDetections; private analysisIntervalId; private analysisIntervalMs; private fftSize; private skipSilentFrameProcessing; private optimizeForSpeech; private silenceThreshold; private silenceDurationMs; private silenceStartTime; private hasDetectedAudioSignal; private isPaused; private dataArray; /** * Creates a new audio signal analyzer * @param config Configuration options */ constructor(config?: AudioSignalAnalyzerConfig); /** * Initializes the audio analyzer with a media stream * @param stream The media stream to analyze * @returns Promise that resolves when initialization is complete */ initializeAnalyzer(stream: MediaStream): Promise; /** * Starts analyzing the audio stream for signal detection * @param onAudioDetected Callback when audio is detected * @param onSilenceDetected Optional callback when silence is detected * @param onAudioResumed Optional callback when audio resumes after silence */ startAnalyzing(onAudioDetected: () => void, onSilenceDetected?: () => void, onAudioResumed?: () => void): void; /** * Stops analyzing the audio stream */ stopAnalyzing(): void; /** * Cleans up all resources used by the analyzer */ cleanup(): void; /** * Updates the analyzer configuration * @param config New configuration options */ updateConfig(config: Partial): void; }