# Simulating sound across multiple rooms

**URL:** <https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738>\
**Category:** FMOD Studio\
**Tags:** cpp\
**Created:** [September 30, 2021, 10:19pm UTC](https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738 "2021-09-30T22:19:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![danitabaires](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/danitabaires/32/667_2.png) [@danitabaires](https://qa.fmod.com/u/danitabaires)\
**Post date:** [September 30, 2021, 10:19pm UTC](https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738/1 "2021-09-30T22:19:04Z")

</div>

Suppose we have the following room layout, where we have rooms A, B, C, and D, separated between them with doors.

![2021-09-30 19.02.19](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/5/56418d053b81c8c909cbbe29a51c230376802036.gif)

Let’s assume I have emitters on every room and they are assigned to a separate bus for every room. The listener is able to move between rooms, and I’m able to know where she is. To simulate what she should hear, I could implement mixer snapshots “inside\_a”, “inside\_b”, and so on, that will activate when she enters the corresponding room. So when the listener is “inside\_b”, I could modulate the sound coming from A, C, and D, depending on the state of the doors.

So far so good. But what happens if the listener is, for example, “inside\_a”? I can modulate the sound “coming from” B, but that sound not only must integrate also the emitters on C and D, but honoring the state of the doors too.

You can see that the combinations are many and I can’t find a good way to simulate this that works on the 100% of cases, without using occlusion, which let’s say I can’t do for the moment as I have no access to the backend. I only get the data “inside where” and “door state” as parameters in Studio.

Any ideas?

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [September 30, 2021, 10:54pm UTC](https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738/2 "2021-09-30T22:54:38Z")

</div>

Indeed, that seems tricky to implement within fmod studio, though that would only take a few lines of code… I think the best idea is to beg the developer to implement the logic in the game code 😃

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [September 30, 2021, 11:17pm UTC](https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738/3 "2021-09-30T23:17:15Z")

</div>

I just had an idea, though. Use multiple sends between busses, to mimic the real geography. Send some A in B and some B in A, and so on for each pair of consecutive rooms. Automate those sends with snapshots related to door state: if A/B door is closed, less A goes into B (and conversely). In top of that, use another set of snapshots for the “inside where”, controlling bus volume.  
That could maybe cause feedback of phasing issues, I don’t know. You’ll have to try!

---

<div class="post-metadata">

**Author:** ![ptrefall](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ptrefall/32/2672_2.png) [@ptrefall](https://qa.fmod.com/u/ptrefall)\
**Post date:** [October 1, 2021, 7:42am UTC](https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738/4 "2021-10-01T07:42:11Z")

</div>

[Steam Audio](https://valvesoftware.github.io/steam-audio/) might be the answer for this kind of thing if you’re using Unity. Sadly no support for Steam Audio with FMOD if you’re using Unreal.

I built a custom audio propagation solution in Unreal using A\* pathfinding and special rules of propagation through _portals_ and _rooms_, which is a fancy way of saying I added overlap volumes into the scene and hooked those into an A\* pathfinder, where I look up the _room_ the sound emitter is in, and the _room_ the listener is in, and then find multiple paths to the listener. This way the sound can come through a window to your left and the closed door in front of you at the same time, and how the sound bends through portals, how far it travels to reach the listener and what type of portals it travels through affect the occlusion that is applied to the sound, its volume, its spread and its direction. Not trivial to implement, and lots of little corner cases 😅 Wish I had the option to use Steam Audio instead!

---

<div class="post-metadata">

**Author:** ![danitabaires](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/danitabaires/32/667_2.png) [@danitabaires](https://qa.fmod.com/u/danitabaires)\
**Post date:** [October 1, 2021, 3:00pm UTC](https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738/5 "2021-10-01T15:00:27Z")

</div>

Thanks @Alcibiade @ptrefall ! This gave me some ideas. Maybe in the future I could use Steam Audio, but for now, I ended up implementing the door logic in a scripting language that sits between my backend and the parameters I receive, so now for each “inside\_space” snapshot, I get several parameter that tell me what the volume from each other space is supposed to be, and I modulate the busses based on that. For this case it works, but is a bit messy to implement (not as much the sends maze though 😛 )

---

<div class="post-metadata">

**Author:** ![Panagiotis\_Kouvelis](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/panagiotis_kouvelis/32/74_2.png) [@Panagiotis\_Kouvelis](https://qa.fmod.com/u/Panagiotis_Kouvelis)\
**Post date:** [October 5, 2021, 3:32pm UTC](https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738/6 "2021-10-05T15:32:08Z")

</div>

This is what I was thinking to answer. We implemented this in one game and it went very well. Cheers!

---

<div class="post-metadata">

**Author:** ![Gianni](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/gianni/32/840_2.png) [@Gianni](https://qa.fmod.com/u/Gianni)\
**Post date:** [October 11, 2021, 7:36am UTC](https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738/7 "2021-10-11T07:36:46Z")

</div>

I managed in the past this situation in a lecture on FMOD + Unity without using occlusion  
I used:

- a single label parameter describing in which room the player is
- a mixer bus (group) for every room to route all the 3d ambience emitters placed in that room
- emitter placed behind every door (this means that you need two emitters for every door) that contains a transceiver set to receive ambience from the proper room group (the room where receiver is)

You need the parameter to mute/filter room sounds when you leave that room, muting door transceiver that are in the same room you are  
The trainsceiver gives you the propagation simulation through the door (you can use groups to route every room sources into proper receiver)

Next step is to simulate occlusion through doors using code logic (script) that filter the receiver for every door emitter

It could sound complicated but it is not and it works!

---

<div class="post-metadata">

**Author:** ![danitabaires](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/danitabaires/32/667_2.png) [@danitabaires](https://qa.fmod.com/u/danitabaires)\
**Post date:** [October 11, 2021, 10:53am UTC](https://qa.fmod.com/t/simulating-sound-across-multiple-rooms/17738/8 "2021-10-11T10:53:18Z")

</div>

Thank you @Gianni , that’s exactly what I ended up doing. Works good enough for now 🙂
