Syntax: AudioClip
An AudioClip node creates a digital sound source:
- url - a sound file URL
- pitch - playback speed
- playback controls, like a TimeSensor node
XML Encoding
1 2 3 4 5 6 7 8 |
<Sound> <AudioClip url='"myfile.mp3"' pitch='1.0' startTime='0.0' stopTime='0.0' loop='false'/> </Sound> |
Classic Encoding
1 2 3 4 5 6 7 8 9 |
Sound { source AudioClip { url "myfile.mp3" pitch 1.0 startTime 0.0 stopTime 0.0 loop FALSE } } |
Syntax: MovieTexture
A MovieTexture node creates a movie sound source:
- url - a texture movie file URL
- speed - playback speed
- playback controls, like a TimeSensor node
XML Encoding
1 2 3 4 5 6 7 8 |
<Sound> <MovieTexture containerField='source' url='"movie.mp4"' speed='1.0' startTime='0.0' stopTime='0.0' loop='false'/> </Sound> |
Classic Encoding
1 2 3 4 5 6 7 8 9 |
Sound { source MovieTexture { url "movie.mp4" speed 1.0 startTime 0.0 stopTime 0.0 loop FALSE } } |
Selecting sound source types
Supported by the AudioClip node:
- MP3 or WAV - digital sound files
Good for sound effects
Supported by the MovieTexture node:
- MP4 - movie file with sound
Good for virtual TVs
Syntax: Sound
A Sound node describes a sound emitter:
- source - AudioClip or MovieTexture node
- location and direction - emitter placement
XML Encoding
1 2 3 4 5 |
<Sound location='0.0 0.0 0.0' direction='0.0 0.0 1.0'> <AudioClip ... /> </Sound> |
Classic Encoding
1 2 3 4 5 |
Sound { source AudioClip { ... } location 0.0 0.0 0.0 direction 0.0 0.0 1.0 } |
A Sound node describes a sound emitter:
- intensity - volume
- spatialize - use spatialize processing
- priority - prioritize the sound
XML Encoding
1 2 3 4 5 6 |
<Sound ... intensity='1.0' spatialize='true' priority='0.0'> </Sound> |
Classic Encoding
1 2 3 4 5 6 |
Sound { ... intensity 1.0 spatialize TRUE priority 0.0 } |
A Sound node describes a sound emitter:
- minFront, minBack - inner ellipsoid
- maxFront, maxBack - outer ellipsoid
A sample using triggered sound
XML Encoding
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<Group> <Shape> <Appearance> <Material diffuseColor='1 1 1'/> </Appearance> <Box size='0.23 0.1 1.5'/> </Shape> <TouchSensor DEF='C4'/> <Sound maxBack='100' maxFront='100'> <AudioClip DEF='PitchC4' url='"tone1.mp3"'/> </Sound> </Group> <ROUTE fromNode='C4' fromField='touchTime' toNode='PitchC4' toField='set_startTime'/> |
Classic Encoding
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
Group { children [ Shape { appearance Appearance { material Material { diffuseColor 1.0 1.0 1.0 } } geometry Box { size 0.23 0.1 1.5 } } DEF C4 TouchSensor { } Sound { maxFront 100.0 maxBack 100.0 source DEF PitchC4 AudioClip { url "tone1.mp3" pitch 1.0 } } ] } ROUTE C4.touchTime TO PitchC4.set_startTime |
A sample using continuous localized sound
XML Encoding
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<Sound minBack='5' minFront='5'> <AudioClip url='"willow1.mp3"' loop='true' startTime='1'/> </Sound> <Transform translation='0 -1.65 0'> <Inline url='"sndmark.wrl"'/> </Transform> |
Classic Encoding
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Sound { minFront 5.0 minBack 5.0 maxFront 10.0 maxBack 10.0 source AudioClip { url "willow1.mp3" loop TRUE startTime 1.0 stopTime 0.0 } } Transform { translation 0.0 -1.65 0.0 children [ Inline { url "sndmark.wrl" } ] } |
Summary
An AudioClip node or a MovieTexture node describe a sound source:
- A URL gives the sound file
- Looping, start time, and stop time control playback
A Sound node describes a sound emitter:
- A source node provides the sound
- Range fields describe the sound volume