WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 05-07-2009, 01:15 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
So changing the sound volume every frame with the volume computed by your algorithm won't work? I guess I'm missing something. But thats ok.

Just for fun I added a slider controlling volume to the Vizard 3D sound example
Code:
# WorldViz Copyright 2002====================================================
# This script demonstrates the use of 3D sound, otherwise known as spatialized
# sound.  To mimic the sound changes that occur in real environments with
# real sounds, the computer will change the sound being played between the
# two speakers (or 4 speakers for fancy cards) to create the sense of spatialized
# sound.  Vizard uses Microsoft Direct Sound as it's interface to this procedure,
# which in turn will use any 3D sound acceleration that is available on your
# sound card.  As such, you'll have to turn to either Microsoft or your sound
# card manufacturer to try and figure out what is really going on.  Good luck.
#
# In this demo, two objects are create by issuing the 'add' command.  To
# attach a sound to an object, the child method command 'playsound' is called.
# Pressing the 'z' key in this demo causes one of the object to start orbiting
# around the origin.
#
#===========================================================================


import viz
import math

viz.go()

import vizinfo
info = vizinfo.add('This script demonstrates how to use 3D sound.\nA sound is being played from each object.\nUse the checkbox to toggle between spinning the object.\nMove closer to an object to hear each sound louder.')
SpinCheck = info.add(viz.CHECKBOX,'Spin Object')
SpinCheck.set(1)
SpinAction = vizact.spin(0,1,0,90)
volumeSlider = info.add(viz.SLIDER, 'volume')

viz.add('tut_ground.wrl')

m1 = viz.add('tut_hedra.wrl')
m2 = viz.add('tut_hedra.wrl')

m1Sound = m1.playsound('buzzer.wav', viz.LOOP)
m1.translate(-15, 0,15)

m2Sound = m2.playsound('boing!.wav', viz.LOOP)
m2.translate(-5, 0, 0)
m2.center(5,0,0)
m2.addAction(SpinAction)

vizact.onbuttondown(SpinCheck,m2.addAction,SpinAction)
vizact.onbuttonup(SpinCheck,m2.clearActions)

vizact.onslider(volumeSlider, m1Sound.volume)
vizact.onslider(volumeSlider, m2Sound.volume)
Also here is a link to the Direct Sound API. Good background info for sound newbs like me:
http://msdn.microsoft.com/en-us/libr...23(VS.85).aspx
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound Looping Problem JMOwens Vizard 4 09-29-2010 09:42 PM
HRTF-based spatial audio with Vizard? bernie Vizard 4 10-16-2008 09:58 AM
On click Sound Play Problems Robbos Vizard 1 02-28-2008 02:02 PM
Stuttering sound Jerry Vizard 1 06-13-2007 12:36 PM
sound problem alaa Vizard 7 09-02-2005 01:13 PM


All times are GMT -7. The time now is 07:03 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC