Adding Audio to X3D
X3D defines localized audio sources and a generalized background source. The localized audio can be positioned in the environment and its range defined. The background audio permiates everywhere. This post will mostly deal with audio in the HTML environment with X3DOM. That is localized, but without any localization information. The support for localized and spatial extent is not yet available in the code.
It is relatively simple to add audio to an existing X3D environment. Two nodes must be added. These nodes define the actual audio source, and its location in the enviroment. The nodes are Sound and AudioClip.
The AudioClip node provides a reference (URL) to the audio file and control parameters, primarily looping. The audio can be disabled using the enabled field. The example for this post is the Siena Cathedral with added audio of Amicus Meus. The audio is set to loop.
The Sound node provides the container for the AudioClip node. It also (by the X3D Standard) provides the spatialization (location and extent) or the audio. In X3DOM these features are not yet implemented, making Sound strictly a container.
For this example the Sound and AudioClip nodes were added to the Siena Cathedral walk-through. It is best viewed full-screen.