360 Secure SkillHub
360 安全技能中心

Sound FX

根据文本提示(如掌声、笑声、whoosh、环境音)通过 Bash 脚本调用 ElevenLabs 文本转音效 API,生成 MP3 音效文件,成功时打印 MEDIA: 路径以便自动附加;并给出用 ffmpeg 转为 WhatsApp 友好 .ogg/opus 的步骤。需配置 ElevenLabs API Key,默认输出 MP3。

javicasper
javicasper
热度 92.23
最近更新 2026-05-11 15:51:08
分类:创作依赖:代码执行 / 第三方 API / 读写文件应用场景:自动化脚本 / 文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add sound-fx
Metadata
name
sound-fx
description
Generate short sound effects via ElevenLabs SFX (text-to-sound). Use when you need SFX clips like applause, canned laughter, whooshes, ambience, or short stingers, and optionally convert to WhatsApp-friendly .ogg/opus.

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 XI_API_KEY
  • Or set skills."sound-fx".env.ELEVENLABS_API_KEY in ~/.clawdbot/clawdbot.json
  1. Generate SFX (MP3):
scripts/generate_sfx.sh --text "short audience applause" --out "/tmp/applause.mp3" --duration 1.2
  1. Convert to WhatsApp-friendly .ogg/opus (if needed):
ffmpeg -y -i /tmp/applause.mp3 -c:a libopus -b:a 48k /tmp/applause.ogg

Script: scripts/generate_sfx.sh

Usage

scripts/generate_sfx.sh --text "canned laughter" --out "/tmp/laugh.mp3" --duration 1.5

Notes

  • Uses POST https://api.elevenlabs.io/v1/sound-generation
  • Supports optional --duration (0.5–30s). When omitted, duration is auto.
  • Prints MEDIA: <path> on success for auto-attach.

Examples

  • Applause: "short audience applause"
  • Laughter: "canned audience laughter"
  • Whoosh: "fast whoosh"
  • Ambience: "soft rain ambience"