/** The sample rate expected by the local Whisper runtime. */ export declare const WHISPER_SAMPLE_RATE = 16000; /** * A channel-oriented Float32 PCM source. The channel arrays are borrowed and * are never modified by this module. */ export interface Float32PcmAudio { readonly sampleRate: number; readonly channelData: readonly Float32Array[]; } /** * The small structural part of AudioBuffer used by this module. Keeping this * structural type local means the conversion logic is also usable in Node and * tests without depending on the DOM runtime. */ export interface AudioBufferLike { readonly sampleRate: number; readonly length: number; readonly numberOfChannels: number; getChannelData(channel: number): Float32Array; } export type PcmAudioInput = Float32PcmAudio | AudioBufferLike; /** * Downmixes and linearly resamples an audio source to mono 16 kHz Float32 * PCM. The source channel arrays are borrowed; only the returned output is * allocated. */ export declare function normalizeToWhisperPcm(input: PcmAudioInput): Float32Array; /** * Encodes mono Float32 PCM as a little-endian PCM16 WAV. The samples are * clipped and non-finite values are encoded as silence. This function does * not resample; use {@link audioToPcm16Wav} for arbitrary input audio. */ export declare function encodePcm16Wav(samples: Float32Array, sampleRate?: number): Uint8Array; /** * Converts an AudioBuffer-like object or channel-oriented Float32 PCM source * directly to a mono 16 kHz PCM16 WAV. The returned WAV is the only * full-audio-sized allocation made by this function. */ export declare function audioToPcm16Wav(input: PcmAudioInput): Uint8Array; /** Convenience wrapper for a mono Float32 PCM stream. */ export declare function float32PcmToPcm16Wav(samples: Float32Array, sampleRate: number): Uint8Array;