Vizard 8 » Reference » Multimedia » Sounds basics
8.0

Sound Basics

Vizard supports any sound file format for which your system has a codec. Sound files can be played globally or can be spatialized using various 3D sound features.

Adding and playing sound files

To add global (non-spatialized) sound to your world, use viz.addAudio(<filename>). Once you've added a sound, you can play it, pause it, loop it, stop it, and start it from any point. You can also change the rate at which it plays and its volume. For commands relating to playing sounds, check out the Multimedia command table.

sound = viz.addAudio('fountain.wav') 
sound.loop(viz.ON) 
sound.volume(.5) 
sound.setTime(1) 
sound.setRate(0.7) 
sound.play() 

Adding 3D sound

You can also add spatialized sound and other 3D sound effects to your world. If you want a sound to come from an object, use <node3d>.playsound(<filename>) where <node3d> is the object making the sound and <filename> is the sound file (not the name of a sound that you've added using viz.addAudio). Once you've added a sound to an object, you can use pause, stop or play to control it.  For more 3D sound options, check out the section on advanced 3D sound. NOTE: Use mono .wav files when when you're implementing 3D sound (stereo files will not work).

#Add the duck model.
duck = viz.add('duck.cfg', pos = [0,0.5,5], euler = [180,0,0])

#Attach a sound to the model and pause it
quack = duck.playsound('quack.wav')
quack.pause()

#Play it when you strike the spacebar.
vizact.onkeydown( ' ', quack.play, viz.LOOP )

Finding or recording sound

If you need to record audio for your world, check out Audacity, a free sound editor . You can also record sound within Vizard worlds. If you'd like to find sound effects for your worlds, check out these websites:

See also

In this section:

Multimedia basics

Video Basics

Recording sound

Advanced 3D sound

Ambisonic 3D sound

Multimedia command table

Other sections:

Tutorial: Multimedia

Tutorial: 3D sound

Example scripts:

Video texture

Adding sounds

3D sound