Skip to content

Instantly share code, notes, and snippets.

@brianisbrilliant
Last active January 8, 2024 23:02
Show Gist options
  • Save brianisbrilliant/b9a15cb337bbb82208a18a5220611b6d to your computer and use it in GitHub Desktop.
Save brianisbrilliant/b9a15cb337bbb82208a18a5220611b6d to your computer and use it in GitHub Desktop.
Setting up FMOD for Game Design 2

Downloading and installing things

  • I've downloaded FMOD 2.02.20 for Unreal 5.2 and added it to my Game2Start Unreal project.
  • I am following the FMOD for Unreal User Guide.
  • I had to sign up for an account with FMOD to get access to the downloads for the plugin and FMOD Studio.
  • I also downloaded FMOD Studio 2.02.20 for Windows (x64).
  • FMOD will be installed in the project directory so that anyone who downloads the project will have the integration.
  • I need to openFMOD Studio and create a sound bank, which will be exported to "Content/FMOD"
  • I found an error in the Project Settings related to FMOD: 294286196-20bcdb64-69c6-417f-b808-e57f7e10072e and the details for this error are in the User Guide.

Building an FMOD Project

  • I have installed FMOD Studio 2.02.20 and started a new project. I am going to follow the Quick Start Guide.
  • The FMOD project goes in your documents or somewhere else. Then it is built to a Bank, which goes in the Content folder of your Unreal Project.
  • I used Windows Sound Recorder to record 3 sounds. I could've used the example assets, but where's the fun in that?
  • When you add all three to the Event's Timeline, the new Audio Track's Multi Instrument area.... when you hit play, FMOD randomly plays one of the audio clips.
  • I created two parameters, one for Gun Type, and one for Pitch Shift because that's what the tutorial is going to do for me. I thought that Gun Type would be a good way to select from the different sounds based on the gun that was currently selected.
  • Added pitch shift to the track.
  • Added the Event to the Master Bank.

Getting the sound into Unreal Engine

  • I fixed the error that the screenshot asked me to fix and that went well. Then I went (in Unreal) to Help > Validate FMOD and that worked fine too. image
  • In FMOD I went to Edit > Preferences > Build > Built banks output directory (optional): > and changed that to my Unreal/Content/FMOD folder.

Playing the sounds in Unreal Engine

  • Let's drag our event into a new scene called FMOD_Testbed.
  • Alright, if I hit play one of the three sounds will play automatically and not repeat.
  • I can select the event in the Outliner and change the parameter "PitchShift". There are also buttons for "Play, Stop, and Details", as well as attenuation and occlusion details. Occlusion based on visibility doesn't seem to work.
  • Happy to discover that Event Play At Location will overlap sounds. Here's a screenshot of the Level Blueprint I have set up so far. image
  • I'm happy to know that changing the pitch doesn't affect sounds that are currently playing. If I play a sound at 0.1 pitchshift and then immediately play a sound at .9 pitchshift, they'll both play at the pitch that I requested, instead of both playing at 0.9 pitch.

Building the game

  • welp, it packages successfully, after 30 minutes, but it won't run because of this error: Plugin 'FMODStudio' failed to load because module 'FMODStudio' could not be found. Please ensure the plugin is properly installed, otherwise consider disabling the plugin for this project.
  • Possible fixes might include adding an empty C++ class, removing the FMOD Studio Niagara plugin folders, and packaging it again.
  • Alright, so the fix was to go to Edit > Plugins > Installed > Audio > Uncheck FMOD Studio Niagara Integration

Terrain footsteps

  • I am following this tutorial with a few alterations.
  • Editing the animation BP causes the walk and run animations to not work correctly.
  • Specifically, it's the Event Blueprint Initialize Animation node that breaks everything. I need it to get access to the character.
  • Since ABP_Quinn is a child class of ABP_Manny, I am going to try to put the logic there.
  • I'm making a Labeled parameter in FMOD Studio for the terrain.
  • SUCCESS! I don't know why I needed to make my own AnimNotify track for the animations (walk and run) but when I did that it worked like I expected.

Opening the project on a different computer

  • All of my students and David's students will be downloading this project. The .gitignore is not saving all of the plugin, so they'll have to copy the files over again (or I'll have to get git to not ignore those files)
  • I will simply have to include a copy of the plugin for everyone to install to the correct folder.

More terrain footsteps

  • There is a default phys material type, and everything has it even if it isn't selected on purpose.
  • 3D spatial audio attenuation isn't enabled by default. When I turned on the default steps, my AI's steps in the other room were blasting!
  • The solution is in FMOD: Select your Footstep event > Select your Audio Track > Right Click > Add Effects > FMOD Spatializer. Default settings here are fine. Save the project and build the project to Unreal Engine.
  • Oh! By default I was using the location of the line trace hit, but it was putting all of my sounds at world origin (0, 0, 0). I fixed that by going to the Play Event Attached node in ABP_Manny and changing the Location Type to Keep World Position.
  • image
  • Audio at this point needs to be in Mono (to avoid the weird phase that I'm hearing) and also needs to be quieter. I'm not sure where is best to attach that. Doppler needs to be taken off of the step sound, it doesn't sound right when I whip the camera around.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment