Page 1 of 1

More realistic 3d sound

Posted: Wed Apr 07, 2004 9:42 pm
by Masa
Is there a way that I would be able to change the pitch and volume of the sound if its bouncing off a wall as opposed to line of sight? Is there a way to do that using existing 3dsound formats? I think i can figure it all out if i just know what to start with. Thanks for any help!

Posted: Thu Apr 08, 2004 1:35 am
by Mercior
I guess you could use some existing 3d sound code that adjusts volume based on distance from player, but perhaps add a few lines that do a raycast from the player to the sound origin and see if it collides with the world geometry; if it does, then do whatever adjustment to the sound.

Thats the quick hack.. the other option would to perform a raytrace-like bit of maths from the sound to the player so as to calculate the number of bounces, surface info, etc and adjust volume & pitch very realisticly but that would be rather cpu heavy for a game.

Posted: Thu Apr 08, 2004 5:29 am
by Masa
Ok, but I am also interested in non-volume attributes, such as pitch changing when an object gets farther or closer from you (the doppler effect, I believe). I know all the physics involved, i just need to know if theres already a sound format which uses physics equations. And yes, the 2nd option would be too slow for the game :cry: .

Posted: Tue Apr 13, 2004 11:26 am
by Manakel166
I think you could use OpenAl sound engine , it's an api designed like opengl but for playing sounds located and oriented in 3D SPACE