Comment on page

Using Custom Sounds

Difficulty: 5/10

Installing Wwise

Custom sounds can pose a significant challenge at first, but become progressively easier with practice.
  1. 1.
    Download the Wwise launcher from the link below. This will require making an Audiokinetic account.
2. Inside of the Wwise launcher, install Wwise version 2017.2.10. This is the necessary version, as it is the only one compatible with Enter the Gungeon.

Preparing Your Mod

You will need to prepare your mod to be able to see and load 'sound banks', bundled collections of audio files created by Wwise.
  1. 1.
    Add this static variable to your main module class, outside of any method.
public static <your modules class> instance;
2. Add the following code in the Start() method of your main module to set the variables you just created.
instance = this;
now we can move on to the code part
now you want to drop these classes into your project.
AudioResourceLoader.cs
782B
Text
resourceLoaderSoundbanks.cs
5KB
Text
make sure to replace namespaces and class names appropriately.
When you create a soundbank in wwise it will have a name, so to load it you will want to do this in your module:
do this version if you want to load from a folder:
AudioResourceLoader.loadFromFolder("mod name");
and do this if you want to load it from your dll as an embedded resource: AudioResourceLoader.loadFromAssembly("<bank name>.bnk", "mod name");

Using Wwise

first things first make sure you have wwise v. 2017.2.10. open up wwise and select new
Name it whatever you want
you should now see something like this
at Default Work Unit right-click and select > Import Audio Files
Make sure import mode and import as is the same as this
now just drag in any sound files you have into that window, (must be a .wav file), then select import
now if you expand Default Work unit you should see your sound files.
Now, we want to make our audio affected by the in-game audio settings, so first, you want to select Game Sync in the top left.
Then Right-Click Default Work Unit under the GameParameters folder, select new child, then Game Parameter
name it VOL_SFX
then do it another time but name it VOL_MUS
and then do it one more time but name it VOL_UI
now you select your audio file back in the Audio tab, and this should show up
select RTPC at the top
then, at the bottom select the little 3 arrows
and press voice volume at the bottom
then, select the second arrows
select VOL_SFX if you want it to get affected by sound volume,
select VOL_MUS if you want it to get affected by music volume,
or select VOL_UI if you want it to get affected by ui volume.
do this for any audio files you have.
now back in the audio tab we right-click our sound and select New Event > Play
In the bottom Left event viewer, you should now see Play_YourFileName
do this for all of your audio files.
now at the top, we need to go to Layouts and select SoundBank
you should now see this
Press New
And name it whatever you want
click ok.
if you expand Default Work Unit you should see your Soundbank.
now select your soundbank and look at the SoundBank editor at the bottom.
now drag in all the event from your event viewer into the soundbank editor, they should show up
now check these buttons in the soundbank manager
enable your soundbank
now select generate and drag your soundbank into your mod folder
it should now work.
if you don't know where it generated you can check/change it in user settings
Check Override sound banks if you want to change it
to play your sound effect simply in code type
AkSoundEngine.PostEvent("The_Event_For_The_sound", whateverGamobjectShouldPlayIt);
the event in my example was Play_Bonk.