Finally got this done :). Here is the post about the Box audio bounds for Fmod mentioned above:
I didn’t know if anyone might need this or not, but as mentioned above, I was able to get a a box audio bounds working for Fmod, and if anyone else is struggling with making a box bounds with a Minimum bounds inside of it, for audio or anything else, I thought I could share what I got working to help out. It’s one of those things that doesn’t look like much when you’ve figured all of it out, but takes a lot of work to think through and get working.
So here are some images and a little explanation of how it works.
First, here is the image again of the Box inside of the world with a large box that is the Maximum bounds of the audio, or the farthest the audio reaches, and the smaller box being the Minimum bounds, or the point where the audio would be at full volume and envelope the player:
The first thing to do was to get the player’s position, so we know where the player is in relation to the box, and convert it into the Box’s local transform. You’ll understand why in the image after this, but this was an important thing that was a little tricky to figure out. Basically I just created an arrow in the blueprint with the Box bounds, then each frame that arrow’s position gets set to the player’s position in world space. Then when you access that arrow’s local position, you know have the player’s position, but in the Box’s Local space. Here the nodes that did that:
Now to use that, here is an image that shows the full node network that calculates how far into the Max bounds the player is, and how close they are to the Min Bounds. This is where putting the player’s position into the box’s Local space is used. It’s much easier to see it node by node then trying to explain it all verbally, so there are explanations on each node that describe how it works. You may have to open it in a new tab in order to see the them.
To summarize what it does, it determines how close the player is to the Minimum bounds on each axis of the box, then outputs a value between 0 and 1, with 0 being when the player is at the edge of the Maximum bounds and 1 being when the player is at the edge of the Minimum bounds:
Then to use that, you can just hook it up to an Fmod “Set Parameter” function, one for the audio volume and another one for the audio envelope amount, and also clamp the player position value from before between 0 and 1:
Then in Fmod, you just set up two parameters on your sound, one on the master volume, going from 0 to 1, equaling -00 to 0:
and another on the Minimum Extent knob of the attenuation setting, going from 0 to 1, equaling 0 to 360 degrees. The button above should be set to User instead of Auto, too:
A couple more things to do is, since we’re using a custom envelope calculation that gets applied to the Min Extent parameter, we need to set the Fmod Sound Size to 0 when the player enters the box:
This keeps Fmod from calculating how much the sound envelopes the player, and let’s us use our own calculations with the Min Extent.
Here is the parameter in Fmod:
The curve looks a bit strange because Fmod does some strange things with all the values on the graph, so in order to get a linear value where setting the parameter to say 400 in Unreal, equals 400 in Fmod, you have to have the line curved like that.
The other last thing to do is to set the normal Fmod Sphere bounds to be bigger than the Box bounds, pictured in this image:
This will make Fmod know that the player is inside of the sound and to play the sound through the speakers.
So altogether, the player enters the Box volume and the Fmod Sphere volume, then the envelope values and attenuation, or volume, get controlled by custom calculations instead of Fmod’s calculations.
That should be everything. The box should now work as an audio bounds, with the volume and envelope amount working the same as if it was one of Fmod’s normal Sphere audio bounds.