talking-pixel / src /lib /protocol.ts
cfahlgren1's picture
cfahlgren1 HF Staff
convert talking pixel to a sveltekit app that runs pivo-1.4m tts in the browser
3ec6b9e
Raw History Blame Contribute Delete
1.07 kB
// Messages between the page and the synthesis worker.
import type { Voice } from './frontend.ts';
import type { WordTiming } from './engine.ts';
export type WorkerRequest =
| { type: 'init'; baseUrl: string }
| { type: 'cancel'; id: number }
| { type: 'speak'; id: number; text: string; voice: Voice };
export type WorkerMessage =
| { type: 'progress'; loaded: number; total: number }
| { type: 'ready'; backend: string; fromCache: boolean; networkBytes: number; totalBytes: number; loadMs: number; initMs: number; words: number }
| { type: 'fatal'; message: string }
| {
type: 'plan'; id: number; frames: number; normalized: string; words: WordTiming[]; symbols: string[];
tokenStart: Int32Array; durations: Int32Array; unknown: string[]; sampleRate: number; hop: number;
}
| { type: 'audio'; id: number; pcm: Float32Array; firstFrame: number }
| { type: 'done'; id: number; seconds: number; computeMs: number; firstChunkMs: number | null }
| { type: 'error'; id: number; message: string; user: boolean; characters?: string[] };