import generatedManifest from "../generated/lipsync/manifest.json";
import {getMouthAtTime} from "./getMouthAtTime";
import type {
JapaneseMouthShape,
MouthTimeline,
MouthTimelineManifest,
} from "./types";
const lipsyncManifest = generatedManifest as MouthTimelineManifest;
export const mouthTimelineForSpeech = (
speechId: string | undefined
): MouthTimeline | undefined =>
speechId ? lipsyncManifest.timelines[speechId] : undefined;
export const getMouthForSpeechFrame = (
speechId: string | undefined,
frame: number,
fps: number
): JapaneseMouthShape =>
getMouthAtTime(mouthTimelineForSpeech(speechId), frame / fps);