5.57. Sound (sonic property)

<sound> ‐ Sonic properties

5.57.1. Attributes

NameTypeDefaults
idIDNone (required)
sourceINTEGERNone (required)
xFLOAT0
yFLOAT0
zFLOAT0
xlink:hrefURINone (required)
typeSTRINGNone (required)
levelINTEGERNone (required)
presenceINTEGER0
fade_distanceFLOAT1000.0
fade_powerINTEGER0
beginFLOATNone (required for soundloop)
endFLOATNone (required for soundloop)
durationFLOATNone (required for soundloop)
periodFLOATNone (required for soundloop)

5.57.2. Description

This element defines sonic properties for a node that behaves as a sound source. The spherical coordinates of the sound sources with respect to the active hearpoint(s) are used to send details to the sound synthesizer about the relative position of the source with respect to the : azimuth, elevation, and distance (see Figure 5-9 and hearpoint documentation for more details about sound source localization reporting). These values are constantly updated according to the sound source and/or user and hearpoint displacements. If the user's boolean attribute sound_listener is true, a default hearpoint is located at the user's viewpoint.

Currently, only non-directional sound sources are taken into account.

The integer value of the source attribute is used by the sound synthesizer as a unique internal identifier of the sound source. The external file reference, given by the xlink:href attribute, defines the URI reference (Uniform Resource Identifier) of the sound file associated with the sound object in the external application. If this value is modified dynamically, a message is sent to the UDP sound servers in order to dynamically reload the new sound. The string value of the type attribute is equal to soundfinite in the case of a unique sound that is only played once and to soundloop in the case of a repeated sound.

The float values of the x, y, and z define the location of the sound in the coordinate system of the object to which it is attached.

The integer value of the level and presence attributes define the base level and the presence of the sound source. The float value of the fade_distance attribute and the integer value of the fade_power attribute define the sound attenuation with respect to distance. These values are used by the by the external sound synthesizer. They are combined with the values about the location of the sound source with respect to the user to compute the gain of sound level.

The float values begin and end of the begin and end attributes define the maximal time interval during which the sound is played. Playing starts at begin time and the sound source is stopped at end time. In case of a repeated sound, the period value of the float attribute period is used to define the intervals at which the sound source is restarted. The sound source is periodically restarted at begin+n×period for n in 1, 2,...,N. N is the the largest integer smaller than or equal to (end-begin)/period. The duration value of the float attributes duration must be smaller than or equal to period; it defines the sound playing time during each period (see Figure 5-20).

Figure 5-20. Periodical Sound Emission

5.57.3. Expected child

None.

5.57.4. Example

The example below defines a sound identified as source number 5, with associated sound file Sons/c4_explode1.wav. Since it is a repeated sound of duration 10 and period 20, it will be played on the following intervals: [0,10], [20,30], and [40,45].

<node id="sonic_sphere">
  <sound id="explosion_1" xlink:href="Sons/c4_explode1.wav" 
          type="soundloop" fade_distance="0.0" fade_power="0" 
          level="128" source="5" begin="0" end="45" 
          period="20.0" dur="10.0">
  </sound>
  <sphere id="sphere_2_nightsky" radius="0.6">
    <texture encoding="jpeg" xlink:href="textures/skyline.jpg" id="sky"/>
  </sphere>
</node>