/** * Narration with Kokoro-82M (kokoro-js, ONNX on the CPU) saved as OGG Vorbis, the format * Valkyrie's editor lists for event audio. kokoro-js brings onnxruntime (~400 MB), so it is * not a dependency of this package: installNarrationEngine() puts it in its own folder, and * the model (~330 MB fp32) is downloaded there on first use. */ export declare const KOKORO_MODEL_ID = "onnx-community/Kokoro-82M-v1.0-ONNX"; /** Pinned so every install behaves the same; wasm-media-encoders encodes OGG Vorbis without ffmpeg */ export declare const ENGINE_PACKAGES: { readonly 'kokoro-js': "1.2.1"; readonly 'wasm-media-encoders': "0.7.0"; }; /** fp32 is both faster on the CPU (about 2 s per sentence on an M1 Pro) and cleaner than q8 */ export type KokoroDtype = 'fp32' | 'fp16' | 'q8' | 'q4' | 'q4f16'; export declare const DEFAULT_DTYPE: KokoroDtype; export declare const SAMPLE_RATE = 24000; /** * Voices picked by ear for horror narration. 15 voices read the same passage at speed 0.9 * ("The lamp gutters and goes out. / Somewhere beneath the floorboards of the Blackwood * house, something has begun to sing. / It knows your name.") on 2026-10-04. The quality * grades did not predict the fit: the A and A- voices (af_heart, af_bella) were not picked, * and two D voices were. Best first. */ export declare const HORROR_PICKS: ReadonlyArray<{ voice: string; verdict: string; }>; /** Also in that trial, not picked */ export declare const HORROR_TRIAL_OTHERS: readonly ["am_fenrir", "am_michael", "am_onyx", "am_puck", "am_echo", "af_heart", "af_bella", "af_kore", "bm_george", "bm_fable", "bf_emma"]; /** The trial's winner, at the speed it was judged at */ export declare const DEFAULT_VOICE: string; export declare const DEFAULT_SPEED = 0.9; /** kokoro-js speaks English only: a = American, b = British. Grades are hexgrad's quality ratings */ export declare const VOICES: Record; /** Where the engine lives: VALKYRIE_TTS_DIR, or a per-user cache folder */ export declare function defaultEngineDir(): string; export interface NarrationStatus { engineDir: string; /** Installed package versions; missing packages are absent */ packages: Partial>; installed: boolean; dtype: KokoroDtype; /** The model for dtype is in the engine's cache; otherwise the first narration downloads it */ modelDownloaded: boolean; } export declare function getNarrationStatus(engineDir?: string, dtype?: KokoroDtype): NarrationStatus; export declare function narrationSetupInstructions(status: NarrationStatus): string; export type RunCommand = (cmd: string, args: string[], cwd: string) => Promise<{ code: number; output: string; }>; /** Installs kokoro-js and the OGG encoder into the engine folder with npm */ export declare function installNarrationEngine(engineDir?: string, run?: RunCommand): Promise; /** Text to samples and samples to OGG; an interface so tests can stand in for the model */ export interface SpeechEngine { /** Mono float samples at SAMPLE_RATE, one entry per sentence */ synthesize(text: string, voice: string, speed: number): Promise; encodeOgg(samples: Float32Array, sampleRate: number): Promise; } /** Loads kokoro-js from the engine folder once per process (the first load may download the model) */ export declare function loadKokoroEngine(engineDir?: string, dtype?: KokoroDtype): Promise; export interface NarrateOptions { /** Spoken in order with a pause between them */ paragraphs: string[]; outputFile: string; voice?: string; speed?: number; engine: SpeechEngine; } export interface NarrateResult { file: string; /** Length of the clip */ duration: number; bytes: number; /** Time taken to synthesize and encode */ seconds: number; } export declare function assertVoice(voice: string): void; /** Speaks the paragraphs and writes one OGG Vorbis clip */ export declare function narrate(opts: NarrateOptions): Promise; //# sourceMappingURL=kokoro.d.ts.map