elevenlabs-tts

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ElevenLabs Text-to-Speech

ElevenLabs 文本转语音

Generate high-quality speech from text using ElevenLabs API.
使用ElevenLabs API从文本生成高质量语音。

Quick Start

快速开始

bash
/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "Hello there" /tmp/output.mp3
bash
/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "Hello there" /tmp/output.mp3

Usage

使用方法

Basic TTS

基础文本转语音

bash
/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "<text>" <output_file>
bash
/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "<text>" <output_file>

With Voice Selection

选择语音

bash
job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "<text>" <output_file> <voice_id>
bash
job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "<text>" <output_file> <voice_id>

List Available Voices

列出可用语音

bash
/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js --list-voices
bash
/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js --list-voices

Configuration

配置

Requires environment variable:
  • ELEVENLABS_API_KEY
    - ElevenLabs API key
需要设置环境变量:
  • ELEVENLABS_API_KEY
    - ElevenLabs API密钥

Available Voices

可用语音

Default voices (get IDs with --list-voices):
  • rachel
    - Calm, professional female
  • drew
    - Conversational male
  • clive
    - Authoritative male
  • bella
    - Soft female
  • antoni
    - Versatile male
  • charlie
    - Energetic male
默认语音(使用--list-voices获取ID):
  • rachel
    - 沉稳专业的女声
  • drew
    - 口语化男声
  • clive
    - 权威感男声
  • bella
    - 柔和女声
  • antoni
    - 多风格男声
  • charlie
    - 活力男声

SSML Support

SSML支持

Use SSML for advanced control:
xml
<speak>
  <break time="1s"/>
  Hello there!
  <break time="500ms"/>
  How can I help you?
</speak>
使用SSML实现高级控制:
xml
<speak>
  <break time="1s"/>
  Hello there!
  <break time="500ms"/>
  How can I help you?
</speak>

Output Format

输出格式

Creates MP3 file at specified path. Returns path on success.
在指定路径生成MP3文件。成功时返回文件路径。

Examples

示例

bash
undefined
bash
undefined

Generate speech with default voice

使用默认语音生成语音

/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "Welcome to our service" /tmp/welcome.mp3
/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "Welcome to our service" /tmp/welcome.mp3

Generate with specific voice

使用指定语音生成

/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "This is important" /tmp/alert.mp3 EXAVITQu4vr4xnSDxMaL
/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js "This is important" /tmp/alert.mp3 EXAVITQu4vr4xnSDxMaL

List all available voices

列出所有可用语音

/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js --list-voices
undefined
/job/.pi/skills/elevenlabs-tts/elevenlabs-tts.js --list-voices
undefined

Tips

提示

  • Keep text under 5000 characters per request
  • Use breaks and pauses for natural speech
  • Preview with short clips before generating long audio
  • For emotional delivery, use voice-specific prompts in the text
  • 每个请求的文本长度控制在5000字符以内
  • 使用停顿让语音更自然
  • 生成长音频前先用短片段预览
  • 如需带情感的语音,可在文本中加入适合该语音的提示词

When to Use

适用场景

  • User requests voice message or audio narration
  • Creating accessibility audio content
  • Generating voice responses for chatbots
  • Text-to-speech for notifications
  • 用户请求语音消息或音频旁白
  • 创建无障碍音频内容
  • 为聊天机器人生成语音回复
  • 为通知生成文本转语音内容