Metasounds - Branch or Switch like implementation from sound cues

Hello,

I am just starting to learn about meta sounds but there is one thing that I can not find the answer to anywhere. How would you implement something like “branch” or “switch” nodes from Sound Cues into metasounds?

I would like to play different wave audios based on a boolean value.

image

1 Like

I wanted to use the sounds to play engine sounds differently when inside/outside the car. It is really easy to do using sound cues but it took some effort to make in metasounds.

I do not know if this is the right way to go, but I wanted to share if someone came across this “issue” in the future.

What I ended up doing is that I’ve created a second metasound called “Audio Switcher”. You need to promote anything that you would like to use into inputs/outputs. So in my case I have 6 inputs:

  1. Default On Play input which triggers the “Trigger Select” node
  2. Integer “Sound Index” input which defines which audio to play in “Trigger Select” node (So in my case either normal (0) or interior (1) sound)
  3. & 4. are Wave Asset inputs so you can later alter which wave assets to play
  4. (Optional) Loop input to define whether to loop the wave asset or not
  5. (Optional) Stop input to allow us to trigger stop to the asset being played

and for simplicity, I used just 2 outputs which need to go into “Trigger Any” node so it always passes through no matter which (exterior / interior) sound has been played.

You can use this metasound as kind of a preset in your second metasound that you will use for playing engine sounds.

You just need to drop it there from the content browser and you should have something like this:

image

Then you can create your logic which uses the AudioSwitch created like this (This is just a very simple implementation for demonstration purposes).

Hope this will help someone since I could not find anything related to this matter. If someone has a better way of doing it, please let me know.

3 Likes

It’s really strange. Boolean switch is the basis of computing. But if someone needs it, it’s possible to cheat with the Compare trigger :