Modding: Audio

From Noita Wiki
Jump to navigation Jump to search
Modding Navigation
Fundamentals
BasicsData.wakGetting startedLua ScriptingUseful Tools
Guides
AudioEnemiesEnvironments (Fog of War) • Image EmittersMaterialsPerksSpecial BehaviorsSpellsSpritesheetsSteam WorkshopUsing CMake
Components/Entities
Component DocumentationEnumsList of all tagsSpecial TagsTags SystemUpdate Order
Lua Scripting
Lua APIUtility Scripts
Other Information
Enemy Information TableMagic NumbersSound EventsSpell IDsPerk IDsMaterial IDs

This page explains how to: Extract the default audio files; how to Replace the default audio files with your own sounds; and how to Add additional custom audio files.

Extracting existing audio

The .wav audio files are compressed in 20+ .bank files within the folder Steam\steamapps\common\Noita\data\audio\Desktop\.

  1. Download & extract "Fmod bank tools.zip" (Join the Noita Discord and download it from this Discord thread)
  2. Find any bank you'd like to extract (e.g. event_cues.bank) and copy paste it into the bank folder of the zip you extracted.
  3. Run the Fmod Bank Tools.exe and set your Bank Source Folder to the path of the bank folder (full path, C:/.../bank) and the Wav Destination Folder to the path of the wav folder (full path again). Both of these folders should be in the extracted zip folder.
  4. Click the Extract button in the tool to get all of the audio files in the bank.
    • Now you can create music using the game sounds!

Replacing existing audio

There are two methods of doing so:

  1. By replacing the *.wav files inside the *.bank files using the Fmod bank tools and (temporarily while your mod is loaded) overwriting the original *.bank file by placing your modified one in the same path as the one you want to replace, for instance mods/yourmod/data/audio/Desktop/animals.bank. This method has two drawbacks, first of all it will not allow you to change the length of the sound event, which means if the original sound is 1 second long and yours is 3 seconds, your audio will cut off after 1 second and additionally any effects that the original sound has will also be applied to yours. And second of all, it is not compatible with other mods who want to replace sounds from the same bank file, since only one mod can overwrite the file at a time.
    • To do this anyway, follow the steps on how to extract existing audio, then replace any .wav files you want, edit the bankname.txt in the wav folder to have the correct names of your sounds and then in the Fmod Bank Tools.exe click Rebuild. If you get any errors, you can simply Ok through them until its finished.
    • Get in-game and test (keep in mind this is mainly for replacing rather than adding, as you can do that with FMOD Studio instead with much more features).
    • NOTE: Because this replaces the bank, you cannot have multiple sound replacing mods!
  2. By tricking the game into using your sound event instead of the original one. This can be done by creating your own *.bank file and replacing your sound's GUIDs inside your *.bank file with the ones of the sounds you want to replace. GUIDs of the original sounds can be found here: https://noita.wiki.gg/wiki/Modding:_List_of_Sounds. For this method, create your own sounds and one extra sound, which you could call dummy_sound. Then build your *.bank file and export GUIDs.txt, open it and note the GUIDs of your sounds events. Then use https://github.com/TheHorscht/FmodBankGUIDReplacer to replace the GUIDs inside your *.bank file with the ones of the sounds you want to replace (don't replace the GUID of your dummy sound though!). After that, place your *.bank file in your mod folder and in your init.lua call GamePlaySound("mods/your_mod/audio/your_audio.bank", "dummy_sound", 0, 0). This has to run before the sound plays that you want replaced. If you have done everything correctly, the sounds should now be replaced.

Example for how to use the replacer tool of the second method: Let's say you have these in your GUIDs.txt:

... other stuff
{f7bc4133-a97d-487e-a7a9-b28303f90ffb} event:/boop
{c7d655d8-ec85-4d25-bc91-cf2cca64fbb7} event:/dummy_sound
... more stuff

and you want to replace the sound that plays after a short while when you die, event_cues/game_over_stats/create, which has the GUID {3c831728-2d37-4b80-bc78-b4d069164ebc}. You would use the FmodBankGUIDReplacer tool like this:

guid_replacer.exe your_audio.bank {f7bc4133-a97d-487e-a7a9-b28303f90ffb} {3c831728-2d37-4b80-bc78-b4d069164ebc}

Do not replace the GUID of your dummy sound!

Creating custom audio for Noita

Noita uses FMOD Studio as its sound effects engine, using version 2.01.05. The basic principle is defining FMOD "bank" files consisting of all the sound effects and attaching individual events for each sound. These events are then referenced in the XML / Lua, which play the correct sound effect.

Check out the following directories to get started:

  • Noita/tools_modding/noita-fmod-project/
  • Noita/mods/example/

Setup

  1. Make sure you have the noita-fmod-project folder in your Noita directory.
  2. Install FMOD Studio version 2.01.05 from the official FMOD website.

FMOD

  1. Open noita-mods.fspro in FMOD Studio, you should see an snd_mod folder which contains an example create event. In Noita, there are many different events, but for now, keep in mind create and loop, as those are the most common.
  2. Clicking the create event in snd_mod will show you the example sound worm_attack_bite_01 which is in Async mode, has Randomization Automation for its pitch, and has Distance and lowpass parameters which can allow for effects in-game such as volume fading.
  3. Noita also has many Routing Groups which add effects to your audio such as reverb and equalization, to access these you'll need to go to the Window options and then Mixer, where you can move your sounds into their respective groups, such as game_sfx which houses snd_mod/create, this group is what you'll likely use the most.
  4. Once you've decided to make a sound in an event, you'll need to add it to a Bank so that Noita can use it as part of its assets. To do this, simply right click the event, go to Assign to Bank and click the bank you're going to use (preferably something besides Master Bank).
  5. After all of the above, you can finally Build your FMOD project by going to File options and doing Build.
  6. We're not done yet, as Noita still doesn't know how to access the events in your bank, so you'll need to go back to File options, and then to Export GUIDs. This will be what you load in your init.lua script so that Noita has the references to your bank's sounds.

Noita

  1. Go into noita-fmod-project/Build and copy and paste the GUIDs.txt into your mod's directory.
  2. Go into noita-fmod-project/Build/Desktop and copy and paste the bankname.bank file (ignore Master Bank) you created in FMOD into your mod's directory.
  3. Open your mod's init.lua file and add
    ModRegisterAudioEventMappings("mods/modname/directory/to/GUIDs.txt")
    
    with the path to your GUIDs.txt file.
  4. Open any xml files which you want to add your sounds to and add the respective AudioComponent or AudioLoopComponent depending on the type of event you created in FMOD. An example AudioComponent for a projectile might look like this:
    <AudioComponent
        file="mods/modname/directory/to/bankname.snd"  <!-- .bank is replaced with .snd -->
        event_root="foldername/eventname"              <!-- in fmod you created an event *folder* which had either a *create* or *loop* event -->
        set_latest_event_position="1"
    ></AudioComponent>
    
  5. Get in-game and experience success!

List of all default sound effects

See: Modding: List of Sounds (Currently incomplete)