import { TTSResult } from '../types/types'; export type KokoroDtype = "fp32" | "fp16" | "q8" | "q4" | "q4f16"; export type KokoroDevice = "wasm" | "webgpu" | "cpu"; export interface KokoroNodeOptions { /** Voice id, e.g. `af_heart`. Default `af_heart`. */ voice?: string; /** Speaking rate; 1 is the model's natural pace. Default 1. */ speed?: number; /** Hugging Face model id. Default `onnx-community/Kokoro-82M-v1.0-ONNX`. */ model?: string; /** Weight quantization. `q8` (default) is the best size/quality trade on CPU. */ dtype?: KokoroDtype; /** Execution device. Default `cpu`. */ device?: KokoroDevice; /** * Target chunk size in characters. Kokoro's context is limited, so long text * is split before synthesis; 400 leaves headroom for phoneme expansion. */ maxChunkLength?: number; /** Silence inserted between chunks, in milliseconds. Default 120. */ gapMs?: number; /** Model download/loading progress, forwarded from transformers.js. */ onModelProgress?: (progress: unknown) => void; /** Called before each chunk is synthesized, for CLI progress output. */ onChunk?: (info: { index: number; total: number; text: string; }) => void; } export interface KokoroAudio { samples: Float32Array; sampleRate: number; } /** * Loads (and caches) a `kokoro-js` instance. * * `kokoro-js` is an optional dependency: a browser-only consumer should not have * to download onnxruntime-node, so a missing install is reported as an * actionable error rather than a module-resolution stack trace. */ export declare function loadKokoroTTS(options?: KokoroNodeOptions): Promise; /** Drops cached model instances. Mainly useful in tests and long-lived workers. */ export declare function resetKokoroCache(): void; /** * Synthesizes `text` to raw samples, chunking anything longer than the model's * comfortable context. */ export declare function synthesizeSamples(text: string, options?: KokoroNodeOptions): Promise; /** Synthesizes `text` and encodes it as a 16-bit PCM WAV file. */ export declare function synthesizeWav(text: string, options?: KokoroNodeOptions): Promise;