- This line was added.
- This line was removed.
- Formatting was changed.
By the end of Chapter 01, we'd succeeded in creating a very basic ambience for our Chinese Garden, before moving on to add sound effects/foley to the gunfire and footsteps of the first-person character.
This chapter sees us visiting the campfire situated at the center of the map, to add looping audio to the fire particle along with a realistic attenuation. The audio files we'll be using are included in the chapter_03 folder of your chosen middleware implementation, located within the Audio Showcase assets' installation directory.
Go ahead and listen to them!
FMOD Video Tutorial
The FMOD workflow of this chapter is also covered in the following video:
Widget Connector url https://www.youtube.com/watch?v=9qUtvEwRk0A&feature=youtu.be
Adding a Loop to The Fire Particle
The audio files that we'll be using to create a looping audio effect for the campfire, are stored in the _Audio_Assets/FMod Studio/chapter_03/ folder of your Audio Showcase assets' installation directory as l_global_particle_fire_01.wav, l_global_particle_fire_02.wav, l_global_particle_fire_03.wav, l_global_particle_fire_04.wav and l_global_particle_fire_05.wav.
Create a new folder in the Audio Bin and Event tab of your FMOD project called Particle, and drag/drop the five audio files into them to create a new 3D multi-instrument Event. Name it l_global_particle_fire.
Select the l_global_particle_fire Event and click on the Multi-instrument timeline at the center of the screen; you should see the following playlist of audio assets that make up the Event in the bottom panel.
Click the button to have the audio files play in a loop when the Event is triggered. To make sure the Event loops properly, activate the Async option; this ensures that the audio assets play in their entirety once triggered, especially if they aren't of the same length. You'll notice the waveforms of all five audio assets are stretched to fit the time scale on the multi-instrument; this is just a visual change as the assets sound exactly the same as before.
We then need to create a Loop Region to specify the area of the Multi-instrument that needs to be looped. Since we'd like for the entire Multi-Instrument's timeline to loop:
Finally, add this l_global_particle_fire Event to a new Bank called Particle, before rebuilding all SoundBanks by pressing the F7 key. Switch back to the ACE and create a new Library called Particle in the Audio System Controls panel.
The audio files that we'll be using to create a looping audio effect for the campfire are stored in the _Audio_Assets/Wwise/chapter_03/ folder of your Audio Showcase assets' installation directory as l_global_particle_fire_01.wav, l_global_particle_fire_02.wav, l_global_particle_fire_03.wav, l_global_particle_fire_04.wav and l_global_particle_fire_05.wav.
Begin by creating a new Actor-Mixer called Particle in the Default Work Unit of the Actor-Mixer Hierarchy, a new Particle folder in the Events tab, and a new Particle SoundBank in Wwise. Then drag and drop all assets from the _Audio_Assets/Wwise/chapter_03/ folder into a new Random Container within the Particle Actor-Mixer, and name the Container l_global_particle_fire.
The goal is to create a looping fire particle that plays random audio files on each loop for maximum variety. To do this, a parent Random Container needs to created for our current l_global_particle_fire Container:
Switch back to the ACE and create a new Library called Particle in the Audio System Controls panel.
Audio for the campfire has been included as Play_l_global_particle_fire.ogg, under the _Audio_Assets/SDL_Mixer/chapter_03/ folder of the Audio Showcase Level assets' installation directory.
Save the created Library and reload the audio engine before proceeding to link the Trigger to the fire particle.
Adding the Trigger to the Fire Particle
Particles refer to the elements that are used to create visual effects or small physical objects that can move, emit light, react to collisions and so forth. The Particle Editor provides a node based visualization of a particle's components, and will be used to add audio to the campfire's fire particle. Go ahead and open it using the Tools → Particle Editor option from the Sandbox's Main Menu.
The fire particle is located in the /Assets/Particles/Fire.pfx folder of our project's asset directory; open it by clicking the button at the top-right corner of the Particle Editor tool window, and selecting the Open option.
You should now be able to see the different components that make up the fire particle. To add the Play_l_global_particle_fire audio trigger created in the previous step to the particle:
- Right-click on empty space within the Effect window.
- Search for the default → audio component in the search box that appears, and select it.
Now the goal is to have the audio trigger stop when the fire particle is killed, It should also not re-trigger, since the Play_l_global_particle_fire Event from which the audio trigger is derived has already been designed to loop in our middleware setup.
- In the audio component, select the purple Audio: Trigger feature. This displays a list of the feature's properties in the Inspector panel of the Particle Editor window.
- Add the Play_l_global_particle_fire trigger to the Play Trigger field by clicking the icon and selecting the trigger from the list that appears.
- Refresh the audio component by left-clicking on empty space within the Effect window, and then back on the Audio: Trigger feature. Activate the Follow Particle and Stop on Death properties of the component in the Inspector panel.
As the name implies, the Stop on Death property causes an audio trigger to stop playing when the particle is disabled. The Follow Particle property meanwhile, causes the sound of an audio trigger to follow the particle as it is moved around a scene; it is hence recommended that this setting be used when the audio trigger is designed to loop.
Lastly, click the brown Life: Time feature and deactivate the Life Time property from the Inspector window. This sets the value of the particle's lifetime to infinity. Remember to save all progress by selecting the Save option from the menu of the Particle Editor, before jumping into the game to test your fire particle sound.
If using an FMOD middleware implementation, you'll have noticed that the sound of the campfire trigger reduces as the player moves farther away. This is because FMOD Studio sets a default attenuation for each 3D Event.
To view the Play_l_global_particle_fire Event's attenuation settings within your FMOD project:
Within the Spatializer Effect panel is a red curve that describes how the volume of the Event changes with distance; specific Min and Max values can be set from below the curve.
Any changes made to the Min and Max values of Play_l_global_particle_fire's attenuation can be tested within FMOD's Sandbox as follows.
In the real world, there is not just a reduction in volume but also a loss of high frequencies as distance increases. To implement this frequency modulation in a game environment, we need to create a parameter that changes over distance.
Open the Preset Browser using the Window → Preset Browser option from your FMOD Studio project window.
We now need this Distance parameter to drive the cut-off frequency of a Low Pass filter.
You should now see the scale above the Audio 1 track change to the range of 0 - 100, which corresponds to the range of the Distance Parameter we created. By adding different points to the curve of the Multiband EQ track, you may now change the cut-off frequency of the low-pass filter at different values of the Distance Parameter as shown in the GIF above.
Test various cut-off frequency values in combination with different attenuation settings using the FMOD Studio Sandbox and, when satisfied, rebuild all Soundbanks, reload the audio engine in the ACE, and jump into Game Mode to hear your changes.
You'll notice that the sound of the campfire remains constant regardless of the player's position, because it isn't 3D spatialized. To change this:
We now need to add attenuation to the sound, which defines how the sound changes over distance; Wwise gives us the option to not only change the volume of the sound, but also set low/high-pass filters and change the spread of the sound.
Aspects such as the frequency and spread of a sound are stored within an Attenuation Share Set, which can also be used by multiple other sounds.
The red line that you see on the Attenuation Settings graph represents the volume of the sound, which is active by default. Try setting the Max distance to 30.
Under the Curves section is a list of other parameters that can be activated; since we'd like to add a low pass filter for attenuation, change the value of the Low-pass filter to Custom in the Curves section; you should now see a blue line in the Attenuation Settings grid.
Feel free to use the GIF above for reference.
Test various attenuation settings and, when satisfied, generate all SoundBanks, reload the audio engine in the ACE, and jump into Game Mode to hear your changes.
Our level now contains a natural campfire sound, besides the tree movement ambient sounds we added in Chapter 01. In the next and final chapter, we'll work to create a dynamic ambience for the level by using a combination of sound layering, nested ambiences, and one shots.
On This Page
|Table of Contents|