WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-28-2009, 03:38 AM
DrMothra DrMothra is offline
Member
 
Join Date: Apr 2009
Posts: 8
Overiding spatial sound algorithm

Hi, I'm quite new to Vizard and have been using the spatialized 3D sound component. I'd like to replace the default algorithm of determining 3D sound level with my own formula, which takes a number of other factors into account, such as reflections, barriers between user and source, etc, but still keep the spatialization effects. Is there a way to do this? Any info appreciated.

Thanks.
Reply With Quote
  #2  
Old 04-29-2009, 10:55 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Seems the simplest method would be to call your own functions that play a sound with your algorithm. You can create a Python plugin to connect to your 3D sound code if it has a C API. This means you could not use the <VizNode>.playsound method.

Vizard has a plugin architecture to change the 3D sound "algorithm" for the <VizNode>.playsound method. Vizard supports the AuSim 3D sound system by replacing the DirectX 3D sound plugin with the AuSim plugin. The vizausim.py file in the Vizard30/python directory loads the sound3d_ausim1.dll file and adds some additional methods at the python level.

I don't know how to make a sound3d DLL/plugin. Perhaps WorldViz will release the source code for their current sound3d plugins
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #3  
Old 04-30-2009, 08:14 AM
DrMothra DrMothra is offline
Member
 
Join Date: Apr 2009
Posts: 8
Hi, thanks for the info. I'll check out the AuSim plugin and see what I can derive from that.

Cheers.
Reply With Quote
  #4  
Old 05-01-2009, 12:27 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
What 3D sound system are you looking to integrate?
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #5  
Old 05-06-2009, 03:33 AM
DrMothra DrMothra is offline
Member
 
Join Date: Apr 2009
Posts: 8
I'm not really looking to integrate another sound system, I just want to override the default attenuation properties with my own formula, but I still want to keep all the spatialization effects. For instance, when I move around my virtual room I need the sound to diminish if I walk behind a wall or door, etc. I have a formula that works perfectly well, I just need to be able to implement it.

Thanks.
Reply With Quote
  #6  
Old 05-06-2009, 11:42 AM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Ah. In that case you can just set the volume of the DirectX 3D sound.

Code:
asdfSound = noisyThing.playsound('asdf.wav')
...

#every frame
newVolume = soundVolumn(noisyThing, viewPosition)
asdfSound.volume(newVolume)
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #7  
Old 05-07-2009, 06:19 AM
DrMothra DrMothra is offline
Member
 
Join Date: Apr 2009
Posts: 8
Yes, I've tried this, but the default attenuation doesn't seem to get overridden, it still seems like the default (linear?) relationship, whereas my algorithm is slightly different. I'll check it out again next week and just double check that is what I'm getting.

Thanks.
Reply With Quote
  #8  
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
  #9  
Old 05-07-2009, 02:15 PM
DrMothra DrMothra is offline
Member
 
Join Date: Apr 2009
Posts: 8
Thanks for the info. I'll go back and try it out again, it would appear that there is something obvious that I am missing or failing to do. I'll let you know the outcome.

Thanks again.
Reply With Quote
  #10  
Old 06-17-2009, 07:46 AM
DrMothra DrMothra is offline
Member
 
Join Date: Apr 2009
Posts: 8
Apologies for taking so long to get back to you, I've only just started looking at this again today after being swamped with other work. I can get the volume to alter accordingly with the example that you posted, but I still have the same query, but I think that I can explain it a little more coherently now. Essentially if I set the volume of an object to 1 (max) and move away from the object the sound is still attenuated, this sort of makes sense - the object is playing at its maximum volume but I'm too far away to hear it. I would really like greater control over the sound than this, hence why I referred to overriding the sound level previously. So I still have some level of attenuation regardless of what calculated volume level I arrive at. I can compensate for this to a degree by adjusting my formula to take the attenuation into account, but I can't get rid of it completely. In actual fact I can still get the kind of effect I was after so it's OK, but would be good if I could stop the default attenuation completely. Thanks for all your help thus far.
Reply With Quote
  #11  
Old 06-17-2009, 01:22 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
OK, I see.

If the DirectSound API allows you to control attenuation, then you could email farshizzo and request that he expose that feature in the next release or something.

You could also play the sounds with some other, more open library. Seems OpenAL is popular.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #12  
Old 06-17-2009, 04:19 PM
DrMothra DrMothra is offline
Member
 
Join Date: Apr 2009
Posts: 8
Hi, I normally write my own VR software and have used OpenAL before, it's just that for the current project I'm having to use Vizard; not that this is a bad thing but I find it quite constraining at first as I don't have the same level of control that I normally do (not that I'm a control freak or anything!). Therefore I may never come back to Vizard after this work is completed. I think I can just about achieve the effect that I want. If I decide to alter it later I may well look at the OpenAL route, or e-mail farshizzo.

Thanks for your time again.
Reply With Quote
  #13  
Old 06-18-2009, 12:26 AM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
True, Vizard is targeting/marketed as the simpler tool, thus exposing less functionality than an open engine. However, there is nothing to stop folks from integrating other sub-systems, like OpenAL. Something you may have had to do in the other engine's you have worked with perhaps? What rendering engein's did you use to construct your other VR systems Mothra?
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #14  
Old 06-18-2009, 02:19 AM
DrMothra DrMothra is offline
Member
 
Join Date: Apr 2009
Posts: 8
Hi, at the moment I'm integrating a number of third party components together to build our VR system. So I'm using Ogre for the graphics, Raknet for the networking, ffmpeg for the video, OpenAL for the audio, etc. I'm generally a graphics programmer by trade and I've used all sorts of things from raw OpenGL to OpenSceneGraph with some in-house networking thrown in. I'm trying to get away from in-house software as much as possible as they suffer from lack of documentation and support (as I'm sure that you know!), and I'd like the latest system to be easy to use, well supported/documented so that it's flexible for others to use. I live in hope...

Cheers.
Reply With Quote
  #15  
Old 06-18-2009, 12:52 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
“Where there is life, there is hope.”
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
Reply

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:02 AM.


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