From 64b3ad2b5984b706c48b851ca67cef96f6d01665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Sun, 8 Mar 2026 13:58:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[sound-logo]=20TTS=20=EC=9D=8C=EC=84=B1?= =?UTF-8?q?=20=EC=98=B5=EC=85=98=20=ED=99=95=EC=9E=A5=20+=20=EC=9E=A1?= =?UTF-8?q?=EC=9D=8C=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PCM 디코딩 endianness 수정 (big-endian → little-endian, Gemini TTS는 s16le) - 16종 음성 선택 옵션 추가 (남성/여성/중성, 성격 설명) - 9종 발화 스타일 옵션 추가 (밝고 활기차게, 차분하고 신뢰감 등) - 음성/스타일을 컨트롤러에 전달하여 Gemini API에 적용 - 기본 텍스트: '우리들의 솔루션 쌤, 쌤, 쌤' --- app/Http/Controllers/RdController.php | 16 ++++- resources/views/rd/sound-logo/index.blade.php | 58 +++++++++++++++++-- 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/RdController.php b/app/Http/Controllers/RdController.php index 18439262..3f70fc9a 100644 --- a/app/Http/Controllers/RdController.php +++ b/app/Http/Controllers/RdController.php @@ -485,6 +485,8 @@ public function soundLogoTts(Request $request): JsonResponse { $request->validate([ 'text' => 'required|string|max:200', + 'voice_name' => 'nullable|string|max:30', + 'voice_style' => 'nullable|string|max:100', ]); $apiKey = config('services.gemini.api_key'); @@ -494,8 +496,18 @@ public function soundLogoTts(Request $request): JsonResponse return response()->json(['success' => false, 'error' => 'Gemini API 키가 설정되지 않았습니다.'], 500); } - // 짧은 텍스트는 TTS 모델이 텍스트 생성으로 인식할 수 있으므로 발화 컨텍스트 추가 + $voiceName = $request->voice_name ?: 'Kore'; + $voiceStyle = $request->voice_style ?: ''; + + // TTS에 전달할 텍스트 구성 $ttsText = $request->text; + + // 스타일 지시가 있으면 프롬프트로 감싸기 + if ($voiceStyle) { + $ttsText = "{$voiceStyle}: {$ttsText}"; + } + + // 짧은 텍스트는 TTS 모델이 텍스트 생성으로 인식할 수 있으므로 발화 컨텍스트 추가 if (mb_strlen($ttsText) < 4) { $ttsText = "'{$ttsText}' "; } @@ -512,7 +524,7 @@ public function soundLogoTts(Request $request): JsonResponse 'speechConfig' => [ 'voiceConfig' => [ 'prebuiltVoiceConfig' => [ - 'voiceName' => 'Kore', + 'voiceName' => $voiceName, ], ], ], diff --git a/resources/views/rd/sound-logo/index.blade.php b/resources/views/rd/sound-logo/index.blade.php index 6585bc22..dd8c7422 100644 --- a/resources/views/rd/sound-logo/index.blade.php +++ b/resources/views/rd/sound-logo/index.blade.php @@ -353,7 +353,22 @@
음성 오버레이 (TTS)
- + + + + + + + +