Adding Sounds & Music
Learn how to add new sounds or music to the game.
Make sure you have followed the prerequisites page to install the necessary tools before proceeding.
You should additionally use the following FMOD Studio project as a template for your project, as it references the game's master bank GUID correctly (thanks to iDeathHD for creating the template):
Download the TestHades2FModProject.zip
Some additional information regarding this template from the relevant Hell2Modding documentation:
The game currently uses FMOD Studio
2.02.23
. You can query the version by clicking checkingProperties
->Details
of the game'sfmodstudio.dll
. If your sound events correcty play (noFailed to play event
warning in the console) but nothing can be heard, make sure that the guid of the Mixer masterBus, MixerInput output and MixerMaster id match the one from the game. One known to work is the guid that can be found inside the vanilla game fileGUIDS.txt
, calledbus:/Game
. You'll want to string replace the guids in the (at minimum 2).xml
files Master, Mixer, and any Metadata/Event events files that were made before the guid setup change.
You can refer to the Hades OST for the Music Maker mod as an example of how to add music to the game using this method.
Basics
In Hades II, sounds and music are stored in .bank
files, which are then loaded into the game's audio system.
These .bank
files are stored in the Content/Audio/Desktop
folder in your Hades II installation.
Creating soundbanks
Use the template FMOD studio project linked above and add your assets to the project.
If you are adding music or sounds that should loop, select the event in FMOD Studio, right-click the timeline/preview of the event and select New Loop Region
.
This will add a new logic track on top of the event that you can use to define the looping region.
When previewing the event, the event should loop seamlessly.
Now, add your events to a new bank, this should be a unique name not used by any other bank in the game, or by another mod.
It is recommended to use the same name format as for mods, i.e. AuthorNameModName
, such as ModsNikkelMUnlockHadesMusic
to prevent clashes.
Next, build your bank by using File
-> Build
in FMOD Studio.
Add the resulting .bank
file to your mod's data
folder (which should be added to plugins_data
when your mod is installed through Thunderstore).
You will need the events' GUIDs to play them in the game, so you should also export the GUID.txt
file from FMOD Studio, through File
-> Export GUIDs...
.
You do not have to include this file in your mod, but you should have it ready as a reference.
The file will look like this:
{f0979c2d-d4d0-418e-b172-86c36619ccc3} bank:/ModsNikkelMUnlockHadesMusic
{57fbe830-4207-4601-8ca1-cd69eebfa742} event:/Mods/NikkelMUnlockHadesMusic/DeathAndI
{b0533fd9-9980-4fc6-b0a7-23813f2cda1c} event:/Mods/NikkelMUnlockHadesMusic/FieldOfSouls
{1d2d987b-853b-4a65-aa2d-a3e8c7e0e99b} event:/Mods/NikkelMUnlockHadesMusic/FinalExpense
...
You will need the GUIDs for the events (the bank GUID is irrelevant) later on when you want to play the events in the game. It is recommended to create some sort of mapping of GUIDs to event names within your mod, to make your mod more maintainable and readable by others.
Load and play sounds in the game
In your mod, you must load the soundbank before you can play any events from it, using rom.audio.load_bank(path)
, e.g.:
-- Loads the sound bank when entering the Crossroads or switching between rooms in the Crossroads
modutil.mod.Path.Wrap("DeathAreaRoomTransition", function(base, source, args)
rom.audio.load_bank(rom.path.combine(_PLUGIN.plugins_data_mod_folder_path, "Audio\\ModsNikkelMUnlockHadesMusic.bank"))
base(source, args)
end)
_PLUGIN.plugins_data_mod_folder_path
automatically resolves to your mod's plugins_data
folder, which should contain your .bank
file.
After loading your bank, you can play events using their GUIDs in the following format {GUID}
, e.g.:
local trackName = "{57fbe830-4207-4601-8ca1-cd69eebfa742}"
PlaySound({ Name = trackName })
You can get the GUID for an event from the exported GUIDs.txt
file.
Make sure to include the curly braces {}
around the GUID, as this is how the game recognizes the GUID as a GUID instead of a name.
It is important to note that you cannot play events by their name for custom soundbanks, only by their GUID. This is a restriction imposed by the way FMOD's master bank works.