mcpField
T
threejs-audio

threejs-audio

github.com/cesartevisualDevelopment13368 installsUpdated 8w ago
Repository

About threejs-audio

threejs-audio is a skill that provides guidance for implementing spatial audio in projects using Three.js. It covers playback lifecycle, positional sound, accessibility, failure handling, and verification while fitting the project's existing architecture.

Key features

  1. 01Distinguish informative audio from ambience
  2. 02Expose mute, volume, and text alternatives
  3. 03Attach audio listeners to the active viewpoint
  4. 04Load audio asynchronously and handle failures
  5. 05Coordinate playback with app and XR lifecycle
  6. 06Verify autoplay, attenuation, and retriggers

Use cases

  1. 01Add positional audio to a Three.js scene
  2. 02Prevent audio playback from breaking on autoplay rejection
  3. 03Manage audio through camera or XR transitions
  4. 04Test repeated mounts and rapid sound triggers

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/cesartevisual/threejs-skills --skill threejs-audio

After installing, type/threejs-audioin Claude Code to confirm it loaded.

Details

From the project README

Spatial Audio

Use the project's installed versions and existing architecture. These instructions supplement the user's task; they do not authorize unrelated changes or external actions.

Establish whether audio communicates information or provides optional ambience. Expose mute/volume and any required textual equivalent in HTML. Start or resume audio from a user interaction and handle autoplay rejection without breaking the scene.

Attach the listener to the active viewpoint and handle camera changes without duplicating listeners or output paths. For positional sources, choose distance/rolloff and directional cones in the scene's units. A positional source does not automatically simulate wall occlusion.

Load and decode asynchronously with explicit failure and stale-result handling. Bound concurrent sources and reuse buffers where appropriate. Avoid replaying a sound on every frame of a collision; trigger from meaningful state transitions.

Coordinate pause, visibility changes, route transitions, and XR session transitions with playback. Stop/disconnect owned sources and release listeners. Do not close an AudioContext shared with another part of the application.

Verify blocked autoplay, first interaction, mute persistence, moving-camera attenuation, rapid retriggers, and repeated mount/unmount. Measure perceived volume on actual output devices when spatial audio matters.

API reference

Consult the official documentation for exact signatures and revision-specific behavior. If documentation access is unavailable, inspect installed types/source and state any remaining uncertainty.

Comments

Markdown supported