高级功能 #

概述 #

ElevenLabs 提供了一系列高级功能,帮助专业用户创建更复杂、更高质量的语音内容。

text
┌─────────────────────────────────────────────────────────────┐
│                    高级功能概览                              │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐         │
│  │  语音设计    │  │ 配音工作室   │  │ 对话式 AI   │         │
│  │  Design     │  │  Studio     │  │ Conversational│       │
│  └─────────────┘  └─────────────┘  └─────────────┘         │
│                                                             │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐         │
│  │  语音转换    │  │  项目管理    │  │  团队协作    │         │
│  │  Conversion │  │  Projects   │  │   Teams     │         │
│  └─────────────┘  └─────────────┘  └─────────────┘         │
│                                                             │
└─────────────────────────────────────────────────────────────┘

语音设计 (Voice Design) #

概述 #

语音设计允许你通过 AI 生成全新的语音,无需任何音频样本。

text
┌─────────────────────────────────────────────────────────────┐
│                    语音设计                                  │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  功能:                                                     │
│  ├── AI 生成全新语音                                        │
│  ├── 无需音频样本                                           │
│  ├── 可调节语音特征                                         │
│  └── 无限可能                                               │
│                                                             │
│  可调节参数:                                                │
│  ├── 性别 (Gender)                                         │
│  ├── 年龄 (Age)                                            │
│  ├── 口音 (Accent)                                         │
│  └── 音色特征                                               │
│                                                             │
└─────────────────────────────────────────────────────────────┘

使用 Web 界面 #

text
步骤:
1. 登录 ElevenLabs 账户
2. 进入 "Voices" 页面
3. 点击 "Add Voice"
4. 选择 "Voice Design"
5. 调整参数
6. 生成预览
7. 保存语音

通过 API #

python
from elevenlabs import ElevenLabs

client = ElevenLabs(api_key="your_api_key")

# 生成新语音
voice = client.voices.generate(
    name="Custom AI Voice",
    gender="female",
    age="young",
    accent="american",
    accent_strength=0.5
)

print(f"Generated Voice ID: {voice.voice_id}")

设计参数 #

text
┌─────────────────────────────────────────────────────────────┐
│                    设计参数                                  │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  性别:                                                     │
│  ├── male - 男性                                            │
│  └── female - 女性                                          │
│                                                             │
│  年龄:                                                     │
│  ├── young - 年轻                                           │
│  ├── middle_aged - 中年                                     │
│  └── old - 老年                                             │
│                                                             │
│  口音:                                                     │
│  ├── american - 美式                                        │
│  ├── british - 英式                                         │
│  ├── australian - 澳式                                      │
│  └── 更多...                                                │
│                                                             │
│  口音强度:0.0 - 1.0                                         │
│  ├── 0.0 - 无口音                                           │
│  └── 1.0 - 强烈口音                                         │
│                                                             │
└─────────────────────────────────────────────────────────────┘

配音工作室 (Dubbing Studio) #

概述 #

配音工作室是专业视频配音工具,支持自动翻译、口型同步等功能。

text
┌─────────────────────────────────────────────────────────────┐
│                    配音工作室                                │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  核心功能:                                                  │
│  ├── 视频自动配音                                           │
│  ├── 多语言翻译                                             │
│  ├── 口型同步                                               │
│  └── 时间轴编辑                                             │
│                                                             │
│  支持格式:                                                  │
│  ├── MP4                                                   │
│  ├── MOV                                                   │
│  ├── AVI                                                   │
│  └── WebM                                                  │
│                                                             │
│  输出语言:                                                  │
│  └── 支持 29+ 语言                                          │
│                                                             │
└─────────────────────────────────────────────────────────────┘

使用流程 #

text
配音流程:
┌─────────────────────────────────────────────────────────────┐
│                                                             │
│  1. 上传视频                                                │
│     ├── 选择视频文件                                        │
│     └── 等待上传完成                                        │
│                                                             │
│  2. 选择语言                                                │
│     ├── 源语言检测                                          │
│     └── 目标语言选择                                        │
│                                                             │
│  3. 选择语音                                                │
│     ├── 预置语音                                            │
│     ├── 克隆语音                                            │
│     └── 自动匹配                                            │
│                                                             │
│  4. 生成配音                                                │
│     ├── 自动翻译                                            │
│     ├── 语音合成                                            │
│     └── 口型同步                                            │
│                                                             │
│  5. 编辑调整                                                │
│     ├── 时间轴编辑                                          │
│     ├── 文本修正                                            │
│     └── 重新生成                                            │
│                                                             │
│  6. 导出视频                                                │
│     └── 下载配音后的视频                                    │
│                                                             │
└─────────────────────────────────────────────────────────────┘

API 使用 #

python
# 创建配音项目
project = client.dubbing.create(
    name="My Dubbing Project",
    source_url="https://example.com/video.mp4",
    target_language="zh"
)

# 获取项目状态
status = client.dubbing.get(project_id=project.id)
print(f"Status: {status.status}")

# 下载结果
audio = client.dubbing.download(project_id=project.id)

对话式 AI (Conversational AI) #

概述 #

对话式 AI 提供实时双向语音对话能力,支持超低延迟响应。

text
┌─────────────────────────────────────────────────────────────┐
│                    对话式 AI                                 │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  特点:                                                     │
│  ├── 超低延迟 (< 1秒)                                       │
│  ├── 双向语音通信                                           │
│  ├── 自然对话                                               │
│  ├── 情感响应                                               │
│  └── 中断支持                                               │
│                                                             │
│  应用场景:                                                  │
│  ├── AI 客服                                                │
│  ├── 虚拟助手                                               │
│  ├── 游戏角色                                               │
│  ├── 教育辅导                                               │
│  └── 语音机器人                                             │
│                                                             │
└─────────────────────────────────────────────────────────────┘

WebSocket 连接 #

python
import websocket
import json
import base64

def on_message(ws, message):
    event = json.loads(message)
    
    if event.get("audio"):
        audio_data = base64.b64decode(event["audio"])
        # 播放或处理音频
        
    elif event.get("text"):
        print(f"Transcript: {event['text']}")

def on_error(ws, error):
    print(f"Error: {error}")

def on_open(ws):
    config = {
        "agent": {
            "prompt": {
                "text": "You are a helpful assistant."
            },
            "first_message": "Hello! How can I help you?",
            "language": "en"
        }
    }
    ws.send(json.dumps(config))

ws = websocket.WebSocketApp(
    "wss://api.elevenlabs.io/v1/convai/conversation",
    on_open=on_open,
    on_message=on_message,
    on_error=on_error,
    header={"xi-api-key": "your_api_key"}
)

ws.run_forever()

配置选项 #

text
┌─────────────────────────────────────────────────────────────┐
│                    对话配置                                  │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  Agent 配置:                                                │
│  ├── prompt - AI 行为提示                                   │
│  ├── first_message - 开场白                                 │
│  ├── language - 语言                                        │
│  └── voice - 语音设置                                       │
│                                                             │
│  语音配置:                                                  │
│  ├── voice_id - 语音 ID                                     │
│  ├── model_id - 模型 ID                                     │
│  └── voice_settings - 语音设置                              │
│                                                             │
│  行为配置:                                                  │
│  ├── temperature - 创造性                                   │
│  ├── max_tokens - 最大响应长度                              │
│  └── asr - 语音识别设置                                     │
│                                                             │
└─────────────────────────────────────────────────────────────┘

语音转换 (Voice Conversion) #

概述 #

语音转换允许将一段音频的声音转换为另一个语音。

text
┌─────────────────────────────────────────────────────────────┐
│                    语音转换                                  │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  功能:                                                     │
│  ├── 将音频转换为另一个语音                                  │
│  ├── 保持原始内容和情感                                     │
│  └── 支持多种语音                                           │
│                                                             │
│  应用:                                                     │
│  ├── 音频内容改声                                           │
│  ├── 角色配音                                               │
│  └── 内容本地化                                             │
│                                                             │
└─────────────────────────────────────────────────────────────┘

API 使用 #

python
# 语音转换
result = client.voice_conversion.convert(
    voice_id="target_voice_id",
    audio="/path/to/source_audio.mp3",
    model_id="eleven_multilingual_v2"
)

with open("converted.mp3", "wb") as f:
    for chunk in result:
        f.write(chunk)

项目管理 (Projects) #

概述 #

项目管理功能允许你组织和管理大型语音项目。

text
┌─────────────────────────────────────────────────────────────┐
│                    项目管理                                  │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  功能:                                                     │
│  ├── 创建和管理项目                                         │
│  ├── 批量处理文本                                           │
│  ├── 版本控制                                               │
│  └── 协作编辑                                               │
│                                                             │
│  项目类型:                                                  │
│  ├── 有声书                                                 │
│  ├── 播客                                                   │
│  ├── 视频配音                                               │
│  └── 教育内容                                               │
│                                                             │
└─────────────────────────────────────────────────────────────┘

创建项目 #

python
# 创建项目
project = client.projects.create(
    name="My Audiobook",
    default_voice_id="JBFqnCBsd6RMkjVDRZzb"
)

# 添加章节
chapter = client.projects.add_chapter(
    project_id=project.id,
    title="Chapter 1",
    content="This is the content of chapter 1..."
)

# 生成音频
client.projects.generate(
    project_id=project.id,
    voice_id="JBFqnCBsd6RMkjVDRZzb"
)

团队协作 (Teams) #

概述 #

团队功能允许多人协作使用 ElevenLabs。

text
┌─────────────────────────────────────────────────────────────┐
│                    团队协作                                  │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  功能:                                                     │
│  ├── 共享语音库                                             │
│  ├── 共享项目                                               │
│  ├── 权限管理                                               │
│  └── 使用统计                                               │
│                                                             │
│  角色:                                                     │
│  ├── Owner - 所有者                                         │
│  ├── Admin - 管理员                                         │
│  ├── Member - 成员                                          │
│  └── Viewer - 查看者                                        │
│                                                             │
└─────────────────────────────────────────────────────────────┘

团队管理 #

text
操作:
├── 创建团队
├── 邀请成员
├── 分配角色
├── 共享语音
└── 查看使用情况

语音设置优化 #

场景化设置 #

python
# 有声书设置
audiobook_settings = {
    "stability": 0.5,
    "similarity_boost": 0.75,
    "style": 0.3,
    "use_speaker_boost": True
}

# 客服设置
customer_service_settings = {
    "stability": 0.6,
    "similarity_boost": 0.8,
    "style": 0.2,
    "use_speaker_boost": False
}

# 游戏角色设置
game_character_settings = {
    "stability": 0.3,
    "similarity_boost": 0.7,
    "style": 0.6,
    "use_speaker_boost": True
}

批量处理 #

批量生成 #

python
import asyncio
from elevenlabs import AsyncElevenLabs

async def batch_generate(texts, voice_id):
    client = AsyncElevenLabs(api_key="your_api_key")
    
    tasks = []
    for i, text in enumerate(texts):
        task = client.text_to_speech.convert(
            text=text,
            voice_id=voice_id,
            model_id="eleven_multilingual_v2"
        )
        tasks.append((i, task))
    
    results = []
    for i, task in tasks:
        audio = await task
        results.append((i, audio))
    
    return results

# 使用示例
texts = ["Text 1", "Text 2", "Text 3"]
results = asyncio.run(batch_generate(texts, "voice_id"))

下一步 #

最后更新:2026-04-05