Newer
Older
remotion_docker_devcontainer / voicevox-remotion-template / scripts / templates / dialogue-standee / data / script.ts.template
import {
  defineVQTimeline,
  say,
  standeeFacingDirection,
  standeeVerticalOffset,
  type VQCustomTimelineEvent,
  type VQStandeeFacingDirectionEvent,
  type VQStandeeVerticalOffsetEvent,
  type VQSpeechEvent,
  type VQTimelineEvent,
  type VQTimelineInputEvent,
} from "../../lib/VQRemotionLib/timeline";
import type {CharacterId, VoicevoxVoice} from "./characters";

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

export const compositionTitle = "__TITLE__";

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
  | VQStandeeFacingDirectionEvent<CharacterId>
  | VQStandeeVerticalOffsetEvent<CharacterId>
>;
export type TimelineInputEvent = VQTimelineInputEvent<
  CharacterId,
  VoicevoxVoice,
  | ShowEvent
  | VQStandeeFacingDirectionEvent<CharacterId>
  | VQStandeeVerticalOffsetEvent<CharacterId>
>;

// 用途: キャラクターを画面に登場させ、任意の説明字幕を表示する。
// 使用方法: timeline 内で show("sayo", {caption: "小夜が登場!"}) のように呼び出す。
// オプションや引数詳細: durationSeconds を省略すると timing.ts の既定秒数で表示する。
export const show = (
  character: CharacterId,
  options: ShowOptions = {}
): ShowEvent => ({
  type: "show",
  character,
  ...options,
});

export const timeline = defineVQTimeline([
  say("__SLUG__-zunda-001", "zundamon", "みなさんこんにちは、ずんだもんなのだ!"),
  say("__SLUG__-zunda-002", "zundamon", "今日は新しい動画の下書きを作っていくのだ。"),
  standeeVerticalOffset("__SLUG__-zunda-y-001", "zundamon", -120),
  show("sayo", {
    caption: "小夜が登場!",
  }),
  say("__SLUG__-sayo-001", "sayo", "小夜です。ここから脚本を書き換えて、動画を育てていきましょう。"),
  standeeFacingDirection("__SLUG__-zunda-facing-001", "zundamon", "right"),
  say("__SLUG__-zunda-003", "zundamon", "音声を作ったら、口パクも忘れずに生成するのだ。"),
] satisfies readonly TimelineInputEvent[]);