elevenlabs-tts
Original:🇺🇸 English
Translated
1 scriptsChecked / no sensitive code detected
Generate realistic audio from text using ElevenLabs Text-to-Speech API. Use when the user needs to convert text to speech, create voiceovers, generate narration, or produce audio content. Triggers include "generate audio", "text to speech", "TTS", "voiceover", "narration", "ElevenLabs", "audio from text", "read this text aloud"
1installs
Sourcejechearte/skills
Added on
NPX Install
npx skill4agent add jechearte/skills elevenlabs-ttsTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →ElevenLabs Text-to-Speech
Generate high-quality audio from text using the ElevenLabs API.
Prerequisites
-
ElevenLabs API Key: Must be set as environment variable
ELEVEN_API_KEY- The API key should already be configured in your environment
- If not set, get your API key from: https://elevenlabs.io/app/settings/api-keys
-
Python requests library: Install if needed with
pip install requests --break-system-packages
Quick Start
Use the provided script to generate audio with your default voice:
bash
python scripts/generate_audio.py "Your text here" output.mp3The script is pre-configured to use your preferred voice (ID: ).
dq5fzy66iCKSIQWm5YMUUsing a Different Voice
If you need to use a different voice, specify it with the parameter:
--voicebash
python scripts/generate_audio.py "Hello world" output.mp3 --voice "voice_id_here"Common Workflows
Voiceover for Videos
- Prepare your script text
- Choose appropriate voice for your content
- Generate the audio file
- Use the audio in your video editing software
Example:
bash
# Read script from file and generate audio
python scripts/generate_audio.py "$(cat video_script.txt)" voiceover.mp3Multiple Segments
For longer content or different scenes, generate separate audio files:
bash
# Intro
python scripts/generate_audio.py "Welcome to our channel" intro.mp3
# Main content
python scripts/generate_audio.py "$(cat main_script.txt)" main.mp3
# Outro
python scripts/generate_audio.py "Thanks for watching" outro.mp3From Markdown or Text Files
Convert documents to audio:
bash
# Extract text from markdown (remove formatting)
python scripts/generate_audio.py "$(cat article.md | sed 's/#//g')" article.mp3Advanced Usage
Custom Voice ID
If you have access to custom voices or want to use a specific voice ID:
bash
python scripts/generate_audio.py "Text" output.mp3 --voice "your_voice_id_here"Providing API Key Directly
Instead of setting environment variable:
bash
python scripts/generate_audio.py "Text" output.mp3 --api-key "your_api_key"Script Parameters
The script accepts:
generate_audio.py- text (required): The text to convert to speech
- output (required): Output file path (e.g., )
output.mp3 - --voice (optional): Custom voice ID (default: dq5fzy66iCKSIQWm5YMU)
- --api-key (optional): API key (overrides ELEVEN_API_KEY env var)
Best Practices
- Text Length: Keep individual requests under 2,500 characters for best results
- Character Limits: Monitor your monthly character quota to avoid interruptions
- File Naming: Use descriptive names (e.g., ,
intro_v2.mp3)scene1_narration.mp3 - Testing: Generate a short sample first to verify quality before processing long texts
- Punctuation: Use proper punctuation to improve natural speech rhythm and pauses
Troubleshooting
API Key Error: Ensure ELEVEN_API_KEY is set correctly:
bash
echo $ELEVEN_API_KEY # Should display your keyModule Not Found: Install requests:
bash
pip install requests --break-system-packagesRate Limiting: Free tier has usage limits. Space out requests or upgrade plan.
Poor Audio Quality: Try different voices or adjust the text (add punctuation, break into shorter sentences).
Resources
- ElevenLabs Dashboard: https://elevenlabs.io/app
- API Documentation: https://elevenlabs.io/docs/api-reference
- Voice Library: https://elevenlabs.io/voice-library
- Pricing: https://elevenlabs.io/pricing