mcpField
S
sound-effects

sound-effects

github.com/connoradsクリエイティブ・メディア1865 回インストール1 日前に更新
リポジトリ

sound-effects について

テキストの説明から ElevenLabs で効果音を生成するためのスキルです。制作者や開発者向けに、長さ、ループ、プロンプトの反映度、出力形式を扱い、Python、JavaScript SDK、cURL の例を示します。

主な機能

  1. 01テキストから効果音を生成
  2. 02生成時間の指定
  3. 03ループ音声の作成
  4. 04プロンプト反映度の調整
  5. 05複数の音声出力形式

活用シーン

  1. 01ゲームの環境音制作
  2. 02映像シーン用の音声生成
  3. 03ループする背景音の作成
  4. 04API 経由での音声生成

インストール

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

$npx skills add https://github.com/connorads/dotfiles --skill sound-effects

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

同梱ファイルreferences/installation.md

詳細

ElevenLabs Sound Effects

テキストの説明から効果音を生成します。ループ再生、カスタム再生時間、プロンプトへの追従度の調整に対応しています。

セットアップ: インストールガイドを参照してください。JavaScript では、@elevenlabs/* パッケージのみを使用してください。

クイックスタート

Python
from elevenlabs import ElevenLabs

client = ElevenLabs()

audio = client.text_to_sound_effects.convert(
    text="Thunder rumbling in the distance with light rain",
)

with open("thunder.mp3", "wb") as f:
    for chunk in audio:
        f.write(chunk)
JavaScript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createWriteStream } from "fs";

const client = new ElevenLabsClient();
const audio = await client.textToSoundEffects.convert({
  text: "Thunder rumbling in the distance with light rain",
});
audio.pipe(createWriteStream("thunder.mp3"));
cURL
curl -X POST "https://api.elevenlabs.io/v1/sound-generation" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
  -d '{"text": "Thunder rumbling in the distance with light rain"}' \
  --output thunder.mp3

パラメーター

パラメーター型デフォルト説明
textstring(必須)—生成する効果音の説明
model_idstringeleven_text_to_sound_v2使用するモデル
duration_secondsnumber | nullnull(自動)再生時間は0.5~30秒です。nullの場合は自動計算されます
prompt_influencenumber | null0.3プロンプトへの追従度(0~1)
loopbooleanfalseシームレスにループするサウンドを生成します(v2モデルのみ)

パラメーターを使った例

# Looping ambient sound, 10 seconds
audio = client.text_to_sound_effects.convert(
    text="Gentle forest ambiance with birds chirping",
    duration_seconds=10.0,
    prompt_influence=0.5,
    loop=True,
)

# Short UI sound, high prompt adherence
audio = client.text_to_sound_effects.convert(
    text="Soft notification chime",
    duration_seconds=1.0,
    prompt_influence=0.8,
)

出力形式

output_formatをクエリパラメーター(cURL)またはSDKパラメーターとして渡します。

形式説明
mp3_44100_128MP3、44.1kHz、128kbps(デフォルト)
pcm_44100CD品質の非圧縮生データ
opus_48000_128Opus、48kHz、128kbps — 効率的な圧縮形式
ulaw_8000μ-law、8kHz — 電話音声

全形式:mp3_22050_32、mp3_24000_48、mp3_44100_32、mp3_44100_64、mp3_44100_96、mp3_44100_128、mp3_44100_192、pcm_8000、pcm_16000、pcm_22050、pcm_24000、pcm_32000、pcm_44100、pcm_48000、ulaw_8000、alaw_8000、opus_48000_32、opus_48000_64、opus_48000_96、opus_48000_128、opus_48000_192。

プロンプトのヒント

  • 具体的に記述します:「トタン屋根に激しく降る雨」>「雨」
  • 要素を組み合わせます:「砂利を踏む足音と遠くの交通音」
  • スタイルを指定します:「シネマティックなブラーム、ホラー」または「8ビットのレトロなジャンプ音」
  • 雰囲気や状況を伝えます:「廃墟の建物を吹き抜ける不気味な風のうなり」

エラー処理

try:
    audio = client.text_to_sound_effects.convert(text="Explosion")
except Exception as e:
    print(f"API error: {e}")

よくあるエラー:

  • 401:APIキーが無効です
  • 422:パラメーターが無効です(再生時間の範囲とprompt_influenceの範囲を確認してください)
  • 429:レート制限を超過しました

参考資料

コメント