threejs-audio
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen to use this skill
何时使用此 skill
ALWAYS use this skill when the user mentions:
- on
AudioListener,CameravsAudio, distance models, refDistance/maxDistance/rolloffPositionalAudio - for visualization bars/spectrum
AudioAnalyser - Browser autoplay policies blocking audio start
IMPORTANT: audio vs loaders
| Step | Skill |
|---|---|
| Decode mp3/ogg buffer | threejs-loaders ( |
| Spatial playback API | threejs-audio |
Trigger phrases include:
- "PositionalAudio", "AudioListener", "AudioAnalyser", "panner"
- "空间音频", "音量衰减", "频谱"
当用户提到以下内容时,始终使用此 skill:
- 附加到
AudioListener,Camera与Audio的区别,距离模型,PositionalAudiorefDistance/maxDistance/rolloff - 使用 生成可视化条/频谱
AudioAnalyser - 浏览器 autoplay 策略阻止音频启动
重要:音频与 loaders
| 步骤 | Skill |
|---|---|
| 解码 mp3/ogg buffer | threejs-loaders( |
| 空间播放 API | threejs-audio |
触发短语包括:
- “PositionalAudio”、“AudioListener”、“AudioAnalyser”、“panner”
- “空间音频”、“音量衰减”、“频谱”
How to use this skill
如何使用此 skill
- Attach listener to camera object so head-related audio follows view.
- Create context compatible with user gesture unlock patterns in browsers.
- PositionalAudio: set ,
refDistance,maxDistance,rolloffFactorper docs.distanceModel - Load buffer via (threejs-loaders), then
AudioLoader.positionalAudio.setBuffer - Analyser: connect graph pathways per examples; watch performance.
listener.context.createAnalyser() - Update: audio nodes usually need no per-frame update unless following moving sources manually.
See examples/workflow-positional-audio.md.
- 将 listener 附加到 camera 对象,使 head-related audio 跟随视角。
- 创建 context,并确保其兼容浏览器中的 user gesture 解锁模式。
- PositionalAudio:按照文档设置 、
refDistance、maxDistance、rolloffFactor。distanceModel - 通过 (threejs-loaders)加载 buffer,然后调用
AudioLoader。positionalAudio.setBuffer - Analyser:按照示例连接 所在的 graph 路径;注意性能开销。
listener.context.createAnalyser() - 更新:除非手动跟随移动中的声源,否则 audio nodes 通常不需要逐帧更新。
请参阅 examples/workflow-positional-audio.md。
Doc map (official)
官方文档导航
| Docs section | Representative links |
|---|---|
| Audio | https://threejs.org/docs/AudioListener.html |
| Audio | https://threejs.org/docs/Audio.html |
| Audio | https://threejs.org/docs/PositionalAudio.html |
| Audio | https://threejs.org/docs/AudioAnalyser.html |
Extended list: references/official-sections.md.
| 文档章节 | 代表性链接 |
|---|---|
| 音频 | https://threejs.org/docs/AudioListener.html |
| 音频 | https://threejs.org/docs/Audio.html |
| 音频 | https://threejs.org/docs/PositionalAudio.html |
| 音频 | https://threejs.org/docs/AudioAnalyser.html |
扩展列表:references/official-sections.md。
Scope
范围
- In scope: Core Audio classes, spatialization parameters, analyser usage overview.
- Out of scope: FMOD/Wwise-style authoring tools.
- 包含范围: 核心 Audio 类、空间化参数以及 analyser 用法概览。
- 不包含范围: FMOD/Wwise 类型的创作工具。
Common pitfalls and best practices
常见问题与最佳实践
- Autoplay restrictions require user interaction to resume AudioContext.
- Too many positional sources hurt CPU—pool or LOD audio.
- Ensure world units match distance model expectations.
- autoplay 限制要求通过用户交互恢复 AudioContext。
- 过多的 positional sources 会影响 CPU 性能——可使用对象池或 LOD audio。
- 确保 world units 与距离模型的预期相匹配。
Documentation and version
文档与版本
Audio classes are under Audio in three.js docs. Decoding buffers uses —see threejs-loaders. Browser Web Audio policies are external but must be mentioned when is suspended.
AudioLoaderAudioContext音频类位于 three.js 文档的 Audio 章节下。解码 buffer 使用 ——参见 threejs-loaders。浏览器的 Web Audio 策略属于外部限制,但当 处于 suspended 状态时必须加以说明。
AudioLoaderAudioContextAgent response checklist
Agent 响应检查清单
When answering under this skill, prefer responses that:
- Link ,
AudioListener, orPositionalAudioas relevant.AudioAnalyser - Delegate file loading of sound buffers to threejs-loaders ().
AudioLoader - Note autoplay / user-gesture requirements for resuming context.
- Relate distance attenuation to world units and threejs-objects placement.
- Avoid promising DAW-level mixing—stay within three.js audio scope.
在此 skill 下回答时,优先采用以下方式:
- 根据实际情况链接 、
AudioListener或PositionalAudio的相关文档。AudioAnalyser - 将 sound buffer 的文件加载工作委托给 threejs-loaders()。
AudioLoader - 说明恢复 context 时的 autoplay/user-gesture 要求。
- 将距离衰减与 world units 以及 threejs-objects 的放置方式关联起来。
- 避免承诺 DAW 级别的混音能力——保持在 three.js audio 的范围内。
References
参考资料
Keywords
关键词
English: audio, positional audio, listener, analyser, spatial sound, web audio, three.js
中文: 音频、空间音频、AudioListener、PositionalAudio、Web Audio、three.js
英文: audio、positional audio、listener、analyser、spatial sound、web audio、three.js
中文: 音频、空间音频、AudioListener、PositionalAudio、Web Audio、three.js