export type ListenResult = {
    blob: Blob;
    url: string;
    durationMs: number;
};
export type ListenOptions = {
    silenceMs?: number;
    vadThreshold?: number;
    minSpeechMs?: number;
    maxRecordMs?: number;
    desiredSampleRate?: number;
    continuous?: boolean;
    mime?: boolean;
};
export type ListenEvent = {
    type: "level";
    rms: number;
    speaking: boolean;
    elapsedMs: number;
} | {
    type: "speech-start";
    atMs: number;
} | {
    type: "speech-end";
    atMs: number;
    silenceMs: number;
} | {
    type: "stopped";
} | {
    type: "final";
    result: ListenResult;
} | {
    type: "error";
    error: unknown;
};
type Listener = (e: ListenEvent) => void;
export declare class MicManager {
    private listeners;
    private emit;
    stream: MediaStream | null;
    private ctx;
    private source;
    private analyser;
    private proc;
    private recorded;
    private totalSamples;
    private startedAt;
    private speechSince;
    private lastNonSilent;
    private speaking;
    private stopped;
    private opts;
    subscribe(fn: Listener): () => void;
    get isRecording(): boolean;
    stop(): Promise<void>;
    /**
     * Start recording.
     * - continuous: true  -> returns Promise<void>, emits many {final} events until stop()
     * - continuous: false -> returns Promise<ListenResult> for a single utterance, then stops
     */
    start(opts?: ListenOptions): Promise<void | ListenResult>;
    private onAudioProcess;
    private resetUtteranceState;
    /** Encode current utterance to WAV and emit final. Optionally tear down audio graph (single-shot). */
    private finishUtterance;
    private mergeFloat32;
    private resampleToPCM16;
    private floatTo16;
    private pcm16ToWav;
    private putStr;
}
export {};
//# sourceMappingURL=MicManager.d.ts.map