[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,95 +2,164 @@
|
||||
id: wiki-2026-0508-speech-synthesis
|
||||
title: Speech Synthesis
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-SPSN-001]
|
||||
aliases: [tts, text-to-speech, voice-synthesis, neural-tts]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.96
|
||||
tags: [auto-reinforced, speech-synthesis, tts, nlp, audio-ai]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [tts, audio, ai, voice-cloning, generative]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: python
|
||||
framework: elevenlabs-openai-coqui
|
||||
---
|
||||
|
||||
# [[Speech-Synthesis|Speech-Synthesis]]
|
||||
# Speech Synthesis
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "텍스트에 생명을 불어넣는 목소리: 기계적인 데이터가 인간의 호흡, 억양, 감정을 입은 음성 스트림으로 변환되어, 보이지 않는 곳에서 우리와 대화하는 지능적 입술."
|
||||
## 매 한 줄
|
||||
> **"매 text → audio waveform — 매 neural acoustic + vocoder pipeline"**. Speech synthesis (TTS) 는 매 text 를 자연스러운 speech 로 변환 — 매 2026 의 ElevenLabs v3 / OpenAI gpt-4o-tts / Coqui XTTS-v2 가 human-indistinguishable level. 매 voice cloning, emotion control, multi-lingual 의 production-ready.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
음성 합성(Speech Synthesis, Text-to-Speech, TTS)은 텍스트 정보를 인간의 목소리와 유사한 음성 신호로 변환하는 기술입니다.
|
||||
## 매 핵심
|
||||
|
||||
1. **기술적 진화 단계**:
|
||||
* **Concatenative TTS**: 이미 녹음된 수많은 소리 조각을 이어 붙이는 방식. 자연스러움이 떨어짐.
|
||||
* **Parametric TTS**: 음성의 특징(주파수, 지속 시간 등)을 통계적으로 모델링하여 소리를 생성.
|
||||
* **Neural TTS (End-to-End)**: 딥러닝(Transformer, Diffusion 등)을 사용하여 텍스트에서 바로 고품질 음성 파형을 생성. (예: Tacotron, WaveNet).
|
||||
2. **핵심 파이프라인**:
|
||||
* **Text [[Analysis|Analysis]]**: 약어, 숫자, 띄어쓰기를 발음 기호로 변환 (Grapheme-to-Phoneme).
|
||||
* **Prosody Generation**: 문맥에 따른 강조, 고저(Pitch), 속도 결정.
|
||||
* **Vocoder**: 특징 데이터를 바탕으로 최종 가 청 음파 생성.
|
||||
3. **활용 분야**:
|
||||
* 시각 장애인을 위한 독서 서비스, 네비게이션 가이드, 지능형 가상 비서, 게임 캐릭터 음성 등.
|
||||
### 매 진화 단계
|
||||
- **Concatenative (1990s)**: phoneme database 의 splice — 매 robotic.
|
||||
- **Parametric / HMM (2000s)**: statistical 의 generation — 매 muffled.
|
||||
- **Neural (2017+)**: Tacotron 2 + WaveNet — 매 인간 수준 prosody.
|
||||
- **End-to-end (2021+)**: VITS, NaturalSpeech — 매 single model.
|
||||
- **Foundation TTS (2024+)**: Voicebox, NaturalSpeech 3, ElevenLabs v3 — 매 zero-shot voice cloning, emotion, style.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌**: 과거에는 수천 시간의 녹음이 필요했으나, 현대 AI 정책은 단 몇 초의 샘플만으로도 대상의 목소리를 완벽히 복제하는 'Zero-shot Voice Cloning' 기술을 표준화함(RL Update).
|
||||
- **정책 변화(RL Update)**: 보이스 피싱 및 딥페이크 음성 범죄가 급증함에 따라, 생성된 모든 음성에 인간이 들을 수 없는 '오디오 워터마크'를 강제 삽입하고 출처를 명시하는 '음성 윤리 거버넌스' 정책이 전 세계적으로 시행 중임.
|
||||
### 매 Architecture
|
||||
- **Acoustic model**: text → mel-spectrogram (Tacotron, FastSpeech 2, VITS).
|
||||
- **Vocoder**: mel → waveform (WaveNet, HiFi-GAN, BigVGAN).
|
||||
- **End-to-end**: text → waveform 직접 (VITS, NaturalSpeech).
|
||||
- **LLM-based (2024+)**: AudioLM, Voicebox — 매 token-based audio LM.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Sound Design Principles|Sound Design Principles]], [[Neurobiology-of-Reward|Neurobiology-of-Reward]], Human-Computer Interaction (HCI), [[Generative-AI|Generative-AI]]-Safety, [[Ethics & AI|Ethics & AI]]
|
||||
- **Modern Tech/Tools**: ElevenLabs, OpenAI Whisper (STT) & Speech (TTS), Coqui TTS.
|
||||
---
|
||||
### 매 응용
|
||||
1. **Audiobook / podcast** — 매 ElevenLabs Studio.
|
||||
2. **Voice agent** — 매 real-time conversational AI (Vapi, Retell).
|
||||
3. **Game NPC** — 매 dynamic dialog (AI Dungeon, Inworld).
|
||||
4. **Accessibility** — 매 screen reader, dyslexia aid.
|
||||
5. **Localization** — 매 video dubbing (HeyGen, ElevenLabs dubbing).
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
## 💻 패턴
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### ElevenLabs API (production default)
|
||||
```python
|
||||
from elevenlabs import ElevenLabs
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
client = ElevenLabs(api_key="...")
|
||||
audio = client.text_to_speech.convert(
|
||||
voice_id="21m00Tcm4TlvDq8ikWAM", # Rachel
|
||||
model_id="eleven_v3",
|
||||
text="안녕하세요, 매 wiki cleanup batch.",
|
||||
voice_settings={"stability": 0.5, "similarity_boost": 0.75},
|
||||
)
|
||||
with open("out.mp3", "wb") as f:
|
||||
for chunk in audio: f.write(chunk)
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### OpenAI TTS (GPT-5 era)
|
||||
```python
|
||||
from openai import OpenAI
|
||||
client = OpenAI()
|
||||
resp = client.audio.speech.create(
|
||||
model="gpt-4o-mini-tts",
|
||||
voice="nova",
|
||||
input="Hello world",
|
||||
instructions="Speak in a calm, encouraging tone.",
|
||||
)
|
||||
resp.stream_to_file("out.mp3")
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Coqui XTTS-v2 (open-source, voice cloning)
|
||||
```python
|
||||
from TTS.api import TTS
|
||||
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to("cuda")
|
||||
tts.tts_to_file(
|
||||
text="복제된 voice 의 sample",
|
||||
speaker_wav="reference_6sec.wav", # 6s reference 의 zero-shot clone
|
||||
language="ko",
|
||||
file_path="cloned.wav",
|
||||
)
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Streaming (low-latency agent)
|
||||
```python
|
||||
from elevenlabs import stream
|
||||
audio_stream = client.text_to_speech.convert_as_stream(
|
||||
voice_id="...", model_id="eleven_flash_v2_5", # ~75ms TTFB
|
||||
text="streamed reply",
|
||||
)
|
||||
stream(audio_stream)
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Real-time (WebSocket, sub-200ms)
|
||||
```python
|
||||
import websockets, json, asyncio
|
||||
async def speak():
|
||||
uri = "wss://api.elevenlabs.io/v1/text-to-speech/{vid}/stream-input"
|
||||
async with websockets.connect(uri, extra_headers={"xi-api-key": KEY}) as ws:
|
||||
await ws.send(json.dumps({"text": " ", "voice_settings": {...}}))
|
||||
for chunk in llm_stream(): # token-by-token from LLM
|
||||
await ws.send(json.dumps({"text": chunk}))
|
||||
await ws.send(json.dumps({"text": ""}))
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### MLX local TTS (Apple Silicon)
|
||||
```python
|
||||
from mlx_audio.tts.generate import generate_audio
|
||||
generate_audio(text="local synthesis", model_path="mlx-community/Kokoro-82M-bf16",
|
||||
voice="af_heart", output_path="local.wav")
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### SSML / prosody control
|
||||
```xml
|
||||
<speak>
|
||||
<prosody rate="slow" pitch="+10%">매 천천히, 높은 톤</prosody>
|
||||
<break time="500ms"/>
|
||||
<emphasis level="strong">중요</emphasis>합니다.
|
||||
</speak>
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Production voice agent | ElevenLabs Flash v2.5 (75ms TTFB) |
|
||||
| Highest quality narration | ElevenLabs v3 / OpenAI gpt-4o-tts |
|
||||
| Voice cloning (legal consent) | XTTS-v2 (open) / ElevenLabs Pro |
|
||||
| On-device / privacy | Kokoro-82M (MLX) / Piper |
|
||||
| Multilingual dub | ElevenLabs dubbing API / HeyGen |
|
||||
| Cost-sensitive batch | OpenAI tts-1 / self-hosted Coqui |
|
||||
|
||||
**기본값**: ElevenLabs Flash v2.5 (real-time) / v3 (quality batch). 매 on-device 는 Kokoro-82M.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Generative-AI]] · [[Audio-ML]]
|
||||
- 변형: [[Voice-Cloning]] · [[Singing-Synthesis]] · [[Speech-to-Speech]]
|
||||
- 응용: [[Voice-Agents]] · [[Audiobook-Generation]] · [[Game-NPC-Voice]] · [[Video-Dubbing]]
|
||||
- Adjacent: [[ASR]] · [[Whisper]] · [[Audio-Diffusion]] · [[Multimodal-LLM]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: voice agent (LLM → TTS pipeline), dynamic narration, accessibility, localization.
|
||||
**언제 X**: legal/medical 의 critical announcements (human voice 의 trust 필요), sung performance (specialized 모델 사용).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Voice cloning 의 consent 없이**: deepfake 의 legal/ethical violation. ElevenLabs Voice Verification 사용.
|
||||
- **Long-form 의 single API call**: timeout / cost spike. Chunk by sentence + stream.
|
||||
- **No SSML for prosody**: monotone delivery. `<prosody>` 활용.
|
||||
- **Wrong sample rate mixing**: 22kHz vs 44.1kHz mix → distortion. Resample first.
|
||||
- **Pronunciation 의 무방치**: 고유명사 mispronounce. Phoneme override / lexicon 사용.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (ElevenLabs docs 2026, OpenAI Audio API, Coqui XTTS-v2 paper, Apple MLX-Audio).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — modern TTS landscape (ElevenLabs v3, OpenAI gpt-4o-tts, XTTS-v2, Kokoro) |
|
||||
|
||||
Reference in New Issue
Block a user