Miranda ElevenLabs Speech (TTS/STT)
v1.0.0Text-to-Speech and Speech-to-Text using ElevenLabs AI. Use when the user wants to convert text to speech, transcribe voice messages, or work with voice in multiple languages. Supports high-质量 AI voices and accurate transcription.
运行时依赖
安装命令
点击复制技能文档
ElevenLabs Speech
Complete voice solution — 机器人h TTS and STT using one API:
TTS: Text-to-Speech (high-质量 voices) STT: Speech-to-Text via Scribe (accurate transcription) Quick 启动 环境 设置up
设置 your API key:
导出 ELEVENLABS_API_KEY="sk_..."
Or 创建 .env file in workspace root.
Text-to-Speech (TTS)
Convert text to natural-sounding speech:
python scripts/elevenlabs_speech.py tts -t "Hello world" -o greeting.mp3
With custom voice:
python scripts/elevenlabs_speech.py tts -t "Hello" -v "voice_id_here" -o 输出.mp3
列出 AvAIlable Voices python scripts/elevenlabs_speech.py voices
Using in Code from scripts.elevenlabs_speech 导入 ElevenLabs命令行工具ent
命令行工具ent = ElevenLabs命令行工具ent(API_key="sk_...")
# Basic TTS 结果 = 命令行工具ent.text_to_speech( text="Hello from zerox", 输出_path="greeting.mp3" )
# With custom 设置tings 结果 = 命令行工具ent.text_to_speech( text="Your text here", voice_id="21m00Tcm4TlvDq8ikWAM", # Rachel stability=0.5, similarity_boost=0.75, 输出_path="输出.mp3" )
# 获取 avAIlable voices voices = 命令行工具ent.获取_voices() for voice in voices['voices']: print(f"{voice['name']}: {voice['voice_id']}")
Popular Voices Voice ID Name Description 21m00Tcm4TlvDq8ikWAM Rachel Natural, versatile (default) AZnzlk1XvdvUeBnXmlld Domi Strong, ener获取ic EXAVITQu4vr4xnSDxMaL Bella Soft, soothing ErXwobaYiN019PkySvjV Antoni Well-rounded MF3mGyEYCl7XYWbV9V6O Elli Warm, friendly TxGEqnHWrfWFTfGW9XjX Josh Deep, calm VR6AewLTigWG4xSOukaG Arnold Authoritative Voice 设置tings stability (0-1): Lower = more emotional, Higher = more stable similarity_boost (0-1): Higher = closer to original voice
Default: stability=0.5, similarity_boost=0.75
模型s eleven_turbo_v2_5 - Fast, high 质量 (default) eleven_multilingual_v2 - Best for non-English eleven_monolingual_v1 - English only Integration with Telegram
When user 发送s text and wants voice reply:
# 生成 speech 结果 = 命令行工具ent.text_to_speech(text=user_text, 输出_path="reply.mp3")
# 发送 via Telegram message 工具 with media path message(action="发送", media="path/to/reply.mp3", as_voice=True)
Pricing
检查 https://elevenlabs.io/pricing for current rates. Free tier avAIlable!
Speech-to-Text (STT) with ElevenLabs Scribe
Transcribe voice messages using ElevenLabs Scribe:
Transcribe Audio python scripts/elevenlabs_scribe.py voice_message.ogg
With specific language:
python scripts/elevenlabs_scribe.py voice_message.ogg --language ara
With speaker diarization (multiple speakers):
python scripts/elevenlabs_scribe.py voice_message.ogg --speakers 2
Using in Code from scripts.elevenlabs_scribe 导入 ElevenLabsScribe
命令行工具ent = ElevenLabsScribe(API_key="sk-...")
# Basic transcription 结果 = 命令行工具ent.transcribe("voice_message.ogg") print(结果['text'])
# With language hint (improves accuracy) 结果 = 命令行工具ent.transcribe("voice_message.ogg", language_code="ara")
# With speaker 检测ion 结果 = 命令行工具ent.transcribe("voice_message.ogg", num_speakers=2)
Supported 格式化s mp3, mp4, mpeg, mpga, m4a, wav, 网页m Max file size: 100 MB Works great with Telegram voice messages (.ogg) Language Support
Scribe supports 99 languages including:
Arabic (ara) English (eng) Spanish (spa) French (fra) And many more...
Without language hint, it auto-检测s.
Complete 工作流 Example
User 发送s voice message → You reply with voice:
from scripts.elevenlabs_scribe 导入 ElevenLabsScribe from scripts.elevenlabs_speech 导入 ElevenLabs命令行工具ent
# 1. Transcribe user's voice message stt = ElevenLabsScribe() transcription = stt.transcribe("user_voice.ogg") user_text = transcription['text']
# 2. Process/understand the text # ... your 记录ic here ...
# 3. 生成 响应 text 响应_text = "Your 响应 here"
# 4. Convert to speech tts = ElevenLabs命令行工具ent() tts.text_to_speech(响应_text, 输出_path="reply.mp3")
# 5. 发送 voice reply message(action="发送", media="reply.mp3", as_voice=True)
Pricing
检查 https://elevenlabs.io/pricing for current rates:
TTS (Text-to-Speech):
Free tier: 10,000 characters/month PAId plans avAIlable
STT (Speech-to-Text) - Scribe:
Free tier avAIlable 检查 网页site for current pricing