FMOD UE4 Changing audio on the same time, how to lower the BGM when SFX playing and using FMOD on C++ UE4

Hello there everyone on FMOD communities.
First time here and FMOD really helps me but anyways I got two questions to ask.

First question :-
I got two audio (which is a SFX), one is normal and the other one is distorted. What I wanted to do is that when you are playing the music box (it will play the normal one) but when there’s a monster coming to the music box (on distance) it will change the audio to the distorted version but on real time. Meaning if the normal one is playing at for example (10 seconds) and the monster is coming to the distance of the player, the distorted version will be started to play on the (11 seconds). And also the volume become more higher as the monster coming close to the music box.

Second question :-
How do you make a BGM that plays on the background and change volume for example the value of 1 to 0.5 when you are using a music box which is a SFX. And change back the volume when not using the music box.

Third question :-
Anyone knows where and how to use FMOD to play a certain event based on parameter set in FMOD studio on UE4 C++?

Thank you very much in advance.

This souns like it can be solved by using a Snapshot in Studio.
A snapshot is an instanceable unit of changes to the project mix that can be triggered, controlled, and stopped from game code. Each snapshot represents a different way your game’s mix can change in response to the circumstances in your game as it runs.
https://fmod.com/resources/documentation-studio?page=glossary.html#snapshot

For example: Your music is playing as normal, then a monster starts to approach the player. This could trigger the distorted sound to start and also trigger the Snapshot to start. As the monster gets closer to the player, you can increase the snapshots intensity which will decrease the volume of the normal music and increase the volume of the distorted sound.
https://fmod.com/resources/documentation-studio?page=mixing.html#triggering-snapshots

I’m not sure what you mean by ‘play a certain event based on parameter’. An event has parameters, in Studio you can setup multiple sounds in a single event and switch between them using transitions and parameters. Then in game you would set the parameter value to play the sound required.
https://fmod.com/resources/documentation-api?page=content/generated/engine_ue4/programming.html#/

1 Like

But how do you change the distance between monster and player. As i wanted the sohrce of sound from the player but the distoetion will only start if the monster is coming near the player. Sorry I replied late.

Snapshots can have parameters, and these parameters can be updated from your game’s code just as the parameters of an event can be. Snapshot parameters can be used to automate the properties scoped into the snapshot, as well as the snapshot’s intensity.

Alternatively, you could trigger the snapshot by using a snapshot instrument in the monster event, and automate the snapshot instrument’s intensity on the monster event’s distance parameter. This method is less flexible and customizable than the above, but is much easier to implement.

1 Like

Alright ladies and gentleman’s. I managed to do it. This task was delayed as I was doing other task, that’s why I’m late reply. My bad.

Here’s how I did my stuff if anyone wants to use it as reference.
(As I cannot upload pics I share it using drive links.)

(1) So first was setting up the FMOD Studio. I use 2 audio which contains Normal Music Box and Distorted version Music Box on the same events.
https://drive.google.com/open?id=1nqK3m9m_fynVEsFw3pCCILOzsdPwRpKc
I used compressor and sidechain to transition the main BGM to lower the volume as the music box is playing.

(2) Next was setting parameter, I use a custom parameter in which the normal music box is being played first and will lerp to distorted version as its getting closer to the monster.
https://drive.google.com/open?id=1nrWOPybUWqXwA-8YfgxlqVHxOjMFYmPV

(3) Then build the events for UE4. I put a notify when to play the music box on the anim event notify on its animation timeline.
https://drive.google.com/open?id=14BlUEXPcXFyI6HOQKR4lD8vTsD-iUbAZ

(4) Then use the anim notify from the animation timeline to call the function of PlayMusicBox inside the Animation Blueprint as you cannot call anim notify inside Blueprints.
https://drive.google.com/open?id=1CpYBrdhVxD10YuhC35z-YTtq1_ms4kAY

(5) Then inside the blueprint music box I have a event begin play in which will call the monster on game instance to play event attached to ask is it valid while returning a value for the audiocomp.
https://drive.google.com/open?id=1-hn1JxbdE1aXICUXVlG8yiHkBELX_Ckr

(6) From the update state there’s powered on and powered off. This is what my team set for the animation state when it’s called. When powered off it will set the state for music box to pause as well.
https://drive.google.com/open?id=16hqCIUWtBGn8RpA07nw3qx_xFpY2TgtD

(7) This is the event tick to check the monster distance so that the parameter can be played from to the UE4.
https://drive.google.com/open?id=1dxaSLaKgj19DpCI2xZAYmJM8Fh7DoOyZ

(8) The PlayMusicBox function.
https://drive.google.com/file/d/10nJy9ivHBDIbaTUf5DC81K4cryZv1qY0/view?usp=sharing

(9) This is the update music box distance event to check whether we are closed to the monster and set to lerp to distort music from normal one.
https://drive.google.com/open?id=12J8X99x_Fy0-mP2Rn7xytiOtw9NIrMce

(10) Here’s where I set my variable.
https://drive.google.com/open?id=1hiMj7JTNINSE7qlZIICVea7X-Z_w_Z1d

If there’s no pics anyone that interested can message me, I can help :smiley:
Also thank you to the people who helped me before on giving tips about using snapshots.

1 Like