Sound Node Examples
looping environmental sound
sound (file("birds.aiff"),volume(infinite),loop(true),amplitude(.7),play)
looping positioned sound
sound (file("waterfall.aiff"),
volume(sphere(0 30 0 5)),
amplitude(1.0),
falloffDistance(20),
loop(true),
play)
Sounds with a wandTrigger
sound note1 (file("note1.aiff"),volume(infinite),amplitude(1.0),loop(false)
sound note2 (file("note2.aiff"),volume(infinite),amplitude(1.0),loop(false))
sound note3 (file("note3.aiff"),volume(infinite),amplitude(1.0),loop(false))
wandTrigger (volume(infinite),
when(button1,note1.play),
when(button2,note2.play),
when(button3,note3.play))
Sounds with a userTrigger
object(file("stage.b3d"))
object(file("curtain.b3d"),position(0 15 0))
object(file("audience.b3d"),position(0 30 0))
userTrigger(volume(box -15 12 0 15 16 10),
when(enter,fanfare.play,applause.play),
when(exit,applause.stop))
sound fanfare (file("fanfare.aiff"))
sound applause (file("applause.aiff"),loop(true))
A Simple Musical Instrument
object(file("drum.b3d"),position(-4 6 0))
object(file("drum.b3d"),position(-2 6 0))
object(file("drum.b3d"),position(0 6 0))
object(file("drum.b3d"),position(2 6 0))
object(file("drum.b3d"),position(4 6 0))
wandTrigger(volume(box -4.5 5.5 0 -3.5 6.5 3),when(enter,drumsound1.play))
wandTrigger(volume(box -2.5 5.5 0 -1.5 6.5 3),when(enter,drumsound2.play))
wandTrigger(volume(box -0.5 5.5 0 0.5 6.5 3),when(enter,drumsound3.play))
wandTrigger(volume(box 1.5 5.5 0 2.5 6.5 3),when(enter,drumsound4.play))
wandTrigger(volume(box 3.5 5.5 0 4.5 6.5 3),when(enter,drumsound5.play))
sound drumsound1 (file("drumsound1.aiff"))
sound drumsound2 (file("drumsound1.aiff"))
sound drumsound3 (file("drumsound1.aiff"))
sound drumsound4 (file("drumsound1.aiff"))
sound drumsound5 (file("drumsound1.aiff"))
Another version of the same instrument
this version uses transforms to group and place the object, the trigger, and the sound together. the advantage is that if you want to move a drum to a new place, you just have to change the coordinates in the transform node and you don't have to change the object and the trigger individually.
transform(position(-4 6 0))
{
wandTrigger(volume(box -0.5 5.5 0 0.5 6.5 3),when(enter,drumsound1.play))
sound drumsound1 (file("drumsound1.aiff"))
}
transform(position(-2 6 0))
{
wandTrigger(volume(box -0.5 5.5 0 0.5 6.5 3),when(enter,drumsound2.play))
sound drumsound2 (file("drumsound2.aiff"))
}
transform(position(0 6 0))
{
wandTrigger(volume(box -0.5 5.5 0 0.5 6.5 3),when(enter,drumsound3.play))
sound drumsound3 (file("drumsound3.aiff"))
}
transform(position(2 6 0))
{
wandTrigger(volume(box -0.5 5.5 0 0.5 6.5 3),when(enter,drumsound4.play))
sound drumsound4 (file("drumsound4.aiff"))
}
transform(position(4 6 0))
{
wandTrigger(volume(box -0.5 5.5 0 0.5 6.5 3),when(enter,drumsound5.play))
sound drumsound5 (file("drumsound5.aiff"))
}
An Animated Sound
timer (duration(20),startValue(0.0),endValue(1.0),
when(changed,boatpath.set($value)),
when(back,start),
start)
pointFollower boatpath (file("boat.path"))
{
object(file("boat.b3d"))
sound(file("singing.aiff"),
volume(sphere 0 0 0 5),
falloffDistance(10),
loop(true),
play)
}
(c) Ben Chang