How do you import a sound file into the Node Editor? I don't see a browser and drag and drop doesn't work.
From the Scenegraph menu select Create, Sound.
Then edit the Sound node and change the soundFile attribute to be the path to your wav file.
To play it from a Variant Set:
Add this Python code to the Script Tab.
s = findNode("Sound")
s.setFieldBool("play", true)
Thanks for the information. Can you walk me through all the steps? I created the sound node in the SG. Do you drag and drop a .wav file on top of it? I did this and the Import Options window pops up. I say "ok", and something happens, but I'm not sure if it is truely loaded- nothing happens when I click on the sound node. Then do I create an new Variant or can I add it to an existing one? Say, when I click on Material Variant to change the paint color, I want to hear a sound. Do I copy and paste the script into the Script Variant and need to change part of it to the name of the .wav file? Thanks so much.
Hi, dropping the wav file onto VRED doesn't work. You need to set the path of the .wav file in the Node Editor, see attached screenshot.
Regards
Sinje
Dawn,
You can add the Python script to the same Variant Set (Script) Tab.
You may need to set the loop attribute to false to keep it from looping.
Regards,
Dan
Do you hear something when you load the example file 3DSound.py?
I noticed that it's a bit tricky to enter the path in the Node Editor. You need to enter it without quotes. With every character that you're typing VRED tries to load the file, that's why there are lots of error messages in the Terminal as long as the path is not complete.
I'm trying out the same and nothing works. 3DSound and 3DSound2 don't play anything, making a sound node and pointing it to a wav file fails too. It doesn't error out when I finish writing the path, but it won't play either.
I see this topic mentioned in the May Knowledge Network:
I see some .wav files in the examples folder, but I do not see the scene example containing any sound nodes.
While these examples work, I can't seem to make it work with any other wav files other than the supplied. What are the constrains of the sound types?
I load 3Dsound2.py, it plays the motor_b8 file. I copy a random wav to the same folder the motor_b8.wav is at, re-point the soundFile field to it, then it won't play anymore (even after ckicking pay = true field on and off repeatedly). If I point the node to the motor_b8.wav again, it won't play either. I re-open 3dsound2.py and it won't work anymore. I need to re-start vred for the example to work again.
If I point the soundFile to any other wav file that comes with vred, it works. Looks like other wav files are breaking vred?
I'm glad you've made some progress, pselener. I'm trying so hard to get this, but I have no Python/scripting experience, so I'm missing the basics.
I did figure out how to turn the sound on and off, using Variants, but when I save the scene and re-open it , the Variants disappear.
When I open "3DSound", I hear the .wav file, "drumloop", even though I see the word, "motor_a8.wav".
I would expect it to play once instead of over and over if I make "loop" false in the Node Editor, but it doesn't.
I'm confused about what the cube geometry is for.
For the "3DSound2" file, I don't hear anything. I'm not sure what to do with this one. Are you supposed to Add it to a .vpb scene?
Playing with the examples and by changing my wav file I find that sound works upon scene reload. It seems to have to load the .wav in at scene start or it doesn't load it at all. I'm looking at attributes of the sound node in the node editor and the gain does not seem to work. pitch does work. reference distance and rolloffFactor do control how loud a sound is relative to how far you are from it. I have no idea what cone angles do - they do not appear to do anything. Seems odd there is a boolean play and a boolean stop. play true false seems to work just fine. Perhaps play false functions as a pause and a full stop would bring you to the beginning. Could make sense but I have not checked yet.
I wish there were more python documentation for anything related to this.
In the demo scene the sound under the red cube has no rolloff factor and the sound on the green cube does have rolloff. So the cubes are there only to indicate where the sounds are coming from. moving closer to the green cube you should hear more engine noise.
Hello Guys
I just would like to ask you guys, can i volume up or down individually to sound nodes in node editor ?
I tried many section there but i failed..
Thank you and Regards
By the way according to my attempts, i get success with only 44100.0 Hz and 16 bit wav files !
And they have to be stand in the `root`, if you would like to make them all in one group its also doesnt work.
Your attentions..
Regards
Can't find what you're looking for? Ask the community or share your knowledge.