mcpField
M
music-generator

music-generator

github.com/aviz85クリエイティブ・メディア50167 回インストール16 週間前に更新
リポジトリ

music-generator について

ElevenLabs Music APIでカスタム音楽を生成するコマンドラインスキルです。プロンプト生成とセクション単位の編曲に対応し、スタイルやムード、長さを調整したい制作者向けです。

主な機能

  1. 01テキストプロンプトから音楽を生成
  2. 02JSONで複数セクションを構成
  3. 03インストゥルメンタルとボーカルに対応
  4. 04トラックの長さを設定

活用シーン

  1. 01ポッドキャストのイントロ制作
  2. 02プレゼン用BGMの生成
  3. 03オーケストラ風ゲームテーマの制作

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/aviz85/claude-skills-library --skill music-generator

インストール後、Claude Code で/music-generatorを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

SETUP.md
examples/
corporate-theme.json
epic-adventure.json
scripts/
.env.example
generate_music.ts
package.json
tsconfig.json

詳細

音楽ジェネレーター

初めてお使いですか? 上記の setup_complete: false の場合は、まず ./SETUP.md を実行してから、setup_complete: true に設定してください。

ElevenLabs Music API を使用して、構成を詳細に制御しながら、カスタム AI 音楽を生成します。

機能

  • シンプルモード:テキストプロンプトから音楽を生成します
  • 詳細モード:スタイル、ムード、トランジションを細かく制御し、複数セクションから成る楽曲を作成します
  • インストゥルメンタルまたはボーカル:インストゥルメンタルとボーカルの両方のトラックに対応しています
  • カスタム再生時間:15 秒から 5 分までのトラックを生成します

クイックスタート

cd ~/.claude/skills/music-generator/scripts

# Simple prompt-based generation
npx ts-node generate_music.ts \
  --prompt "Uplifting corporate music with electronic beats" \
  --duration 60 \
  --output /path/to/music.mp3

# List available styles
npx ts-node generate_music.ts --list-styles

作曲モード

1. シンプルモード(--prompt)

単一のテキストプロンプトから音楽を生成します:

npx ts-node generate_music.ts \
  --prompt "Energetic workout music with driving beats and motivational synths" \
  --duration 90 \
  --output workout.mp3
2. 詳細モード(--composition)

JSON 設定を使って、複数セクションから成る楽曲を作成します:

npx ts-node generate_music.ts \
  --composition /path/to/composition.json \
  --output epic-track.mp3

作曲 JSON 形式:

{
  "duration_ms": 80000,
  "instrumental": true,
  "positive_global_styles": ["corporate", "motivational", "electronic"],
  "negative_global_styles": ["sad", "aggressive", "heavy metal"],
  "sections": [
    {
      "section_name": "Intro",
      "duration_ms": 20000,
      "positive_local_styles": ["building momentum", "soft start"],
      "negative_local_styles": ["loud", "intense"],
      "lines": []
    },
    {
      "section_name": "Main Theme",
      "duration_ms": 40000,
      "positive_local_styles": ["energetic", "uplifting", "driving rhythm"],
      "negative_local_styles": ["slow", "mellow"],
      "lines": []
    },
    {
      "section_name": "Outro",
      "duration_ms": 20000,
      "positive_local_styles": ["triumphant", "resolution"],
      "negative_local_styles": ["abrupt ending"],
      "lines": []
    }
  ]
}

スタイルガイド

ポジティブな全体スタイル(トラック全体の雰囲気)

ムード:

  • uplifting、inspiring、motivational、peaceful、energetic
  • dramatic、epic、emotional、nostalgic、mysterious
  • playful、cheerful、romantic、melancholic

ジャンル:

  • corporate、cinematic、electronic、ambient、orchestral
  • pop、rock、jazz、classical、world music
  • lo-fi、hip-hop、EDM、acoustic、folk

楽器:

  • piano、guitar、strings、synths、drums
  • brass、woodwinds、percussion、bass
ネガティブな全体スタイル(避ける要素)
  • aggressive、dark、scary、chaotic
  • heavy metal、death metal、harsh noise
  • explicit、profane
セクション固有のスタイル

positive_local_styles と negative_local_styles を使って、各セクションを制御します:

イントロのスタイル:

  • soft opening、building momentum、atmospheric
  • gentle start、mysterious intro

ピーク/コーラスのスタイル:

  • energetic peak、driving rhythm、powerful
  • emotional climax、triumphant

アウトロのスタイル:

  • gentle fade、triumphant ending、resolution
  • nostalgic close、hopeful conclusion

コマンドオプション

オプション短縮形説明
--prompt-pシンプルモード用のテキストプロンプト
--composition-c詳細モード用の JSON ファイル
--duration-d再生時間(秒)(シンプルモード)
--output-o出力ファイルのパス(必須)
--instrumental-iインストゥルメンタルトラックを生成します
--format-f出力形式(mp3_44100_192、mp3_44100_128)
--list-styles利用可能なスタイルを表示します
--help-hヘルプを表示します

使用例

企業向けのバックグラウンドミュージック
npx ts-node generate_music.ts \
  -p "Professional corporate background music, uplifting and modern, suitable for presentations" \
  -d 120 \
  -i \
  -o corporate-bg.mp3
ポッドキャストのイントロ
npx ts-node generate_music.ts \
  -p "Catchy podcast intro music, energetic and memorable, with electronic elements" \
  -d 15 \
  -o podcast-intro.mp3
ビデオゲームのテーマ曲
npx ts-node generate_music.ts \
  -p "Epic fantasy adventure theme with orchestral instruments and heroic melodies" \
  -d 180 \
  -i \
  -o game-theme.mp3
複数セクションから成る楽曲

my-composition.json というファイルを作成します:

{
  "duration_ms": 120000,
  "instrumental": true,
  "positive_global_styles": ["cinematic", "epic", "orchestral"],
  "negative_global_styles": ["electronic", "modern"],
  "sections": [
    {
      "section_name": "Dawn",
      "duration_ms": 30000,
      "positive_local_styles": ["soft", "mysterious", "building anticipation"],
      "negative_local_styles": ["loud", "fast"],
      "lines": []
    },
    {
      "section_name": "Battle",
      "duration_ms": 50000,
      "positive_local_styles": ["intense", "driving", "heroic"],
      "negative_local_styles": ["peaceful", "slow"],
      "lines": []
    },
    {
      "section_name": "Victory",
      "duration_ms": 40000,
      "positive_local_styles": ["triumphant", "emotional", "uplifting"],
      "negative_local_styles": ["sad", "mellow"],
      "lines": []
    }
  ]
}

次に、生成します:

npx ts-node generate_music.ts \
  -c my-composition.json \
  -o epic-journey.mp3

API の制限

  • 最大再生時間:330 秒(5.5 分)
  • 最小再生時間:15 秒
  • 生成時間:トラック 1 曲あたり約 30~60 秒
  • 料金:1 回の生成あたり約 0.05~0.15 ドル(再生時間によって異なります)

トラブルシューティング

「Invalid API key」:.env ファイルに有効な ELEVENLABS_API_KEY が設定されているか確認してください

「Duration too long」:最大再生時間は 330 秒(5.5 分)です

「Validation error」:作曲 JSON に次の必須フィールドがすべて含まれていることを確認してください:

  • positive_global_styles(配列)
  • negative_global_styles(配列)
  • section_name、duration_ms、positive_local_styles、negative_local_styles、lines を含む sections

コメント