[TUTORIAL] Simple way to change Global Audio Volume

Genova
Thu, 04 May 2017 06:22:08 +0000
Audio

This post is not a question, but rather a mini tutorial on how to change the game audio volume.
Thought it was worth sharing it for anyone struggling with it (like myself) since there doesn’t seem to be a solution posted on answerhub or the forum, aside doing it in C++ or using Rama’s plugin.

It’s actually rather simple

1. Create a new Sound Mix asset (leave the default settings)

2. In your Game Instance Blueprint (should work in any BP, but since the GameInstance is persistent, it’s the best candidate for the job), do the following script :

Set base sound mix : select the newly create Sound Mix Asset to activate it for the entire session.

Set Sound Mix Class Override : Set the Sound Mix and the Sound Class (there are multiple ones, Master is the parent of the other classes). Set the Fade in Time to 0 if you want the change to be immediate.

Some notes :

The delay after the Event Init is a bit dirty but mandatory as it won’t work otherwise. I suspect it happens too quickly and some audio components have yet to be fully loaded.

In the Set Sound Mix Class Override, if the volume is set to zero, any active sounds will be stopped, hence the clamp min 0.01 (there might be a way to prevent this behavior, but I haven’t thoroughly looked at it yet)

Now, every time you want to change the volume, just execute the event Change Volume with the new value.

15 posts - 12 participants