Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ the client sends plain text and steers delivery with `instructions`.
"textJa": "次は、オオサキです",
"textEn": "The next station is Osaki, J-Y 24.",
"model": "gpt-4o-mini-tts",
"jaVoiceName": "nova",
"enVoiceName": "nova",
"jaVoiceName": "shimmer",
"enVoiceName": "coral",
"instructionsJa": "…",
"instructionsEn": "…"
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface Env {
AI_TRIAGE_MODEL: string;
/** 合成に使う OpenAI TTS モデル(例: gpt-4o-mini-tts) */
TTS_MODEL: string;
/** OpenAI TTS のボイス名(例: nova)。ボイスは多言語対応のため日英で同じ名前を使える */
/** OpenAI TTS のボイス名(例: shimmer)。ボイスは多言語対応だが日英で別のボイスを指定できる */
TTS_JA_VOICE_NAME: string;
TTS_EN_VOICE_NAME: string;
/** 読み方の指示(gpt-4o-mini-tts の instructions)の既定値 */
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ttsVoice.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* OpenAI TTS のボイス名を扱うユーティリティ。
*
* gpt-4o-mini-tts のボイスは固定の名前付きプリセット(`nova` など)で、Azure の
* gpt-4o-mini-tts のボイスは固定の名前付きプリセット(`shimmer` など)で、Azure の
* ような `<locale>-<Name>Neural` 形式ではない。ボイスは多言語対応のため日英で
* 同じ名前を使える。クライアントから任意文字列が渡るため、未知の名前は
* そのまま OpenAI へ流さず既定値へ倒す(400 で放送を落とさないため)。
Expand All @@ -27,7 +27,7 @@ export const isOpenAiVoiceName = (voiceName: string): boolean =>

// 環境変数の設定ミス(Azure 時代の値の残留など)でも合成を落とさないための
// 最終フォールバック。ここは検証済みの定数なので必ず OpenAI が受理する。
export const DEFAULT_TTS_VOICE = 'nova';
export const DEFAULT_TTS_VOICE = 'shimmer';
export const DEFAULT_TTS_MODEL = 'gpt-4o-mini-tts';

/**
Expand Down
19 changes: 10 additions & 9 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@
"AI_TRIAGE_MODEL": "@cf/meta/llama-3.1-8b-instruct-fast",
// --- TTS(/tts)---
// gpt-4o-mini-tts は SSML 非対応。声色・速度・間の取り方は instructions で指示する。
// ボイスは多言語対応のため、日英とも同じ女性声にして一人のアナウンサーに揃える。
// 日英とも明るくはっきりした女性声にする。同じボイスでも多言語を読めるが、
// 各言語で最も明瞭に聞こえるボイスを選ぶため日英で別のボイスを割り当てている。
"TTS_MODEL": "gpt-4o-mini-tts",
"TTS_JA_VOICE_NAME": "nova",
"TTS_EN_VOICE_NAME": "nova",
"TTS_INSTRUCTIONS_JA": "鉄道の車内自動放送のアナウンサーとして、落ち着いた丁寧な女性の声で読み上げてください。一定の速さを保ち、句読点では短く間を取ります。駅名や路線名は一語ずつ明瞭に発音し、感情を込めすぎず、事務的で聞き取りやすい調子にしてください。",
"TTS_INSTRUCTIONS_EN": "Read this as an automated train announcement in a calm, polite female voice. Keep a steady pace, pause briefly at commas, and pronounce station and line names clearly. Stay neutral and business-like rather than expressive.",
"TTS_JA_VOICE_NAME": "shimmer",
"TTS_EN_VOICE_NAME": "coral",
"TTS_INSTRUCTIONS_JA": "鉄道の車内自動放送のアナウンサーとして、明るくはっきりとした女性の声で読み上げてください。トーンはやや高めに保ち、語尾まで明瞭に発音します。テンポはかなり速く、ラッシュ時の自動放送のように急いで一気に読み進めてください。句読点でも文の切れ目でもほとんど間を取らず、詰めて続けます。語尾や伸ばす音を長く引かないでください。速くても駅名や路線名は一語ずつくっきりと発音し、案内らしい張りのある調子にしてください。",
"TTS_INSTRUCTIONS_EN": "Read this as an automated train announcement in a bright, clear female voice. Keep the pitch slightly high and the delivery crisp and articulate. Speak fast — much quicker than normal narration, with the urgency of a rush-hour announcement — and push straight through without dragging. Take almost no pause at commas or sentence breaks, and do not draw out word endings. Even at that speed, pronounce station and line names distinctly, and sound professional and welcoming rather than flat.",
"SESSION_TOKEN_TTL_SECONDS": "3600",
"UPLOAD_PUBLIC_BASE_URL": "https://uploads-dev.trainlcd.app",
"FEW_SHOT_KV_KEY": "config:fewshot",
Expand Down Expand Up @@ -102,10 +103,10 @@
"AI_TRIAGE_MODEL": "@cf/meta/llama-3.1-8b-instruct-fast",
// --- TTS(/tts)---
"TTS_MODEL": "gpt-4o-mini-tts",
"TTS_JA_VOICE_NAME": "nova",
"TTS_EN_VOICE_NAME": "nova",
"TTS_INSTRUCTIONS_JA": "鉄道の車内自動放送のアナウンサーとして、落ち着いた丁寧な女性の声で読み上げてください。一定の速さを保ち、句読点では短く間を取ります。駅名や路線名は一語ずつ明瞭に発音し、感情を込めすぎず、事務的で聞き取りやすい調子にしてください。",
"TTS_INSTRUCTIONS_EN": "Read this as an automated train announcement in a calm, polite female voice. Keep a steady pace, pause briefly at commas, and pronounce station and line names clearly. Stay neutral and business-like rather than expressive.",
"TTS_JA_VOICE_NAME": "shimmer",
"TTS_EN_VOICE_NAME": "coral",
"TTS_INSTRUCTIONS_JA": "鉄道の車内自動放送のアナウンサーとして、明るくはっきりとした女性の声で読み上げてください。トーンはやや高めに保ち、語尾まで明瞭に発音します。やや速めの一定の速さで、句読点では短く間を取ります。駅名や路線名は一語ずつくっきりと発音し、案内らしい張りのある調子にしてください。",
"TTS_INSTRUCTIONS_EN": "Read this as an automated train announcement in a bright, clear female voice. Keep the pitch slightly high and the delivery crisp and articulate, at a steady, slightly brisk pace. Pause briefly at commas and pronounce station and line names distinctly. Sound professional and welcoming rather than flat.",
"SESSION_TOKEN_TTL_SECONDS": "3600",
"UPLOAD_PUBLIC_BASE_URL": "https://uploads.trainlcd.app",
"FEW_SHOT_KV_KEY": "config:fewshot",
Expand Down