Newer
Older
remotion_docker_devcontainer / voicevox-remotion-template / src / data / yukkuri-composition / script.ts
import {
  defineVQTimeline,
  say,
  type VQCustomTimelineEvent,
  type VQSpeechEvent,
  type VQTimelineEvent,
  type VQTimelineInputEvent,
} from "../../lib/VQRemotionLib";
import type {CharacterId, VoicevoxVoice} from "./characters";

export {characters, initialVisibleCharacters} from "./characters";
export type {CharacterDefinition, CharacterId, VoicevoxVoice} from "./characters";

export type ShowOptions = Readonly<{
  caption?: string;
  durationSeconds?: number;
}>;

export type SpeechEvent = VQSpeechEvent<CharacterId, VoicevoxVoice>;

export type ShowEvent = VQCustomTimelineEvent<"show", {
  character: CharacterId;
  caption?: string;
  durationSeconds?: number;
}>;

export type TimelineEvent = VQTimelineEvent<
  CharacterId,
  VoicevoxVoice,
  ShowEvent
>;
export type TimelineInputEvent = VQTimelineInputEvent<
  CharacterId,
  VoicevoxVoice,
  ShowEvent
>;

export const show = (
  character: CharacterId,
  options: ShowOptions = {}
): ShowEvent => ({
  type: "show",
  character,
  ...options,
});

export const timeline = defineVQTimeline([
  say("zunda-001", "zundamon", "みなさんこんにちは、ずんだもんなのだ!"),
  say(
    "zunda-002",
    "zundamon",
    "今日のテーマは「ネコミミはなぜかわいいのか?」なのだ。"
  ),
  say(
    "zunda-003",
    "zundamon",
    "まず大きな理由は、丸みのあるシルエットと動きなのだ。"
  ),
  say(
    "zunda-004",
    "zundamon",
    "そして感情が伝わりやすくて、親近感が増すのだ!"
  ),
  show("sayo", {
    caption: "ネコミミ代表として、小夜が登場!",
  }),
  say(
    "sayo-001",
    "sayo",
    "小夜です。ネコミミ代表として、猫耳のかわいさを証明しに来ました。"
  ),
  say("zunda-005", "zundamon", "それじゃあ、また次回なのだ!"),
] satisfies readonly TimelineInputEvent[]);