声音克隆Voice Clone

只需 10 秒音频样本即可创建高保真声音克隆体,保留原始音色、语调和情感特征。克隆完成后可在 TTS 接口中使用自定义音色进行语音合成,广泛应用于品牌定制、有声书播讲、虚拟人、客服语音等场景。Create high-fidelity voice clones from just 10 seconds of audio, preserving the original timbre, intonation, and emotion. Use cloned voices in the TTS API for custom speech synthesis across branding, audiobooks, virtual humans, and customer service scenarios.

快速概览

Quick Overview

属性Attribute说明Description
克隆端点Clone EndpointPOST /v1/voice/clone
列表端点List EndpointGET /v1/voice/clone
删除端点Delete EndpointDELETE /v1/voice/clone/{voice_id}
认证AuthenticationBearer Token(Authorization 请求头)Bearer Token in Authorization header
请求体Request Bodymultipart/form-data(文件上传)multipart/form-data (file upload)
样本时长Sample Duration10 ~ 60 秒,推荐 30 秒以上10 ~ 60 seconds, 30+ recommended
支持格式Supported FormatsWAV / MP3 / FLAC / M4A / OGGWAV / MP3 / FLAC / M4A / OGG
文件上限Max File Size50 MB
音色配额Voice Quota每账号最多 10 个自定义音色Up to 10 custom voices per account
处理方式Processing Mode同步返回 / 异步回调(长样本推荐)Sync response / async callback (recommended for long samples)

创建克隆

Create Clone

POST/v1/voice/clone

认证

Authentication

所有 API 请求需在 HTTP Header 中携带 Access Token。

All API requests must include an Access Token in the HTTP Header.

Authorization: Bearer {access_token}

请求头

Request Headers

请求头Header必填Required说明Description
Authorizationrequired格式 Bearer {access_token},用于身份认证Format: Bearer {access_token}, used for authentication
Content-Typerequired固定为 multipart/form-data,请勿手动设置,让 HTTP 客户端自动生成Must be multipart/form-data; do not set manually, let the HTTP client generate it

请求参数

Request Parameters

参数Parameter类型Type必填Required说明Description
samplefile / stringrequired参考音频文件(multipart 上传)或音频 URL。10~60 秒,WAV/MP3/FLAC/M4A/OGG,≤50MBReference audio file (multipart) or audio URL. 10~60 seconds, WAV/MP3/FLAC/M4A/OGG, ≤50MB
voice_namestringrequired克隆音色名称,1~64 字符,同账号下需唯一Custom voice name, 1~64 chars, unique per account
langstringrequired样本语言代码,影响合成发音准确性。如 zhenja。详见语种列表Sample language code for synthesis accuracy, e.g. zh, en, ja. See Language List
descriptionstringoptional音色描述/备注,便于管理,最长 200 字符Voice description / notes, max 200 chars
enhance_qualitybooleanoptional是否启用增强质量模式(更深度训练,耗时更长但音色还原度更高),默认 falseEnable enhanced quality mode (deeper training, longer processing but higher fidelity), default false
noise_reductionbooleanoptional是否自动降噪处理参考音频,默认 true。样本本身已降噪时可关闭Auto noise reduction for reference audio, default true. Disable if sample is already clean
genderstringoptional指定性别辅助建模:male / female / unknown,默认 unknown 自动检测Specify gender to assist modeling: male / female / unknown, default unknown (auto-detect)
callback_urlstringoptional异步回调地址。启用 enhance_quality 时建议使用此模式,训练完成后通过 HTTP POST 推送结果Async callback URL. Recommended with enhance_quality; results pushed via HTTP POST on completion

音频样本要求

Audio Sample Requirements

要求项Requirement推荐值Recommended说明Notes
时长Duration30 ~ 60 秒30 ~ 60 seconds 最短 10 秒,推荐 30 秒以上以获得更稳定克隆效果 Minimum 10 seconds; 30+ recommended for stable cloning
采样率Sample Rate16 kHz / 44.1 kHz / 48 kHz 16kHz 为最低要求,48kHz 高保真 16kHz minimum, 48kHz for high fidelity
声道Channels单声道(推荐)Mono (recommended) 多声道将自动混缩为单声道处理 Multi-channel will be auto-downmixed to mono
格式FormatWAV(推荐)/ MP3 / FLAC WAV 无损格式效果最佳,MP3 建议 ≥128kbps WAV lossless gives best results; MP3 ≥128kbps
信噪比SNR≥ 20 dB ≥ 20 dB 背景噪音过大会降低克隆质量,建议在安静环境录制 Excessive background noise reduces quality; record in a quiet environment
文件大小File Size≤ 50 MB ≤ 50 MB 超过限制请先裁剪或压缩 Trim or compress if exceeding the limit
💡 录制高质量样本的建议
  • 使用电容麦克风或手机原声录制,避免使用蓝牙耳机(易丢帧)
  • Use a condenser mic or native phone recorder; avoid Bluetooth headsets (frame drops)
  • 录制自然口语化内容,包含长句和短句,覆盖不同语调变化
  • Record natural conversational content with a mix of long and short sentences
  • 保持正常语速,避免过快或过慢,停顿自然
  • Maintain normal pace; avoid too fast or too slow, with natural pauses
  • 选择情绪中立的内容,避免极端情绪影响通用性
  • Choose emotionally neutral content; extreme emotions affect versatility

请求示例

Request Examples

# 基础克隆
curl -X POST https://api.itranslator.cc/v1/voice/clone \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "sample=@my_voice.wav" \
  -F "voice_name=My Brand Voice" \
  -F "lang=zh"

# 增强质量 + 自动降噪关闭 + 异步回调
curl -X POST https://api.itranslator.cc/v1/voice/clone \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "sample=@voice_sample.wav" \
  -F "voice_name=Professional Narrator" \
  -F "lang=en" \
  -F "enhance_quality=true" \
  -F "noise_reduction=true" \
  -F "gender=female" \
  -F "description=用于有声书播讲的专业女声" \
  -F "callback_url=https://myapp.com/webhook/voice-clone"

# 通过音频 URL 克隆(无需本地文件)
curl -X POST https://api.itranslator.cc/v1/voice/clone \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "sample": "https://cdn.example.com/voice_sample.wav",
    "voice_name": "Host Voice",
    "lang": "ja"
  }'

响应字段说明

Response Fields

字段Field类型Type说明Description
voice_idstring克隆音色唯一 ID,在 TTS 接口中作为 voice 参数使用Unique clone voice ID; use as voice in TTS API
voice_namestring克隆音色名称Custom voice name
langstring样本语言代码Sample language code
quality_scorefloat克隆质量评分(0~1),衡量克隆音色与样本的相似度,≥0.85 为优秀Clone quality score (0~1); measures similarity to sample; ≥0.85 is excellent
statusstring克隆状态:processing(训练中)/ ready(就绪可用)/ failed(失败)Status: processing / ready / failed
descriptionstring音色描述(如传入则返回)Voice description (returned if provided)
sample_durationfloat参考音频时长(秒)Reference audio duration in seconds
created_atstring创建时间(ISO 8601 UTC)Creation time (ISO 8601 UTC)

响应示例

Response Example

同步模式(基础克隆)

Sync Mode (Basic Clone)

{
  "voice_id": "custom-zh-abc123",
  "voice_name": "My Brand Voice",
  "lang": "zh",
  "quality_score": 0.92,
  "status": "ready",
  "sample_duration": 35.2,
  "created_at": "2026-07-20T10:00:00Z"
}

异步模式(增强质量克隆)

Async Mode (Enhanced Clone)

启用 enhance_quality=true 或使用 callback_url 时,接口立即返回 processing 状态,训练完成后通过回调推送最终结果:

When enhance_quality=true or callback_url is used, the API returns processing immediately; the final result is pushed via callback upon completion:

// 同步响应
{
  "voice_id": "custom-en-def456",
  "voice_name": "Professional Narrator",
  "lang": "en",
  "status": "processing",
  "created_at": "2026-07-20T10:05:00Z"
}

// 回调推送(POST 到 callback_url)
{
  "voice_id": "custom-en-def456",
  "voice_name": "Professional Narrator",
  "lang": "en",
  "quality_score": 0.96,
  "status": "ready",
  "sample_duration": 52.8,
  "created_at": "2026-07-20T10:05:00Z",
  "completed_at": "2026-07-20T10:08:30Z"
}

质量评分说明

Quality Score Reference

评分区间Score Range等级Grade说明Description
0.90 ~ 1.0优秀Excellent高度还原原始音色,适合专业级应用Highly faithful to original; suitable for professional use
0.80 ~ 0.89良好Good还原度较好,适合大多数常规场景Good fidelity; suitable for most common scenarios
0.70 ~ 0.79一般Fair可辨识但存在偏差,建议优化样本后重新克隆Recognizable but with deviations; optimize sample and re-clone
< 0.70较差Poor还原度低,通常因样本质量差或时长不足,建议更换样本Low fidelity, usually due to poor sample quality or short duration; replace sample

使用克隆音色

Using Cloned Voice

创建克隆后,在 TTS 接口的 voice 参数中传入 voice_id 即可使用。克隆音色支持 TTS 的所有高级特性,包括语速、音调、音量、情绪等参数控制。After cloning, pass the voice_id to the TTS API's voice parameter. Cloned voices support all TTS advanced features including speed, pitch, volume, and emotion control.

# 基础使用
curl -X POST https://api.itranslator.cc/v1/tts \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text": "你好,这是克隆后的声音。", "voice": "custom-zh-abc123"}' \
  -o output.mp3

# 带语速和情绪的高级使用
curl -X POST https://api.itranslator.cc/v1/tts \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "新品上市啦,限时八折优惠!",
    "voice": "custom-zh-abc123",
    "emotion": "happy",
    "emotion_intensity": "strong",
    "speed": 1.1,
    "output_format": "mp3"
  }' \
  -o promo.mp3
💡 克隆音色与原生音色对比
  • 克隆音色与原生音色在 TTS 接口中使用方式完全一致,无需额外参数
  • Cloned voices work identically to native voices in the TTS API; no extra params needed
  • 情绪风格支持取决于样本特征,建议使用中性样本以保证情绪控制的灵活性
  • Emotion support depends on sample characteristics; neutral samples offer better emotion flexibility
  • 克隆音色的合成延迟与原生音色基本一致,无明显性能损耗
  • Cloned voice synthesis latency matches native voices with no significant overhead

查询克隆列表

List Cloned Voices

GET/v1/voice/clone

查询当前账号下所有克隆音色,支持按状态筛选。

List all cloned voices under the current account, filterable by status.

查询参数

Query Parameters

参数Parameter类型Type说明Description
statusstringoptional按状态筛选:processing / ready / failedFilter by status: processing / ready / failed
langstringoptional按语言代码筛选Filter by language code

列表响应示例

List Response Example

{
  "voices": [
    {
      "voice_id": "custom-zh-abc123",
      "voice_name": "My Brand Voice",
      "lang": "zh",
      "quality_score": 0.92,
      "status": "ready",
      "sample_duration": 35.2,
      "created_at": "2026-07-20T10:00:00Z"
    },
    {
      "voice_id": "custom-en-def456",
      "voice_name": "Professional Narrator",
      "lang": "en",
      "quality_score": 0.96,
      "status": "ready",
      "description": "用于有声书播讲的专业女声",
      "sample_duration": 52.8,
      "created_at": "2026-07-20T10:05:00Z"
    }
  ],
  "total": 2,
  "quota": 10
}

删除克隆音色

Delete Cloned Voice

DELETE/v1/voice/clone/{voice_id}

删除指定的克隆音色。删除后该 voice_id 将无法再用于 TTS 合成,且释放配额。此操作不可撤销。

Delete a cloned voice. After deletion, the voice_id can no longer be used for TTS, and the quota is released. This action is irreversible.

curl -X DELETE https://api.itranslator.cc/v1/voice/clone/custom-zh-abc123 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
  "voice_id": "custom-zh-abc123",
  "deleted": true
}

更新克隆信息

Update Cloned Voice

PUT/v1/voice/clone/{voice_id}

更新克隆音色的名称和描述。注意:无法更新参考音频和语言代码,如需更换样本请新建克隆。

Update the name and description of a cloned voice. Note: the reference audio and language cannot be updated; create a new clone to change the sample.

参数Parameter类型Type必填Required说明Description
voice_namestringoptional新的音色名称New voice name
descriptionstringoptional新的音色描述New voice description
curl -X PUT https://api.itranslator.cc/v1/voice/clone/custom-zh-abc123 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"voice_name": "Brand Voice v2", "description": "更新后的品牌音色"}'
注意事项
  • 建议使用干净无背景噪音的音频样本,以获得最佳克隆效果
  • Use clean audio samples without background noise for optimal cloning quality.
  • 每个账号最多创建 10 个自定义音色,删除后可释放配额
  • Maximum 10 custom voices per account; deletion releases quota.
  • 克隆音色需等待 status 变为 ready 后才能用于 TTS 合成
  • Cloned voices can only be used for TTS after status becomes ready.
  • 质量评分 < 0.70 时建议优化样本后重新克隆
  • If quality score < 0.70, optimize the sample and re-clone.
  • 请确保拥有参考音频的合法使用权,遵守相关法律法规
  • Ensure you have legal rights to use the reference audio and comply with applicable laws.

错误码

Error Codes

HTTP Code错误码Error Code说明Description
2000成功Success
4001001参数错误,请检查必填参数和参数格式Invalid parameter; check required fields and format
4001006音色名称已存在,同账号下需唯一Voice name already exists; must be unique per account
4001007音频时长不足 10 秒或超过 60 秒Audio duration below 10 seconds or exceeds 60 seconds
4001008音频信噪比过低,建议在安静环境重新录制Audio SNR too low; re-record in a quiet environment
4001009未检测到有效语音,可能为静音或纯噪音No valid speech detected; may be silence or pure noise
4012001认证失败,Token 无效或已过期Authentication failed; invalid or expired token
4032003无权限访问该资源Access denied; insufficient permissions
4032004自定义音色配额已满(最多 10 个),请先删除不需要的音色Voice quota full (max 10); delete unused voices first
4042005指定的 voice_id 不存在或已删除Specified voice_id does not exist or has been deleted
4133001文件大小超出限制(最大 50 MB)File size exceeds limit (max 50 MB)
4153002不支持的文件格式Unsupported file format
4223003克隆训练失败,建议优化样本质量后重试Clone training failed; optimize sample quality and retry
4294001请求频率超限,请稍后重试Rate limit exceeded; please retry later
4564002套餐配额已用尽,请升级或等待重置Plan quota exhausted; upgrade or wait for reset
5005001服务器处理失败,请重试或联系技术支持Server processing failed; retry or contact support
5035002服务暂时不可用,建议稍后重试Service temporarily unavailable; retry later

最佳实践

Best Practices

  1. 样本质量优先:清晰、无噪音的音频是高质量克隆的基础。建议在安静室内使用外置麦克风录制,避免回声和环境干扰。
  2. Sample Quality First: Clear, noise-free audio is the foundation of high-quality cloning. Record in a quiet room with an external microphone, avoiding echoes and interference.
  3. 合理选择时长:10 秒为最低要求,30 秒以上可获得更稳定的效果。并非越长越好,60 秒以上无明显收益。
  4. Choose Duration Wisely: 10 seconds is the minimum; 30+ seconds yields more stable results. Longer isn't always better; 60+ seconds offers no significant gain.
  5. 增强质量模式:专业场景(有声书、品牌语音)建议启用 enhance_quality=true,并配合异步回调避免超时。
  6. Enhanced Quality: For professional use (audiobooks, brand voice), enable enhance_quality=true with async callback to avoid timeouts.
  7. 配额管理:每账号限 10 个音色,定期通过列表接口清理不再使用的克隆,及时删除释放配额。
  8. Quota Management: Limited to 10 voices per account; regularly clean up unused clones via the list API to free up quota.
  9. 状态轮询:异步模式下建议轮询列表接口或等待回调,确认 status=ready 后再用于 TTS 合成。
  10. Status Polling: In async mode, poll the list API or wait for callback; confirm status=ready before using in TTS.
  11. 合规使用:仅克隆拥有合法使用权的音频,严禁克隆他人声音用于欺骗或冒充。
  12. Compliance: Only clone audio you have legal rights to; never clone others' voices for deception or impersonation.

应用场景

Use Cases

场景Scenario推荐配置Recommended Config说明Notes
🏢 品牌定制语音 🏢 Brand Voice 增强质量 + 30s 样本 Enhanced + 30s sample 统一品牌对外语音形象,用于广告、宣传视频、IVR 语音导航 Consistent brand voice for ads, promos, and IVR systems
📖 有声书播讲 📖 Audiobook Narration 增强质量 + 60s 样本 + 情绪 Enhanced + 60s sample + emotion 克隆播音员声音,长文本批量合成,多角色多音色切换 Clone narrator voice for batch long-text synthesis with multi-role switching
🤖 虚拟人/数字人 🤖 Virtual Human 增强质量 + 48kHz 样本 Enhanced + 48kHz sample 为虚拟主播、数字员工定制专属声音,配合唇形同步 Custom voices for virtual anchors and digital employees with lip-sync
🎧 客服语音 🎧 Customer Service 基础模式 + 30s 样本 Basic + 30s sample 克隆客服人员声音,用于自动应答和语音通知,保持亲切感 Clone agent voice for auto-response and notifications with familiarity
🎮 游戏角色配音 🎮 Game Voice-Over 增强质量 + 多情绪 Enhanced + multi-emotion 克隆声优声音,快速生成不同情绪的角色台词 Clone voice actor for rapid generation of character lines with varied emotions
🌐 多语言本地化 🌐 Multi-language L10n 每语言一个克隆 One clone per language 同一说话人不同语言版本,保持音色一致性跨语言 Same speaker across languages with consistent timbre
使用说明
  • 文件上传使用 multipart/form-data 编码,Content-Type 请勿手动设置,让 HTTP 客户端自动生成。
  • Use multipart/form-data encoding; let the HTTP client auto-generate Content-Type.
  • 大文件建议分片上传或使用异步任务模式,避免请求超时。
  • For large files, use chunked upload or async task mode to avoid timeouts.
  • 请勿在客户端代码中暴露 Access Token,建议通过后端代理调用。
  • Do not expose your Access Token in client-side code; use a backend proxy.