export const VOICE_MATCH_FILE: string; export const VOICE_MATCH_VERSION: 1; export const VOICE_MATCH_MODEL: string; export const SAMPLE_RATE: number; export const PHRASE_PAD_S: number; export const FRAME_S: number; export const GATE_FLOOR_DB: number; export const GATE_REL_DB: number; export const GATE_BRIDGE_S: number; export const GATE_MIN_RUN_S: number; export const MIN_SPEECH_S: number; export const FALLBACK_SPEECH_S: number; export const REFERENCE_MIN_RULINGS: number; export const REFERENCE_VIDEOS: number; export const REFERENCE_SECONDS: number; export const REFERENCE_PIECE_S: number; export const REFERENCE_TRIM: number; export const COHOST_TITLE_RE: RegExp; export type VoiceLabel = "likely" | "unsure" | "unlikely"; export type Thresholds = { likely: number; unlikely: number }; export const DEFAULT_THRESHOLDS: Readonly; export function voiceMatchKey(channel: string, video: string, cutStart: number): string; export function labelFor(score: number | null, t?: Thresholds): VoiceLabel | null; export type GateOpts = { frameS?: number; floorDb?: number; relDb?: number; bridgeS?: number; minRunS?: number }; export function frameLevels(samples: Float32Array, rate?: number, frameS?: number): number[]; export function voicedRuns(samples: Float32Array, rate?: number, opts?: GateOpts): { runs: [number, number][]; threshold: number; frameSamples: number }; export function voicedSamples(samples: Float32Array, rate?: number, opts?: GateOpts): { samples: Float32Array; seconds: number; runs: [number, number][] }; export function decodeSpan(file: string, start: number, dur: number, opts?: { ffmpeg?: string; rate?: number }): Promise; export function clockOffset(file: string, opts?: { ffprobe?: string }): Promise; export function encodeWav16(samples: Float32Array, rate?: number): Buffer; export function decodeWav16(buf: Buffer): { samples: Float32Array; rate: number }; export type Engine = { python: string; script: string; model: string; threads: number }; export function resolveEngine(o: { repoRoot: string; env?: Record; settings?: unknown; python?: string; script?: string; model?: string; threads?: number; }): Engine; export function embedWavs( items: { id: string; wav: string }[], engine: { python: string; script: string; model: string; threads?: number }, scratch: string, ): Promise<{ model: string; version: string | null; dim: number; items: Map }>; export function dot(a: number[], b: number[]): number; export function normalize(v: number[]): number[]; export function cosine(a: number[], b: number[]): number; export function centroid(vectors: number[][]): number[] | null; export function robustCentroid(vectors: number[][], opts?: { trim?: number }): { centroid: number[] | null; kept: number[]; dropped: number[] }; export function scoreAgainst( v: number[], refItems: { key: string; vector: number[] }[], opts?: { selfKey?: string | null }, ): { score: number | null; best: number | null }; export function soloRecordingWhy(doc: unknown): string | null; export function pickReferenceRecordings(candidates: C[], n?: number): C[]; export type SpanItem = { key: string; id?: string; file: string; start: number; dur: number; label?: string; fallback?: { start: number; dur: number } | null; }; export type MissingItem = { key: string; id?: string; file: null; start: number; dur: number; missing: string }; export type ReferenceSpec = | { kind: "rulings"; keys: string[] } | { kind: "recordings"; items: (SpanItem & { slug: string; video: string; date?: string | null; title?: string | null })[] }; /** One clip's row in voice-match.json. */ export type VoiceMatchClip = { score: number | null; label: VoiceLabel | null; speechSeconds: number; best?: number | null; id?: string; why?: string; fallback?: true; inReference?: true; via?: "words" | "cues" | "cut"; from?: "instances"; }; export type VoiceMatchDoc = { version: 1; model: string; engine: { file: string; sherpaOnnx: string | null; dim: number; sampleRate: number }; madeAt: string; thresholds: Thresholds; gate: Record; reference: Record & { kind: "rulings" | "recordings"; kept: number; dropped: string[] }; counts: { clips: number; scored: number; likely: number; unsure: number; unlikely: number }; span?: "phrase" | "cut"; clips: Record; }; export function runVoiceMatch(o: { clips: (SpanItem | MissingItem)[]; reference: ReferenceSpec; engine: { python: string; script: string; model: string; threads?: number }; scratch: string; thresholds?: Thresholds; ffmpeg?: string; pad?: number; onProgress?: (e: Record) => void; now?: () => Date; }): Promise; export function readVoiceMatch(dir: string): Promise; export function writeVoiceMatch(dir: string, doc: VoiceMatchDoc): Promise; export function voiceMatchSummary(doc: VoiceMatchDoc | null): { madeAt: string; counts: VoiceMatchDoc["counts"]; reference: string; } | null;