About Store Forum Documentation Contact



Post Reply 
Best approach to global ambient sounds?
Author Message
Tottel Offline
Member

Post: #1
Best approach to global ambient sounds?
I'm trying to play different sounds depending on where you are in the world (ocean waves, wind trough leaves, cave, ..).

What would be the best way to do so? I was thinking of using Box-actors without physbody; if you step in one, it plays the sound.
But, I would like the sound to be of maximum volume (1) when you're inside the box, but going to (0) when you go further away out of the box. How would I do that? Can I use the box-actors as meshes to play 3D sound from? Would this be optimized to have a whole world with many of those?

Other suggestions?

Thanks.
06-23-2011 01:14 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Best approach to sound?
maybe place multiple objects "sound_type" scattered through entire world.
sound_type would have only "enum sound_type" as parameter:
"ocean", "wind", "cave" enums

few "ocean" sound type objects located near the coast line
"cave" in caves

then when game world is loaded, grab the nearest "sound_type" object, and play its sound according to enum.

just an idea
06-23-2011 07:06 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #3
RE: Best approach to global ambient sounds?
Could try that. I will have to optimize it so it doesn't constantly check for the distance to every sound object though.

Also, is there a function in Esenthel to check distance from the player to an object? And does that calculate to the closest face of an object?
06-23-2011 09:20 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #4
RE: Best approach to global ambient sounds?
Maybe you will find this thread helpful, as a starting point: 3D Sound in World Editor
06-24-2011 12:48 AM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #5
RE: Best approach to global ambient sounds?
Oh, nice! I've never even seen that page!

Thanks grin
06-24-2011 01:43 AM
Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #6
RE: Best approach to global ambient sounds?
I use an approach like esenthel suggests. With a few additions:

1. I scale my objects and use the scale to determine how loud it should sound. It takes some fiddling to find how to correlate them but once you do, you can place several sound objects in every area to cover it.

2. If you also start every sound object at a random place in the file instead of having them all start from the beginning, more blocks do not just sound louder, but add to the texture of the overall sound.

3. I don't play just the loudest sound, but let them all play as world sounds at their location. So if you're moving from a beach to a cave, you should hear beach sounds first, and then gradually hear more cave sounds and less beach.

Mixing sound does not take a lot of cpu time anyway, so don't worry about that. You can easily place a few hundred sounds in your world. If I recall correctly, Esenthel uses openAL for sound. OpenAL will ignore the most silent sounds at the listener position anyway. So if a sound is too far away, it won't take processing time.

One thing I'm not sure of with openAL (I'm using FMOD myself) is how roll-off works. The way it *should* be is that if you have only one sound in a world, you'll hear it from very far away. But if there are a lot of sounds, the far away sounds should not be audible. Compare it with someone talking in a forest. You will hear it from quite far away. But if you would stand at the same distance in a crowded street, you would not hear that talking at all. It should be the same with environmental sound, if openAL got it right.
06-25-2011 12:49 AM
Find all posts by this user Quote this message in a reply
Post Reply