Jump to content

  • Log In with Google      Sign In   
  • Create Account


Sound effect from environment


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 TcShadowWalker   Members   -  Reputation: 131

Like
1Likes
Like

Posted 06 June 2014 - 06:41 PM

Hey.

 

I'm currently facing the problem of how to implement sound effects emitted by the environment.

Examples for this would be a stream of lava, a river or any other objects that spans over a larger area.

 

I'm using the OpenAL API and I'm entirely unsure how to set the correct information on the sound source object:

This is easy to do for an object like an NPC or a sword-swing: Those have a well-defined single position in the game world,

so I just give OpenAL the position and it manages everything else.

 

But what about large objects that span a wide area?

Do I give them a position as well and 'move' the sound source?

Find the closest point between the listener and the object-boundary and position the sound source at that place?

 

That seems inefficient, because I'd had to do a ConvexSweepTest or something similar with Bullet whenever the player is moving,

for every environmental sound source in his vicinity.

 

I've never really done anything with 3D sound before and would like some pointers. smile.png



Sponsor:

#2 phil_t   Crossbones+   -  Reputation: 3234

Like
1Likes
Like

Posted 06 June 2014 - 07:40 PM

I'd be interested to see how other people handle this too.

 

My solution involves doing expensive calculations offline and pre-generating a map of volume and direction for each environmental "area" sound source (river, ocean, lava, etc...).



#3 frob   Moderators   -  Reputation: 19820

Like
4Likes
Like

Posted 06 June 2014 - 08:25 PM

Several noise emitters placed in the world at regular intervals works like a charm. 


Check out my personal indie blog at bryanwagstaff.com.

#4 DavidGaames   Members   -  Reputation: 146

Like
1Likes
Like

Posted 07 June 2014 - 12:59 AM

I don't know if it's the case for OpenAL, but some audio engines, like Wwise, have the concept of multipoint emitters, which can use a single source over different positions. Barring that, it's hard to say whether it would be more efficient to place a series of different emitters or move one based on player location.

#5 Norman Barrows   Crossbones+   -  Reputation: 1991

Like
0Likes
Like

Posted 07 June 2014 - 11:13 AM


Several noise emitters placed in the world at regular intervals works like a charm. 

 

just what i was thinking, for a system limited to point sound sources.

 

at a lower level, i'd probably use a separate channel for water,etc, (separate from the usual ambient channel), and vary the volume based on player BBox range to the source area.  update volume X times per second, or once every X seconds, or once every X number of iterations of the sfx loop.    more accurate range checks and more frequent volume adjustments would yield better 3d effects.

 

for even better 3d effect, range to each ear should be computed, and the left and right channels attenuated accordingly, also taking into account cutting the top end on signal sources behind the player.  a 3d audio library will already be doing all this for a point source.


Edited by Norman Barrows, 07 June 2014 - 11:17 AM.

Norm Barrows

Rockland Software Productions

"Building PC games since 1988"

 

rocklandsoftware.net

 


#6 Kryzon   Prime Members   -  Reputation: 2771

Like
0Likes
Like

Posted 07 June 2014 - 03:02 PM

If you have a stream of lava, you can project the player position onto a 3D linear spline that follows the river length-wise, and position the lava sound emitter at the result. This way the lava sound will always come from the point of the river that's closest to you.

For cuboid volumes such as a forest, for example, you can place one emitter near the ground-level of each face of the volume (except the top and bottom faces, perhaps).
When you're inside the volume, sound will come from all directions, and when you're outside, sound will mostly come from the face that's closest to you.

Most of the time, a clever positional trick allows you to use a single emitter to convey the atmosphere. In my understanding you need to keep the amount of emitters as low as possible.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS