fix: [sound-logo] 음성 카테고리 기반 선택으로 재구성

- 여성/남성/아이 카테고리 탭으로 1차 분류 (성별 확실한 전달)
- 공식 문서 기반 음성 성별 정보 수정 (Gacrux=여성, Sadachbia=남성 등)
- 아이 카테고리: 젊은 음성 + 'young child, high-pitched' Director's Note 지시문
- 스타일 옵션에서 아이/청소년 제거 (카테고리로 이동)
- 프롬프트 형식을 Director's Note 형식으로 개선
This commit is contained in:
김보곤
2026-03-08 14:12:57 +09:00
parent 0e86636354
commit 9b7362fa4f
2 changed files with 94 additions and 49 deletions

View File

@@ -486,6 +486,7 @@ public function soundLogoTts(Request $request): JsonResponse
$request->validate([
'text' => 'required|string|max:200',
'voice_name' => 'nullable|string|max:30',
'voice_category' => 'nullable|string|in:female,male,child',
'voice_style' => 'nullable|string|max:100',
'voice_speed' => 'nullable|integer|min:1|max:5',
]);
@@ -498,6 +499,7 @@ public function soundLogoTts(Request $request): JsonResponse
}
$voiceName = $request->voice_name ?: 'Kore';
$voiceCategory = $request->voice_category ?: 'female';
$voiceStyle = $request->voice_style ?: '';
$voiceSpeed = $request->voice_speed ?: 3;
@@ -505,23 +507,31 @@ public function soundLogoTts(Request $request): JsonResponse
$speedDirectives = [
1 => '아주 천천히 또박또박 말해주세요.',
2 => '조금 느린 속도로 말해주세요.',
3 => '', // 보통 — 지시 없음
3 => '',
4 => '조금 빠른 속도로 말해주세요.',
5 => '아주 빠른 속도로 말해주세요.',
];
// TTS에 전달할 텍스트 구성
$directives = [];
if ($voiceStyle) {
$directives[] = $voiceStyle;
}
if (! empty($speedDirectives[$voiceSpeed])) {
$directives[] = $speedDirectives[$voiceSpeed];
// TTS 프롬프트 구성 — Director's Note 형식
$ttsText = $request->text;
$notes = [];
// 아이 카테고리: 높은 톤으로 어린이처럼 연기하도록 강한 지시문
if ($voiceCategory === 'child') {
$notes[] = 'Speak as a young child with a high-pitched, innocent voice';
}
$ttsText = $request->text;
if (! empty($directives)) {
$ttsText = implode(' ', $directives)." \n\n{$ttsText}";
if ($voiceStyle) {
$notes[] = $voiceStyle;
}
if (! empty($speedDirectives[$voiceSpeed])) {
$notes[] = $speedDirectives[$voiceSpeed];
}
if (! empty($notes)) {
$direction = implode('. ', $notes);
$ttsText = "[{$direction}]\n\n{$ttsText}";
}
// 짧은 텍스트는 TTS 모델이 텍스트 생성으로 인식할 수 있으므로 발화 컨텍스트 추가