Skip to content
Jirka Dell'Oro-Friedl edited this page May 10, 2020 · 11 revisions

WebAudio

The AudioComponents integrate the WebAudio-API into FUDGE. WebAudio allows for a wide range of audio application and manipulation including sound generation, effects and spatial location and emission. It is a system using so called Audio-Graphs and is completely separated from the DOM and WebGL. To learn more about the API, see https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API

Implementation

Using the Audioclasses of FUDGE, it is possible to connect the Audio-Graphs to FUDGE-Graphs to create auditive experiences matching the visual impressions.

AudioManager

Extends the standard AudioContext for integration with FUDGE-graphs and creates a default object at startup to be addressed as AudioManager.default. It contains a master gain, and accepts a node as the root of the graph to listen to and a ComponentAudioListener to describe the reception of the audio.

Audio

Extends the audio buffer with methods to load audio ressources (mp3).

ComponentAudio

Synchronizes audio with the FUGDE-Node it's attached to in respect to its world position and allows for specific adjustment of the volume. Effects may be added by inserting the standard Audio-Nodes of the WebAudio-API.

ComponentAudioListener

Serves to set the spatial location and orientation of the reception of the audio relative to the world transformation of the FUDGE-node it is attached to.

Example

Consider a scene with the players avatar having a conversation with an NPC in a threedimensional environment. A simplified diagram explaining the connection between the FUDGE-graph with its nodes and components and the AudioContext controlled by it may look like this.