Skill: javicasper/sound-fx (version 0.1.1)

--- 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` 2) Generate SFX (MP3): ```bash scripts/generate_sfx.sh --text "short audience applause" --out "/tmp/applause.mp3" --duration 1.2 ``` 3) Convert to WhatsApp-friendly .ogg/opus (if needed): ```bash ffmpeg -y -i /tmp/applause.mp3 -c:a libopus -b:a 48k /tmp/applause.ogg ``` ## Script: scripts/generate_sfx.sh **Usage** ```bash 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"`

path: scripts/generate_sfx.sh
content: #!/usr/bin/env bash
set -euo pipefail

TEXT=""
OUT=""
DURATION=""
MODEL="eleven_text_to_sound_v2"
FORMAT="mp3_44100_128"
PROMPT_INFLUENCE="0.3"

while [[ $# -gt 0 ]]; do
  case "$1" in
    --text)
      TEXT="$2"; shift 2;;
    --out)
      OUT="$2"; shift 2;;
    --duration)
      DURATION="$2"; shift 2;;
    --model)
      MODEL="$2"; shift 2;;
    --format)
      FORMAT="$2"; shift 2;;
    --prompt-influence)
      PROMPT_INFLUENCE="$2"; shift 2;;
    -h|--help)
      echo "Usage: $0 --text \"prompt\" --out /path/out.mp3 [--duration 1.5] [--model eleven_text_to_sound_v2] [--format mp3_44100_128] [--prompt-influence 0.3]"
      exit 0;;
    *)
      echo "Unknown arg: $1"; exit 1;;
  esac
 done

if [[ -z "$TEXT" || -z "$OUT" ]]; then
  echo "--text and --out are required" >&2
  exit 1
fi

[REDACTED_SECRET]"
if [[ -z "$API_KEY" ]]; then
  echo "Missing ELEVENLABS_API_KEY (or XI_API_KEY)" >&2
  exit 1
fi

export SFX_TEXT="$TEXT"
export SFX_MODEL="$MODEL"
export SFX_PROMPT_INFLUENCE="$PROMPT_INFLUENCE"
export SFX_DURATION="$DURATION"
PAYLOAD=$(python3 - <<'PY'
import json, os
text = os.environ.get("SFX_TEXT")
model = os.environ.get("SFX_MODEL")
prompt_influence = float(os.environ.get("SFX_PROMPT_INFLUENCE", "0.3"))
duration = os.environ.get("SFX_DURATION")
body = {
  "text": text,
  "model_id": model,
  "prompt_influence": prompt_influence,
}
if duration:
  body["duration_seconds"] = float(duration)
print(json.dumps(body))
PY
)

HTTP_CODE=$(curl -sS -o "$OUT" -w "%{http_code}" \
  -X POST "https://api.elevenlabs.io/v1/sound-generation?output_format=${FORMAT}" \
  -H "xi-[REDACTED_SECRET]" \
  -H "Content-Type: application/json" \
  -d "$PAYLOAD")

if [[ "$HTTP_CODE" != "200" ]]; then
  echo "SFX request failed (HTTP $HTTP_CODE)" >&2
  echo "Response:" >&2
  cat "$OUT" >&2
  exit 1
fi

echo "Saved: $OUT"
echo "MEDIA: $OUT"


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)