AudioClip Node

This node specifies the location and properties of an audio source for the Sound node. The file specified in the url must be in either a MIDI or WAVE format.

The following fields are present in this node: 
  • loop specifies if the sound is to play repeatedly, see notes after field definition. 
  • pitch specifies the speed at which the sound will play, for instance if pitch is 2 then the sound will play twice as fast. Only positive values are allowed.
  • startTime specifies the starting Time of the sound in seconds. The value of this field is the number of seconds since midnight, January the first, 1970. 
  • stopTime specifies the stopping time of the sound in seconds. The value of this field is the number of seconds since midnight, January the first, 1970. 
  • url which specifies the location of the sound. You can specify multiple locations if you want to, the browser will look for data in those locations in decreasing order of preference.
  • description is a string which can be used to describe the sound. The browser is not required to display the string. 
  • Notes: 
  • In VRML the world was created at midnight, January the first, 1970. Some say that the reason for choosing this date as the beginning of time as to do with the birth of the Unix system. 
  • If the loop is set to TRUE and startTime >= stopTime then the sound will play forever. However if startTime < stopTime the sound will stop as soon as stopTime is reached. 
  • If startTime >= stopTime then the sound should start as soon as startTime is reached. Note that some browsers only start the sound when startTime > stopTime. This is because in the early drafts of the VRML 2.0 specification this later condition was required to start the sound. 
  • All fields are optional, the default values being applied if the field is not specified. Note: if you do not specify the location of the sound, url, then no sound will be played.

    Syntax: 
    AudioClip{ 
    loop FALSE 
    pitch 1.0 
    startTime 0 
    stopTime 0 
    url [ ] 
    description ""
    The AudioClip node has two eventOut fields: duration_changed and isActive. A duration_changed event is generated when the current url is changed, the value for this event is the time in seconds of the sound. Note that changing the pitch does not produce a duration_changed event. The event isActive with a value TRUE is generated when the sound starts playing, when the sound stops the event isActive will output FALSE.

    To play the sound in the example provided press the mouse button over the sphere. Note that, in the example provided, once the sound has started you can't restart it by pressing the sphere.