After a lot of trial and error, tutorials and trouble shooting I managed to get my first FMOD & Unity integration project working using the Space Shooter complete project from the Unity Asset Store.
The Space Shooter complete project comes with sound already in game using the Unity audio engine. The sounds are all basically one shot samples added to game objects via Unity Audio Source components. I could have just replaced each audio file with a new one of the same name, but I wanted to implement the sound with FMOD and take advantage of things like multi sound modules and pitch randomisation. This meant I had to replace the original audio assets with FMOD assets which was simply a case of adding an FMOD_StudioEventEmitter example script to a game object, then changing the relevant script (e.g WeaponController.cs for the weapon SFX) to call that FMOD_StudioEventEmitter component instead of the Audio Source Component using the following function;
I say “simply”, but a few days ago when I first opened Unity it wasn’t so obvious!
There were also a couple of cases when adding the function above to a script wasn’t necessary. In the case of the “Enemy Ship Explosion” and the “Asteroid Explosion”, I only needed to add an FMOD_StudioEventEmitter component to the relevant prefab and check the “Start event on awake” option.
For all of the synthetic sounds, I used Animoog. I’ve had Animoog for quite a while and is usually my go to synth for this kind of design. It’s has the capability to produce some pretty bizarre sounds, I particularly like modulating the path origin by the X or Y position of the path orbit.
Some other sounds used in the game include rifle shots and arrow passes from the free Firearm and Medieval Weapons Kickstarter projects (worth grabbing if you don’t already have them), and a couple of kick drum and various rock smashing sounds.
To add variation to the sounds I used a mixture of pitch randomisation and multi sound modules in FMOD on some of the layers.
- Enemy Weapon
Several layers containing pitch randomisation.
- Player Weapon
I wanted the Player Weapon to have a little less variation than the enemy weapon. To do this I created 2 versions of the top layer of the sound, then in FMOD I added both sounds to multi sound module and set the play percentage of the first to 75%. This means that for every 4 times the sound is heard, each version will be heard the following amount of times; version 1 x 3, version 2 x 1
- Enemy Explosion
2 layers, layer 1 containing pitch randomisation on an explosion sound. Layer 2 is a multi sound module with 3 synthetic explosion sounds and pitch randomisation.
- Asteroid Explosion
Various rock and explosion sounds with pitch randomisation on each.
Check out these sounds in action on my portfolio page for this project.