WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-08-2010, 12:04 PM
llqqff llqqff is offline
Member
 
Join Date: May 2009
Posts: 25
Creating the sound effect

Hi,
I am working on how to play the sound in vizard that can change the volume when the distance of two objects changes which means: I have a target in some position and I move my right hand, when my hand is moving closer to the target, the volume of the sound increases, otherwise decreases.

I know the target.playsound() function, which can calculate the distance between the target and the two LEDs, then play the spatialized sound automatically.

And now I know how to calculate the distance between the target and the hand, but I don't know how the change the volume when the distance changes.
Reply With Quote
  #2  
Old 06-08-2010, 12:28 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Are you saying you want to use the <node3D>.playsound command but also manipulate the sound volume yourself? If so, look at the following:

Code:
import viz
viz.go()

ball = viz.add('ball.wrl',pos = [0,1.8,2])

slider = viz.addSlider()
slider.setPosition(0.5,0.2)
slider.set(1)

sound = ball.playsound( 'boing!.wav', viz.LOOP )

def changeVolume(value):
	sound.volume(value)
	
vizact.onslider(slider,changeVolume)
Reply With Quote
  #3  
Old 06-08-2010, 12:52 PM
llqqff llqqff is offline
Member
 
Join Date: May 2009
Posts: 25
Actually, I don't want a slider, I want the volume changes automatically when the distance of the hand and the target changes, is there anyway to do that?
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
Attaching sound to a moving object GiudiceLab Vizard 6 08-21-2009 08:52 AM
Multiple Sound Devices GiudiceLab Vizard 2 06-06-2009 10:29 AM
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:40 AM.


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