feat: [sound-logo] TTS 음성 옵션 확장 + 잡음 문제 수정
- PCM 디코딩 endianness 수정 (big-endian → little-endian, Gemini TTS는 s16le) - 16종 음성 선택 옵션 추가 (남성/여성/중성, 성격 설명) - 9종 발화 스타일 옵션 추가 (밝고 활기차게, 차분하고 신뢰감 등) - 음성/스타일을 컨트롤러에 전달하여 Gemini API에 적용 - 기본 텍스트: '우리들의 솔루션 쌤, 쌤, 쌤'
This commit is contained in:
@@ -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,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user