jpskill.com
🛠️ 開発・MCP コミュニティ

spatial-audio

Implements 3D audio positioning and rendering for immersive AR/VR experiences.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o spatial-audio.zip https://jpskill.com/download/22026.zip && unzip -o spatial-audio.zip && rm spatial-audio.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/22026.zip -OutFile "$d\spatial-audio.zip"; Expand-Archive "$d\spatial-audio.zip" -DestinationPath $d -Force; ri "$d\spatial-audio.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して spatial-audio.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → spatial-audio フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1
📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

Purpose

This skill implements 3D audio positioning and rendering for AR/VR applications, using techniques like Head-Related Transfer Function (HRTF) to simulate spatial sound sources in real-time.

When to Use

Use this skill when building immersive AR/VR experiences that require realistic audio, such as virtual tours, gaming environments, or simulations where sound direction and distance enhance user presence. Avoid it for 2D audio needs, as it adds overhead for non-spatial applications.

Key Capabilities

  • Real-time HRTF-based audio rendering for accurate 3D positioning.
  • Support for dynamic sound source updates, including occlusion and reverberation effects.
  • Integration with AR/VR frameworks for device-specific audio output (e.g., headphones or spatial speakers).
  • Configurable parameters like sound attenuation models (inverse distance or logarithmic) and frequency ranges (20Hz-20kHz).
  • Multi-source handling, supporting up to 32 concurrent audio sources per session.

Usage Patterns

Always initialize the audio context first, then set up sound sources with positions. Use a loop for updates in real-time applications. For CLI, pipe audio files through the tool; for API, call endpoints in sequence. Pattern: Import library > Create audio context > Add sources > Render and update. Handle cleanup on exit to free resources.

Common Commands/API

Use the OpenClaw CLI for quick prototyping or the REST API for programmatic control. Authentication requires setting $SPATIAL_AUDIO_API_KEY as an environment variable.

  • CLI Command: Render audio with positioning
    spatial-audio render --input audio.wav --position 1.5 2.0 3.0 --hrtf default --output rendered.wav
    This processes an audio file at the specified 3D coordinates.

  • API Endpoint: Create a sound source
    POST to https://api.openclaw.ai/spatial-audio/sources with JSON body:
    { "sourceId": "src1", "position": [0, 0, 5], "audioUrl": "s3://bucket/audio.mp3" }
    Response includes a source handle for updates.

  • Code Snippet (Python): Initialize and position audio

    import openclaw.spatial_audio as sa  
    context = sa.init(hrtf='default')  
    source = sa.add_source(context, position=[1, 2, 3])  
    sa.update_position(source, [4, 5, 6])  
  • Config Format: JSON for API configs, e.g.,
    { "hrtfProfile": "custom", "attenuation": "inverse", "maxSources": 16 }
    Load via CLI: spatial-audio config load --file config.json.

Integration Notes

Integrate by adding the OpenClaw SDK as a dependency (e.g., pip install openclaw-sdk or via npm for JS). Set $SPATIAL_AUDIO_API_KEY before runtime. For AR/VR frameworks, wrap in Unity's AudioListener or WebXR's AudioContext—e.g., in Unity, attach the SpatialAudio component to the main camera. Ensure audio devices are compatible; check for Web Audio API support in browsers. For multi-platform, use abstraction layers like Three.js for web-based AR.

Error Handling

Always check return codes or exceptions for errors. Common issues: Invalid positions (e.g., NaN values) return error code 400; audio device unavailability raises "DEVICE_NOT_FOUND". Handle with try-except blocks:

try:  
    sa.render(context)  
except sa.AudioError as e:  
    if e.code == 400:  
        print("Invalid position; correct coordinates.")  

For CLI, parse stderr output (e.g., "Error: HRTF not loaded—use --hrtf flag"). Retry transient errors like network failures with exponential backoff.

Example 1: Basic Spatial Audio Setup in AR App

To set up 3D audio for an AR object:

  1. Initialize context: sa.init(hrtf='builtin')
  2. Add a sound source: source = sa.add_source(context, position=[0, 1, 2], audioUrl='object_sound.mp3')
  3. In the main loop, update based on user position: sa.update_position(source, user_coords)
  4. Render: sa.render(context)
    This creates a sound that moves relative to the user in an AR scene.

Example 2: Dynamic Audio in VR Simulation

For a VR game with moving sound sources:

  1. Use CLI for prototyping: spatial-audio render --input explosion.wav --position 10 0 0 --hrtf custom
  2. In code (e.g., JavaScript):
    const context = await sa.init();  
    const source = await sa.addSource(context, { position: [5, 0, 0] });  
    setInterval(() => sa.updateSource(source, [Math.random()*10, 0, 0]), 1000);  
  3. Integrate with VR framework to sync with head tracking for immersive effects.

Graph Relationships

  • Related Cluster: ar-vr (e.g., shares dependencies with "ar-rendering" skill).
  • Inbound Links: Depends on "audio-processing" for base audio handling.
  • Outbound Links: Enhances "vr-interaction" by providing spatial feedback.
  • Cross-Skill: Integrates with "3d-visualization" for synchronized audio-visual experiences.