game-audio
Handles audio processing in game engines for real-time sound effects, music, and spatial audio.
What this skill does
# game-audio
## Purpose
This skill enables real-time audio processing in game engines, managing sound effects, music playback, and spatial audio for immersive experiences. It integrates with engines like Unity or Unreal to handle audio streams, effects, and positioning, ensuring low-latency performance in games.
## When to Use
- Developing games that require dynamic audio, such as responsive sound effects for player actions.
- Implementing spatial audio for VR/AR games to simulate 3D sound environments.
- Optimizing audio for performance in resource-constrained mobile games.
- When you need to mix audio layers, like background music with in-game effects, using engine-specific APIs.
## Key Capabilities
- Process real-time audio streams with effects like reverb, echo, and pitch shifting via the `processAudio` function.
- Handle spatial audio using vector-based positioning, e.g., calculating sound attenuation based on player coordinates.
- Support multiple audio formats (WAV, MP3, OGG) and dynamic volume control.
- Integrate with game loops for event-driven audio triggers, such as playing a sound on collision detection.
- Provide audio analysis tools, like frequency spectrum detection for adaptive music.
## Usage Patterns
To use this skill, first initialize it in your game engine script, then call methods for audio playback or processing. Always check for audio context availability before operations. For CLI usage, run commands from the project root directory. Pattern: Import the skill, set up authentication with `$GAME_AUDIO_API_KEY`, and use event handlers for audio events.
## Common Commands/API
- CLI Command: `claw audio play --file assets/sound.wav --volume 0.8 --loop true`
- Flags: `--file` specifies the audio file path; `--volume` sets level (0.0-1.0); `--loop` enables looping.
- API Endpoint: POST /api/game-audio/play with JSON body: `{"file": "assets/sound.wav", "position": [0, 0, 0]}`
- Requires header: `Authorization: Bearer $GAME_AUDIO_API_KEY`
- Code Snippet (Python):
```python
import claw_audio
claw_audio.init(key=os.environ['GAME_AUDIO_API_KEY'])
claw_audio.play_sound('assets/sound.wav', volume=0.5)
```
- Code Snippet (C# for Unity):
```csharp
using ClawAudio;
void Start() {
AudioManager.Instance.Play("assets/music.mp3", loop: true);
}
```
- Config Format: JSON for audio settings, e.g., `{"effects": {"reverb": 0.3}, "spatial": true}`. Load via `claw_audio.load_config('config.json')`.
## Integration Notes
Integrate by adding the skill as a dependency in your project (e.g., via npm for Node.js or Unity package manager). Ensure audio hardware is detected using `claw_audio.check_device()`. For cross-engine compatibility, wrap calls in abstraction layers. If using with other OpenClaw skills, pass audio events via the cluster (e.g., link to "game-dev" skills). Set env var for auth: export GAME_AUDIO_API_KEY=your_key. Test integration in a sandbox environment before production.
## Error Handling
Always wrap audio calls in try-catch blocks to handle exceptions like file not found or API failures. Common errors: "Audio device unavailable" – check with `claw_audio.is_device_ready()` and retry after 2 seconds. For API errors, verify status codes (e.g., 401 for unauthorized) and log with `claw_audio.log_error(message)`. Use custom handlers: e.g., in code:
```python
try:
claw_audio.play_sound('file.wav')
except AudioError as e:
print(f"Error: {e}. Retrying...")
claw_audio.retry_operation()
```
Monitor for latency issues by setting timeouts on commands, e.g., `--timeout 5000` in CLI.
## Concrete Usage Examples
1. Playing a sound effect on player jump in a Unity game:
- Code:
```csharp
void OnJump() {
AudioManager.Instance.Play("jump.wav", position: playerTransform.position);
}
```
- Steps: Initialize AudioManager in Start(), ensure $GAME_AUDIO_API_KEY is set, and call OnJump() on input event.
2. Implementing spatial audio for enemy detection in a 3D game:
- Code:
```python
def detect_enemy():
position = [enemy_x, enemy_y, enemy_z]
claw_audio.play_spatial('alert.mp3', position=position, radius=5.0)
```
- Steps: Call detect_enemy() in the game loop, pass player position for attenuation, and adjust radius for sound fade.
## Graph Relationships
- Related to: "game-dev" cluster (e.g., skills like game-rendering for synchronized audio-visual effects).
- Connected via tags: "audio" links to skills like speech-recognition; "sound" to audio-editing tools.
- Dependencies: Requires "core-audio" for base functionality; integrates with "game-physics" for spatial calculations.
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.