Skill: chenghaifeng08-creator/elevenlabs-music-automaton (version 1.0.2)

--- name: elevenlabs-music description: Generate music from text prompts using ElevenLabs Eleven Music API. Use when creating songs, soundtracks, jingles, lullabies, or any audio music from descriptions. Supports vocals with AI-generated lyrics, instrumental tracks, and multiple genres/styles. Requires paid ElevenLabs plan. metadata: {"clawdbot":{"emoji":"🎵","requires":{"bins":["uv"],"env":["ELEVENLABS_API_KEY"]},"primaryEnv":"ELEVENLABS_API_KEY"}} --- # ElevenLabs Music Generation Generate complete songs from text prompts with AI-generated lyrics and vocals. --- ## 💰 付费服务 **AI 音乐定制**: | 服务 | 价格 | 交付 | |------|------|------| | 短视频 BGM | ¥300/首 | 30 秒定制音乐 | | 完整歌曲 | ¥800/首 | 2-3 分钟 + 歌词 | | 品牌 Jingle | ¥1500/首 | 企业专属音乐 | | 专辑定制 | ¥5000/套 | 5 首系列音乐 | **联系**: 微信/Telegram 私信，备注"音乐定制" --- ## Quick Start ```bash # Basic generation (30 seconds) uv run {baseDir}/scripts/generate_music.py "upbeat jazz piano" # Longer track (3 minutes) uv run {baseDir}/scripts/generate_music.py "epic orchestral battle music" --length 180 # Instrumental only (no vocals) uv run {baseDir}/scripts/generate_music.py "lo-fi hip hop beats" --length 120 --instrumental # Custom output path uv run {baseDir}/scripts/generate_music.py "romantic bossa nova" -o /tmp/bossa.mp3 ``` ## Options | Flag | Description | |------|-------------| | `-l, --length` | Duration in seconds (3-600, default: 30) | | `-o, --output` | Output file path (default: /tmp/music.mp3) | | `-i, --instrumental` | Force instrumental, no vocals | ## Prompt Engineering Tips ### Be Specific About Style - Include genre, mood, tempo, and instruments - Reference decades or eras: "90s Brazilian romantic pagode", "1960s sci-fi TV theme" - Describe energy: "builds from soft to explosive", "relaxed and intimate" ### For Vocals - Specify language: "vocals in Portuguese", "singing in Japanese" - Describe vocal style: "soulful male vocals", "ethereal female choir" - Include lyrical themes: "about love and saudade", "celebrating friendship" ### Avoid Copyright Issues - Don't mention artist/band names directly - Describe the style instead: "classic 90s romantic samba style" not "like Raça Negra" - If rejected, the API returns a suggested alternative prompt ### Example Prompts **MPB (Brazilian Popular Music)** ``` A soulful MPB track featuring gentle acoustic guitar, warm nylon strings, and dreamy Rhodes piano. Bossa nova-influenced rhythm with soft brushed drums. Vocals in Portuguese express themes of saudade and the beauty of life. ``` **Epic Orchestral** ``` Epic military march with powerful brass fanfares, thundering timpani drums, and a soaring choir. Triumphant and heroic, with deep bass tubas, bold trumpets, snare rolls, and an anthemic melody building to a glorious crescendo. ``` **Lullaby** ``` Gentle orchestral lullaby with sweeping strings, soft brass, and ethereal wordless soprano vocals. Peaceful yet majestic, evoking wonder and hope. Perfect for falling asleep while dreaming of adventures. ``` **Comedy Rock** ``` Brazilian comedy rock with absurd, hilarious Portuguese lyrics full of wordplay. Mix energetic rock guitars with unexpected rhythms - forró breakdowns, pagode moments. Theatrical, exaggerated vocals singing about ridiculous situations. ``` ## Requirements - **ElevenLabs API Key**: Set `ELEVENLABS_API_KEY` environment variable - **Paid Plan**: Music API requires Creator plan or higher - **uv**: For running the Python script with dependencies ## Supported Features - Text-to-music generation up to 10 minutes - AI-generated lyrics and vocals in multiple languages (English, Spanish, Portuguese, German, Japanese, etc.) - Instrumental-only mode - Most musical styles and genres

path: scripts/generate_music.py
content: #!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = [
#     "elevenlabs>=1.0.0",
#     "python-dotenv",
# ]
# ///
"""
ElevenLabs Music Generation Script
Generate music from text prompts using Eleven Music API.

Usage:
    uv run generate_music.py "your prompt here" [options]

Examples:
    uv run generate_music.py "upbeat jazz piano" --length 30
    uv run generate_music.py "epic orchestral battle music" --length 60 --instrumental
    uv run generate_music.py "sad acoustic guitar ballad" -o my_song.mp3
"""

import argparse
import os
import sys
from pathlib import Path

from elevenlabs.client import ElevenLabs
from dotenv import load_dotenv

load_dotenv()


def generate_music(
    prompt: str,
    length_seconds: int = 30,
    output_path: str = None,
    instrumental: bool = False,
):
    """Generate music from a text prompt."""
    
    [REDACTED_SECRET]"ELEVENLABS_API_KEY")
    if not [REDACTED_SECRET]"Error: ELEVENLABS_API_KEY not found in environment")
        print("Set it with: export [REDACTED_SECRET]'")
        sys.exit(1)

    client = ElevenLabs([REDACTED_SECRET])
    
    length_ms = length_seconds * 1000
    # Clamp to valid range (3s - 600s)
    length_ms = max(3000, min(600000, length_ms))
    
    print(f"🎵 Generating music...", file=sys.stderr)
    print(f"   Prompt: {prompt[:80]}{'...' if len(prompt) > 80 else ''}", file=sys.stderr)
    print(f"   Length: {length_ms // 1000}s", file=sys.stderr)
    print(f"   Instrumental: {instrumental}", file=sys.stderr)
    print(file=sys.stderr)

    try:
        audio_chunks = client.music.compose(
            prompt=prompt,
            music_length_ms=length_ms,
            force_instrumental=instrumental,
        )
        audio_data = b"".join(audio_chunks)
    except Exception as e:
        error_str = str(e)
        if "limited_access" in error_str or "402" in error_str:
            print("❌ Error: Music API requires a paid ElevenLabs plan", file=sys.stderr)
            print("   Upgrade at: https://elevenlabs.io/pricing", file=sys.stderr)
            sys.exit(1)
        elif "bad_prompt" in error_str:
            print("❌ Error: Prompt may contain copyrighted material", file=sys.stderr)
            if hasattr(e, 'body'):
                suggestion = e.body.get('detail', {}).get('data', {}).get('prompt_suggestion', '')
                if suggestion:
                    print(f"   Suggestion: {suggestion}", file=sys.stderr)
            sys.exit(1)
        else:
            raise

    # Determine output path
    if not output_path:
        output_path = Path("/tmp/music.mp3")
    else:
        output_path = Path(output_path)
    
    # Save the audio
    with open(output_path, "wb") as f:
        f.write(audio_data)
    
    print(f"✅ Saved to: {output_path}", file=sys.stderr)
    # Print just the path to stdout for easy capture
    print(output_path)
    return str(output_path)


def main():
    parser = argparse.ArgumentParser(
        description="Generate music with ElevenLabs Eleven Music API",
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog="""
Examples:
  %(prog)s "upbeat electronic dance track"
  %(prog)s "calm lo-fi beats for studying" --length 120
  %(prog)s "epic orchestral" --instrumental
  %(prog)s "jazz piano trio" -o ~/Music/jazz.mp3
        """,
    )
    
    parser.add_argument("prompt", help="Text description of the music to generate")
    parser.add_argument(
        "-l", "--length",
        type=int,
        default=30,
        help="Length in seconds (3-600, default: 30)",
    )
    parser.add_argument(
        "-o", "--output",
        help="Output file path (default: /tmp/music.mp3)",
    )
    parser.add_argument(
        "-i", "--instrumental",
        action="store_true",
        help="Force instrumental (no vocals)",
    )

    args = parser.parse_args()

    output_file = generate_music(
        prompt=args.prompt,
        length_seconds=args.length,
        output_path=args.output,
        instrumental=args.instrumental,
    )
    
    return output_file


if __name__ == "__main__":
    main()


path: _meta.json
content: {
    "name":  "elevenlabs-music-automaton",
    "slug":  "elevenlabs-music-automaton",
    "version":  "1.0.1",
    "description":  "Skill: elevenlabs-music-automaton",
    "author":  "Community",
    "license":  "MIT",
    "type":  "skill",
    "tags":  [
                 "utility"
             ],
    "pricing":  {
                    "pro":  "29 USDC",
                    "basic":  "9 USDC"
                },
    "createdAt":  "2026-03-24T10:47:23.000Z",
    "updatedAt":  "2026-03-24T10:47:23.000Z"
}


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