Sound Attenuation to block sound by walls?

I cant figure out how I can set up the attenuation to block the sound to go through walls.

Not sure if this is what you are looking for: Sound Attenuation | Unreal Engine Documentation

But I did a search on the Learn tab in the Launcher. Helps me a bunch since it references UE4 Docs/wiki first before going out to the world of Google (although it is a Google search itself)

No does not help me. I have read the docs. The box shape would be good, only that my room is not symmetrical and the sound is not in the middle. Also when I open/close the door I want to affect the sound.

Perform a line trace towards the player, if it is able to reach him then play the sound, otherwise do nothing.

There is an example up on the marketplace. There is nothing built into the engine directly to achieve this since there will be so many factors that apply to it it’s very hard to achieve accurately, you will need to do something with some blueprints like VRLtqq said, but you shouldn’t be stopping the sound entirely you should be reducing it based on the physical material of the wall, the opening size, the location of the player, rotation of the player, etc etc.

There is no way to realistically do this. Let’s say you had a wall that is 10 feet deep, how would you detect it’s depth? You really wouldn’t be able to check this using line traces, you wouldn’t really be able to check how much each wall should muffle the sound, you wouldn’t be able to realistically have the sound still reach you if a string is blocking the sound, and the trace detects that there is an object (the string) in front of you. Unfortunately we are unable to realistically do things with water, sound, light, etc… yet :confused: You could still follow the above suggestions, but for the precision you want, I’m not so sure.

It all appears to be doable. You can find thickness of a wall by a series of small traces, how much muffling it should add can be determined by physics material that it has applied, a string or a rope can have a physics material that has zero sound blocking associated with it or be on a different trace channel so it wouldn’t even be hit by our trace. It all wouldn’t be 100% precise but nothing is in games, it is just close enough approximation.

When I was talking about the string, I mean what if you had a very small wall that was thin like a string, you’d have to perform traces every frame to see if there are things to the side of the wall, as blocking based on what is directly between the player and the sound would be very unrealistic and would produce some very odd results.

It is definitely possible to achieve, just fairly complex and time consuming. I would probably go with something like Fmod which will do 90% of what you want, may just need some tweaks with some physical material properties.

This is interesting, never heard of FMOD before, thank you. Do you know by any chance if it can create realistic echoing effect? To clarify, I do not mean a reverb effect buf full fledged echo that occurs in the mountains or at forest lakes for example.

Highly unlikely. Echoing is very complicated to get correct and would definitely require knowledge of what each of the materials are on all of the objects, faking it would be the way to go.

I’m also interested by sound occlusion/obstruction features and I would like to see that like a standard for game sound in 2015!

This user has started to do something interesting and this is surely the way to go: https://www.youtube.com/channel/UC2Daa6b_VMdRNr4mY8dPx-A/videos

Something that work with trace and physical materials but only coders can help us to do that

Edit: another interesting link about how it has been done with other engine:

http://docs.cryengine.com/pages/viewpage.action?pageId=18384659
https://vimeo.com/62937394

An idea, create a component that at some point of initialization (begin play?) calculates the thickness of the collision component containing it. Give all your sound isolating walls this component. Then as suggest above, when you do the multi-line traces get this component while iterating the hit result and do your calculations.

For precision you probably want this component to contain at least 2 thickness value (width and length) depending on its shape. Using the normal result from the trace you can choose which thickness value to read from. You can also add a scalar value to represent the material to adjust how “isolative” (I don’t know the word to describe it…) it is.

This is really the best answer IMO, run a line-trace, if it is within a certain distance and can reach with no interference, allow the sound to be played.

The best idea i came up with by reading this is, to do a line trace get the phys materials and use the phys material enum to change the sound. you could do this to take into account the 2 biggest influencers. then use the nav mesh to see if its reachable. if not that would usually mean theres a closed door. then use that as another influencer. if the sound is greater in z but close to your x,y add reverb, if its lower in z but close to your x,y adjust the pitch? oh also you could use the line trace to only collide with objects tagged with enclosing wall. so that every little object doesnt factor in