/** * AudioWorklet integration for pitch detection * Provides low-latency audio processing in a separate thread */ export interface WorkletFrameEvent { type: 'frame'; frame: ArrayBuffer; timestamp: number; } export interface WorkletConfigMessage { type: 'config'; frameSize?: number; hopSize?: number; } /** * Manages AudioWorklet for frame extraction */ export declare class PitchWorklet { private context; private frameSize; private hopSize; private workletNode; private frameCallbacks; constructor(context: AudioContext, frameSize?: number, hopSize?: number); /** * Load and initialize the AudioWorklet */ initialize(workletPath?: string): Promise; /** * Connect an audio source to the worklet */ connect(source: AudioNode): void; /** * Disconnect the worklet */ disconnect(): void; /** * Register a callback for frame events */ onFrame(callback: (frame: Float32Array, timestamp: number) => void): () => void; /** * Update worklet configuration */ updateConfig(frameSize?: number, hopSize?: number): void; /** * Get the worklet node */ getNode(): AudioWorkletNode | null; /** * Check if worklet is initialized */ isInitialized(): boolean; /** * Dispose resources */ dispose(): void; } /** * Helper: Create and initialize a PitchWorklet */ export declare function createPitchWorklet(context: AudioContext, options?: { frameSize?: number; hopSize?: number; workletPath?: string; }): Promise;