Sound FX (ElevenLabs)
Overview
Generate a sound effect from a text prompt using the ElevenLabs SFX API. Output is MP3 by default; convert to .ogg/opus for WhatsApp mobile playback.
Quick start
1) Set API key:
- -
ELEVENLABS_API_KEY (preferred) or INLINECODE1 - Or set
skills."sound-fx".env.ELEVENLABS_API_KEY in INLINECODE3
2) Generate SFX (MP3):
CODEBLOCK0
3) Convert to WhatsApp-friendly .ogg/opus (if needed):
CODEBLOCK1
Script: scripts/generate_sfx.sh
Usage
CODEBLOCK2
Notes
- - Uses INLINECODE4
- Supports optional
--duration (0.5–30s). When omitted, duration is auto. - Prints
MEDIA: <path> on success for auto-attach.
Examples
- - Applause: INLINECODE7
- Laughter: INLINECODE8
- Whoosh: INLINECODE9
- Ambience: INLINECODE10
音效 (ElevenLabs)
概述
使用ElevenLabs SFX API根据文本提示生成音效。默认输出为MP3格式;如需在WhatsApp移动端播放,请转换为.ogg/opus格式。
快速开始
1) 设置API密钥:
- - ELEVENLABSAPIKEY(推荐)或 XIAPIKEY
- 或在 ~/.clawdbot/clawdbot.json 中设置 skills.sound-fx.env.ELEVENLABSAPIKEY
2) 生成音效(MP3格式):
bash
scripts/generate_sfx.sh --text 短促的观众掌声 --out /tmp/applause.mp3 --duration 1.2
3) 转换为WhatsApp兼容的.ogg/opus格式(如需):
bash
ffmpeg -y -i /tmp/applause.mp3 -c:a libopus -b:a 48k /tmp/applause.ogg
脚本:scripts/generate_sfx.sh
使用方法
bash
scripts/generate_sfx.sh --text 罐头笑声 --out /tmp/laugh.mp3 --duration 1.5
注意事项
- - 使用 POST https://api.elevenlabs.io/v1/sound-generation 接口
- 支持可选的 --duration 参数(0.5–30秒)。省略时,时长自动设定。
- 成功时输出 MEDIA: <路径> 以便自动附加。
示例
- - 掌声:短促的观众掌声
- 笑声:罐头观众笑声
- 嗖嗖声:快速嗖嗖声
- 环境音:轻柔雨声环境音