/**
 * SoX/rec audio capture shim — intercepts `rec` and `sox -d` commands
 * and uses browser getUserMedia + Web Audio API to capture mic audio,
 * streaming raw PCM to the child process's stdout.
 */
export interface SoxConfig {
    sampleRate: number;
    bitDepth: number;
    channels: number;
    encoding: 'signed' | 'unsigned' | 'float';
    format: string;
    silence: SilenceConfig | null;
    quiet: boolean;
}
export interface SilenceConfig {
    /** Number of silence periods before stopping (typically 1) */
    abovePeriods: number;
    /** Duration of silence to trigger stop (seconds) */
    duration: number;
    /** Threshold as percentage or dB (e.g. '0.1%', '-50d') */
    threshold: number;
    /** Optional leading silence skip */
    belowPeriods: number;
    belowDuration: number;
    belowThreshold: number;
}
export interface AudioCaptureHandle {
    cleanup: () => void;
}
/**
 * Parse SoX CLI arguments into a typed config.
 * Handles both `rec` and `sox -d` invocations.
 *
 * Example: rec -q -r 16000 -e signed -b 16 -c 1 -t raw - silence 1 0.1 0.1% 1 1.0 0.1%
 */
export declare function parseSoxArgs(command: string, args: string[]): SoxConfig;
/** Convert float32 samples [-1, 1] to little-endian signed int16 PCM bytes */
export declare function float32ToInt16PCM(samples: Float32Array): Uint8Array;
/** Downsample via linear interpolation */
export declare function downsample(samples: Float32Array, fromRate: number, toRate: number): Float32Array;
export interface SilenceDetector {
    /** Process samples, returns the samples that should be emitted (may be empty) */
    process(samples: Float32Array, sampleRate: number): Float32Array | null;
    /** Whether trailing silence has been detected and recording should stop */
    shouldStop(): boolean;
}
/**
 * Two-phase silence detector matching SoX semantics:
 * Phase 1 (below): skip leading silence until sound is detected
 * Phase 2 (above): stop when trailing silence duration exceeds threshold
 */
export declare function createSilenceDetector(config: SilenceConfig): SilenceDetector;
/** Check if a command is a rec or sox audio capture command */
export declare function isAudioCaptureCommand(command: string, args: string[]): boolean;
/**
 * Start audio capture using browser APIs.
 * Streams raw PCM data via onData callback.
 */
export declare function startAudioCapture(config: SoxConfig, onData: (pcmBytes: Uint8Array) => void, onEnd: () => void, onError: (error: Error) => void): Promise<AudioCaptureHandle>;
//# sourceMappingURL=sox-audio-capture.d.ts.map