diff --git a/voicevox-remotion-template/scripts/voicevox-generate.js b/voicevox-remotion-template/scripts/voicevox-generate.js index 6d1a0fb..8f0e8b7 100644 --- a/voicevox-remotion-template/scripts/voicevox-generate.js +++ b/voicevox-remotion-template/scripts/voicevox-generate.js @@ -381,8 +381,9 @@ const voice = resolveVoice(characters, speech); const speakerId = resolveSpeakerId(speakers, voice, speech.id); + const textForVoice = speech.readAs ?? speech.text; const queryResponse = await fetch( - `${VOICEVOX_URL}/audio_query?text=${encodeURIComponent(speech.text)}&speaker=${speakerId}`, + `${VOICEVOX_URL}/audio_query?text=${encodeURIComponent(textForVoice)}&speaker=${speakerId}`, {method: "POST"} ); if (!queryResponse.ok) { diff --git a/voicevox-remotion-template/src/data/pizza-kiln/script.ts b/voicevox-remotion-template/src/data/pizza-kiln/script.ts index d594512..dbd90e6 100644 --- a/voicevox-remotion-template/src/data/pizza-kiln/script.ts +++ b/voicevox-remotion-template/src/data/pizza-kiln/script.ts @@ -6,7 +6,7 @@ type VQTimelineEvent, type VQTimelineInputEvent, type VQVideoEvent, -} from "../../lib/VQRemotionLib"; +} from "../../lib/VQRemotionLib/timeline"; import type {CharacterId, VoicevoxVoice} from "./characters"; export {characters} from "./characters"; diff --git a/voicevox-remotion-template/src/data/pizza-kiln/timing.ts b/voicevox-remotion-template/src/data/pizza-kiln/timing.ts index d798033..b833636 100644 --- a/voicevox-remotion-template/src/data/pizza-kiln/timing.ts +++ b/voicevox-remotion-template/src/data/pizza-kiln/timing.ts @@ -43,7 +43,8 @@ return Math.max(1, Math.ceil(entry.durationSeconds * fps)); } - const estimatedSeconds = Math.max(1.2, speech.text.length * 0.11); + const textForEstimate = speech.readAs ?? speech.text; + const estimatedSeconds = Math.max(1.2, textForEstimate.length * 0.11); return Math.ceil(estimatedSeconds * fps); }; diff --git a/voicevox-remotion-template/src/data/pizza-oven-project-01/script.ts b/voicevox-remotion-template/src/data/pizza-oven-project-01/script.ts index 501a9f2..0702536 100644 --- a/voicevox-remotion-template/src/data/pizza-oven-project-01/script.ts +++ b/voicevox-remotion-template/src/data/pizza-oven-project-01/script.ts @@ -6,7 +6,7 @@ type VQSpeechEvent, type VQTimelineEvent, type VQTimelineInputEvent, -} from "../../lib/VQRemotionLib"; +} from "../../lib/VQRemotionLib/timeline"; import type {CharacterId, VoicevoxVoice} from "./characters"; export {characters} from "./characters"; @@ -31,7 +31,9 @@ fit: "cover", } ), - say("pizza-oven-project-01-sayo-004", "sayo", "ピザ窯を。"), + say("pizza-oven-project-01-sayo-004", "sayo", "ピザ窯を。", { + readAs: "ぴざがまを。", + }), wait(1), say("pizza-oven-project-01-sayo-005", "sayo", "まずはblender上で、耐熱レンガの寸法を元に積み方を設計することにしました。"), ] satisfies readonly TimelineInputEvent[]); diff --git a/voicevox-remotion-template/src/data/pizza-oven-project-01/timing.ts b/voicevox-remotion-template/src/data/pizza-oven-project-01/timing.ts index 910e675..a9ce930 100644 --- a/voicevox-remotion-template/src/data/pizza-oven-project-01/timing.ts +++ b/voicevox-remotion-template/src/data/pizza-oven-project-01/timing.ts @@ -45,7 +45,8 @@ return Math.max(1, Math.ceil(speech.durationSeconds * fps)); } - const estimatedSeconds = Math.max(1.2, speech.text.length * 0.11); + const textForEstimate = speech.readAs ?? speech.text; + const estimatedSeconds = Math.max(1.2, textForEstimate.length * 0.11); return Math.ceil(estimatedSeconds * fps); }; diff --git a/voicevox-remotion-template/src/data/pizza-oven-project-01/voicevox-manifest.json b/voicevox-remotion-template/src/data/pizza-oven-project-01/voicevox-manifest.json index 42182ce..f1c08c3 100644 --- a/voicevox-remotion-template/src/data/pizza-oven-project-01/voicevox-manifest.json +++ b/voicevox-remotion-template/src/data/pizza-oven-project-01/voicevox-manifest.json @@ -33,7 +33,7 @@ "styleName": "ノーマル", "speakerId": 46, "file": "audio/pizza-oven-project-01/lines/pizza-oven-project-01-sayo-004.wav", - "durationSeconds": 1.0133333333333334 + "durationSeconds": 0.992 }, { "id": "pizza-oven-project-01-sayo-005", diff --git a/voicevox-remotion-template/src/data/yukkuri-composition/script.ts b/voicevox-remotion-template/src/data/yukkuri-composition/script.ts index 96c372e..1432d42 100644 --- a/voicevox-remotion-template/src/data/yukkuri-composition/script.ts +++ b/voicevox-remotion-template/src/data/yukkuri-composition/script.ts @@ -5,7 +5,7 @@ type VQSpeechEvent, type VQTimelineEvent, type VQTimelineInputEvent, -} from "../../lib/VQRemotionLib"; +} from "../../lib/VQRemotionLib/timeline"; import type {CharacterId, VoicevoxVoice} from "./characters"; export {characters, initialVisibleCharacters} from "./characters"; diff --git a/voicevox-remotion-template/src/data/yukkuri-composition/timing.ts b/voicevox-remotion-template/src/data/yukkuri-composition/timing.ts index d7daf29..7b98e97 100644 --- a/voicevox-remotion-template/src/data/yukkuri-composition/timing.ts +++ b/voicevox-remotion-template/src/data/yukkuri-composition/timing.ts @@ -33,7 +33,8 @@ return Math.max(1, Math.ceil(entry.durationSeconds * fps)); } - const estimatedSeconds = Math.max(1.2, speech.text.length * 0.11); + const textForEstimate = speech.readAs ?? speech.text; + const estimatedSeconds = Math.max(1.2, textForEstimate.length * 0.11); return Math.ceil(estimatedSeconds * fps); }; diff --git a/voicevox-remotion-template/src/lib/VQRemotionLib/timeline.ts b/voicevox-remotion-template/src/lib/VQRemotionLib/timeline.ts index 678d979..45d6083 100644 --- a/voicevox-remotion-template/src/lib/VQRemotionLib/timeline.ts +++ b/voicevox-remotion-template/src/lib/VQRemotionLib/timeline.ts @@ -1,5 +1,6 @@ export type VQSpeechOptions = Readonly<{ subtitle?: string; + readAs?: string; voicevox?: Partial; durationSeconds?: number; }>; @@ -13,6 +14,7 @@ character: CharacterId; text: string; subtitle?: string; + readAs?: string; voicevox?: Partial; durationSeconds?: number; }>; @@ -117,7 +119,7 @@ // 用途: VOICEVOX発話をタイムラインイベントとして定義する。 // 使用方法: script.ts の timeline 内で say("id", "character", "text", options) として呼び出す。 -// オプションや引数詳細: options には字幕・VOICEVOX上書き・音声未生成時の秒数を指定できる。 +// オプションや引数詳細: options には字幕・読み上げ用テキスト・VOICEVOX上書き・音声未生成時の秒数を指定できる。 export const say = ( id: string, character: CharacterId, diff --git a/voicevox-remotion-template/src/lib/VQRemotionLib/types.ts b/voicevox-remotion-template/src/lib/VQRemotionLib/types.ts index 11dcaa0..eb1e455 100644 --- a/voicevox-remotion-template/src/lib/VQRemotionLib/types.ts +++ b/voicevox-remotion-template/src/lib/VQRemotionLib/types.ts @@ -53,6 +53,7 @@ export type VQSpeechEventLike = Readonly<{ text: string; subtitle?: string; + readAs?: string; }>; export type VQMouthResolverContext =