01
Sound Part A: Ambience and Environment

Summary: Ambience with Ambient Sound Actors, attenuation shapes and falloff distance, spatialization, filter over distance, area loops, source loops, source one-shots, player-oriented one-shots, Sound Cues, audio volumes for reverb, triggers and triggered sounds, embedding sounds into Blueprint Actors

Project: DemoCh01Jungle01 Level: Jungle01

You can skip between the different locations in game using the keys 1–9.

Introduction

Summary: Playing the game

Download, install, then open the Project: DemoCh01Jungle01 and the Level: Jungle01.

fig0030

Play the map.

fig0031

If you’re not used to this kind of first person shooter environment, then practice using the mouse to look around and the W, A, S, and D keys to move around (don’t forget if you hold down the RMB you can also move around in similar fashion within the editor). Press the Esc key to return to the editor window.

Now press the Bookmark keys 1–9 to have a look at the different areas in the environment. Explore the level and get a feel for how the sounds are working. Remember you can also hear the Ambient Sounds in edit mode by enabling Real Time Audio from the Settings menu on the ifig0006.jpg Toolbar.

To be able to jump in and play the game from any starting position, the easiest thing to do is to change the play settings (the drop down menu next to the Play icon on the ifig0006.jpg Toolbar) to Spawn player at/Current Camera Location. You can also right-click anywhere on the floor surface and choose Play from Here, but this can be a little unreliable.

fig0032

Ambience

Summary: Ambient Sound Actors, attenuation shapes and falloffdistance, area loops, source loops, source one-shots, player-oriented one-shots

The background ambience to your level forms the crucial foundations on which everything else sits. The attention to detail required for really immersive ambience is one thing that’s sometimes overlooked by people starting in game audio. In this section we’ll be looking at how to implement both the background environmental sounds and sonic landmarks of your map.

Exercise 01_01: Listening Exercise

  1. Sit quiet and still for one minute. Write down everything you hear.
  2. Now think about how you might begin to group these sounds by their characteristics. You’ll find that they tend to be either constant/looping sounds (usually from some kind of mechanical or electronic source) or one-shots (usually instigated by some sort of human or natural agent). You might end up with something like this.


    fig0033
  3. Reflect on how you might need to implement these in-game in different ways and the amount of detail there is in even the simplest audio environment.

Types of Sound

Ambient Sounds tend to be implemented in the following ways:

fig0034

ifig0002.jpg Area Loops— These are typically long loops (2–3 minutes) that cover particular sections of the environment. These can sometimes include both background sounds and occasional one-shots, or be shorter loops with just a background area or room tone. Although they sometimes have spatial sounds within them (typically being stereo or quad files), they play back directly to the players ears and don’t pan around as you move.

ifig0003.jpg Source Loops— These are shorter looping sounds that come from specific spatialized sources in the game (typically 4–10 seconds of mechanical/electrical sources that naturally have looping characteristics) and so are spatialized in the game world.



ifig0004.jpg Source One-shots— These are the occasional one-off spatialized sounds that occur at randomized intervals to give the impression of life and activity in the level. The source could be a specifically located one or an imaginary one.



ifig0005.jpg Player-oriented Sounds (POS)— These are similar to source one-shots but come from imaginary sources that we don’t necessarily actually see and are always located relative to the player’s position in the game world.



Area Loops

From their experience in the real world, people expect there to be sound of some sort everywhere they go in a game. Even a bare empty room will feel weird with no sound. Acting as a useful indicator of location, these area loops or room tones not only make an environment feel more real, but can also be used to set the mood of a particular place. Games that use streaming off the disk (discussed in Chapter 02) often use long ambient loops as an efficient way of populating an area with sound. Although not strictly natural since these loops lack the randomization of reality, they can work well if they are long enough and combined with other elements.

It might seem strange that these are not spatialized (in other words, they don’t come from a specific location in the game world), but sounds do tend to become more diffuse (less defined in their direction) the further away you are, so this doesn’t feel entirely unconvincing. It is certainly better than the whole environment whipping/panning around you as you move. In most modern games, these would be multichannel, but given that we’re just getting started, we’ll stick to stereo for now and cover how to import multichannel ambiences in Chapter 08.

Attenuation

Press the 1 key to jump to the *Cave 01* area (Bookmark 1). In front of you, there is a loudspeaker icon representing an [Ambient Sound] Actor of the type that you have already come across in Chapter 00.

fig0035

By selecting the icon, you can see the sound used in the ifig0006.jpg Details panel and the Attenuation settings (expand the Attenuation Overrides drop down) that control the size of the area over which we’ll hear it. In this instance we’re using a Box shape. The sound is at its maximum volume when the player is inside the interior box, then the sound drops away to zero at the exterior box. The numbers in the Extents settings refer to the Unreal Unit measurement of distance where 1 UU (Unreal Unit) is equal to 1cm. In order to see the sound attenuation curves more clearly and avoid confusion, you can switch off the Volumes/Lightmass Importance from the Show menu of the ifig0006.jpg Viewport.

fig0036

Using the magnifying glass icon next to the Sound reference in the ifig0006.jpg Details panel will find the sound in the ifig0006.jpg Content Browser ({Cave_Loop_01}). Double-click the Sound Wave to open its ifig0006.jpg Generic Editor panel, and you can see it is set to be a looping sound.

fig0037

Look back at the ifig0006.jpg Details panel of the [Ambient Sound], and you can see that the Override Attenuation box is checked. This means that we are controlling the attenuation locally, and you can see we’ve set it not to Spatialize.

Press 2 to jump to Bookmark 2 then use the ifig0006.jpg World Outliner to find and select (Ctrl + Click to multiple select) the following area loops for this part of the game level:

  • [Cave_01_Loop] (Main cave)
  • [Cave_01b_Loop] (Smaller cave off the main cave)
  • [Jungle_Loop] (The Jungle area you emerge into)

fig0038

Note how we’ve used different attenuation shapes that are appropriate for the areas we’re trying to cover.

These all follow the same principle that the sound is at its maximum volume within the inner shape then falls off towards the outer limits. Each shape uses different names for their inner areas as you can see from the illustrations below. The cone shape has a slightly more specific usage that we’ll be looking at in more detail in Chapter 07.

Sphere: Max Volume inside Radius, then falling off to Falloff Distance.

fig0039

Box: Max Volume inside Extents, then falling off to Falloff Distance.

fig0040

Capsule: Max Volume inside capsule as defined by Half Height and Radius, then falling off to Falloff Distance.

fig0041

Cone: Max Volume inside inner cone as defined by Cone Radius and Cone Angle, then falling off to cone defined by Falloff Distance and Falloff Angle. Cone Offset allows us to offset the start of the cone back from the location of the Ambient Sound Actor.

fig0042

Exercise 01_02: Area Loops

Download and install the Exercise_Project from the website. In this exercise we are going to add area loops to the *Cave 01* and *Oasis* areas of the exercise level using Ambient Sounds for area loops.

[Ambient Sound], attenuation shapes and falloffdistance, spatialization, hiding/showing items in the level, volume multiplier

  1. Open Project: Exercise_Project , Level: Exercise_A
  2. You can see that there are two main areas to the first section of this map, *Cave 01* (Bookmark 1), and *Oasis*(Bookmark 2). Using the sounds provided in the folder below (or your own), add background area loops to encapsulate each of the two environments.

    PC: C:UsersUserNameDocumentsUnreal ProjectsExercise_ProjectExercise_Assets1_02_ CaveToneandJungleLoops

    Mac: /Users/UserName/Documents/Unreal Projects/Exercise_Project/Exercise_Assets/01_02_ CaveToneandJungleLoops

  3. If you find the level is slow or unresponsive, then see the following section for some tips on getting it to run more smoothly-Appendix C: Testing, Troubleshooting, and Good Practice/Tips for Slow Running.
  4. When you’ve imported the sounds (drag and drop into a folder in the ifig0006.jpg Content Browser), you will need to set each one to be looping. You do this by double-clicking on the {Sound Wave} asset to open the ifig0006.jpg Generic Asset Panel and ticking the Looping box in the Sound Wave section. (You also can select multiple {Sound Waves} at once—right-click them and choose Edit to edit all their properties at once.)
  5. Add an [Ambient Sound] Actor to the level. You can do this in several ways.
    1. Drag and drop your desired {Sound Wave} asset from the ifig0006.jpg Content Browser into the game world.
    2. With your asset selected in the ifig0006.jpg Content Browser, right-click in the game world and select Place Actor/Selection.
    3. In the ifig0006.jpg Modes panel (top left) type “sound” in the Search Classes box, then drag and drop the [Ambient Sound] Actor into the level. You’ll then need to assign a sound to it.
  6. As you add each [Ambient Sound], give them meaningful names by editing their ifig0006.jpg Details panel.
  7. Position your [Ambient Sound]s by clicking and dragging on the red/green/blue arrows to move them. These arrows represent the Translate Widget (moving widget). For more see Appendix A: Core Concepts/Manipulating Actors.
  8. For each [Ambient Sound] tick the Override Attenuation setting, and set the Allow Spatialization to off. Choose an appropriate Attenuation Shape (a box and a sphere would probably work best for these areas), set the Extents (or Radius or Capsule height) of the inner area and the Falloff Distance. Move and rotate as required to cover each area.
  9. When you are setting your shape properties for the Ambient Sounds, you might sometimes want to see things more clearly in the level. If you select anything in the level and press H, this temporarily hides the selected object and can allow you to see and place things more accurately. To reset and show everything again press Ctrl + H.
  10. Use a variety of attenuation shapes and fall off distances to produce smooth transitions between each area and ensure there are no holes.
  11. As you go, and again at the end, adjust each Ambient Sound’s Volume Multiplier until you are happy with the relative volume of the sounds in each area.

    Note that while volume settings in most DAWs are scaled to take account of the logarithmic nature of sound perception, unfortunately volume settings in the Unreal Engine are not. This causes volume multipliers, particularly at the lower end, to feel slightly unpredictable. This is why we often use curves to control volume—see Appendix A: Core Concepts/Transforming and Constraining Variables and Parameters/Reading through Curves.

Source Loops

For area loops the attenuation settings are about creating a smooth transition between one area and the next. Source loop sounds have a specific point of origin in the game—they are coming from a particular source object, so in this case the attenuation settings are about trying to recreate the realistic drop in volume over distance.

Inside the second large cave (*Cave 02*, Bookmark 3), you can see that the ambience is now created with a general background area loop together with several source loops.

fig0043

This time these Ambient Sound Actors are spatialized and located in much more specific areas around their source objects. If you look at the ifig0006.jpg Details panel for the Ambient Sound located by the yellow box on the left as you enter the cave ([Generator]), you can see that the attenuation is controlled locally (Override Attenuation) and that the sphere attenuation shape is now spatialized (Allow Spatialization). Unlike the area loops, you will hear these pan from left to right (or in surround) as you move around.

Filter over Distance

Sound travelling in air also changes in frequency content depending on the humidity and temperature. While this is rather tricky to calculate accurately, we can fake something like this by applying a low-pass filter over distance in addition to attenuating the volume.

If you look at the two areas where we have water dripping through the roof of the cave ([Water_ Stream_01] and [Water_Stream_02]), you can see that these Ambient Sounds have the Attenuate with LPF option enabled. The LPFRadius Min is the distance at which no filtering is applied, and LPFRadius Max is where the maximum filtering is applied.

fig0044

fig0045

There are a variety of other aspects regarding how the sound attenuates that you have control over, such as the curve by which it attenuates (Distance Algorithm) and the region in which the sound becomes spatialized (Non-Spatialized Radius). Feel free to play around with these, but we’ll be coming back to them in more detail in Chapter 07.

Area Loops and Source Loops: Attention to Detail

Although the implementation of ambient loops may appear relatively easy, don’t make the mistake of thinking that it is simple. Creating a convincing and detailed environment is a huge creative challenge, and is so important to setting the mood and tone of your game. The next area serves as an illustration of the kind of attention to detail you should be thinking about.

fig0046

As it is raining in *Jungle: Area 02* (Bookmark 4), we have a stereo area loop for the background, but we also need source loops for the specific sound of rain falling on different objects within the area. For example in the small patch around the hut we need:

  • The rain on the metal roof of the hut
  • Rain on the wooden crates outside the hut
  • Rain on the metal barrels outside the hut
  • Rain in the leaves of the trees (which will of course sound different from the general rain on the grass)

Using the ifig0006.jpg World Outliner search for and select the sounds starting with Jungle02 to see these more clearly. Each one of these needs to be carefully considered in regard to its Inner Area Size and Falloff Distance, whether to apply the low-pass filter, and whether to Spatialize the sound or simply attenuate over distance.

fig0047

Exercise 01_03: Source Loops

In this exercise we will be adding source loops to the *Cave 01* area of the exercise level using Ambient Sound Actors.

Low-pass filter over distance, previewing attenuation shapes in-game

  1. Open your exercise level.
  2. You should have completed the area loops for the initial areas during Exercise 01_02, and now you need to add source loops to some of the objects in the level. Focus on *Cave 01* (Bookmark 1) to begin with.
  3. You can use some of the sounds provided in the exercise folder or import your own. If importing, do not forget to set them as looping wave files by editing the Looping option in their ifig0006.jpg Details panel (double-click a Sound Wave to open this).
  4. As in Exercise 01_02 create Ambient Sound Actors in the level (the easiest way is simply to drag and drop your {Sound Wave}s into the level) and move them to the required position using the red, green, or blue arrows. This time tick the Allow Spatialization box in the Ambient Sound’s ifig0006.jpg Details panel. Then Override Attenuation and set up their attenuation settings. Since these are specific sound sources, these will typically be much smaller and more localized than the area loops.
  5. For some sounds you might also want to add some low-pass filter attenuation by ticking this option and choosing appropriate LPFRadius Min and Max settings (typically to match the inner and fall off settings of your shape).
  6. As well as previewing your source loops as you move around the game in the Viewport (Settings/Real Time Audio), you may want to actually see the attenuation shapes in the game as you play it. If you edit your Sound Waves ifig0006.jpg Generic Asset Editor to enable Debug, you can call up the Console while playing the game (¬ or Tab key, depending on your keyboard language settings), then type “Stat Sounds-Debug”. “Stat Sounds Off” turns this off. You’ll then see their attenuation setting in the game represented in blue shapes when the Ambient Sounds are active. As well as being useful, this also looks pretty cool—which is always important! For more on Console commands, see Appendix A: Core Concepts/Console Commands.

    fig0048

  7. Go back over all your sounds in the level and adjust their Volume Multiplier and Attenuation settings until you are satisfied.

Sound Cues

In the next section we are going to be using Sound Cues (indicated in the text by {Sound Cue Name}), so we’ll spend a moment to look at what these are. Rather than simply playing back one .wav or Sound Wave file, most game editors will have a more abstracted layer for sound events so that you are in fact triggering a system that contains multiple .wav files. Sometimes called a sound event or sound object, in the Unreal Engine these systems take place within a Sound Cue. We will be talking about this idea again in more depth in Chapter 02.

In the ifig0006.jpg Content Browser double-click on the {Thunder} Sound Cue. This will open the ifig0006.jpg Sound Cue Editor.

fig0049

You should see a panel to the right that displays the ifig0006.jpg Palette of objects or - Nodes- available for you to build your systems with, and to the left a ifig0006.jpg Details panel where you have access to their settings. Try pressing Play from the top toolbar of the ifig0006.jpg Sound Cue Editor. You should hear a thunder sound. You may have to wait a while, as this Sound Cue has a - Delay- node in it. If you select one of the - Wave Players- and click on Play Node from the top toolbar, you’ll hear it immediately since now we’re choosing to play that specific node rather than the whole cue. (You can also preview the cue up to the selected node by double clicking on it.)

Navigating in Sound Cues (and Blueprints)

LMB—Click to select, click and hold to drag

RMB—Click and hold to move the screen around

Ctrl + LMB—Click to select and deselect multiple items

Shift + LMB—Drag to marquee select (this allows you to draw a rectangle and will select the items within it)

Click and drag wires between pins to connect up the systems, Alt + click to delete connections, and Ctrl + click to move an existing connection to another pin. (See also the Quick Reference/Tips page at the back of the book.).

In addition to the systems you can build within them, another advantage of using Sound Cues is that you can reuse them in a number of locations in your level, and any changes you need to make need only be made on the Sound Cue itself rather than hunting around the level to make changes on multiple [Ambient Sound] s.

Sound Cue Nodes

We’ll be using Sound Cues a great deal throughout the book and will go into each node’s function as we go, but for the moment a description of each of the nodes available in the Sound Cue and their function can be found in Appendix A: Core Concepts/Sound Cue Nodes.

Adding Sounds to Sound Cues

The simplest way to add your sounds to a Sound Cue is to drag and drop the {Sound Waves} from the ifig0006.jpg Content Browser into the ifig0006.jpg Sound Cue Editor graph; however, this is not always the fastest method.

If you first select your {Sound Waves} in the ifig0006.jpg Content Browser then right-click in the ifig0006.jpg Sound Cue Editor, you’ll see that you have the option to add the waves prelinked to a particular -Node-. For example you might have 10 waves that you want to play back randomly. If you use this method, they’ll all appear in the Sound Cue already linked up to a -Random- node rather than having to link them up individually.

This is the right-click menu in the ifig0006.jpg Sound Cue Editor when waves are selected in the ifig0006.jpg Content Browser:

fig0050

When you are working in the ifig0006.jpg Sound Cue Editor, you can sync the ifig0006.jpg Content Browser to select the cue you are working on by pressing Ctrl + B. To find the specific Sound Wave in the browser, right-click on it in the Viewport and choose Sync to Browser.

Source One-shots

As we saw in the listening exercise, the real world is typically made up of a combination of loops and one-shots. One thing that will stop a game environment from feeling immersive and natural is any repetition of a series or sequence of sounds, as these immediately jump out as being artificial. Imagine this scenario in the real world: A dog barks a few times, then a car door slams, somebody shouts, and a helicopter flies overhead. If any of those sounds were to repeat but actually sounded pretty much the same (i.e., the same sample), then it might be unusual but you’d probably accept it. If they happened again but with exactly the same timing in exactly the same order then it would feel incredibly odd. To break this up, we need a system that will allow us to play back a random choice of sounds at random times.

Sometimes our one-shots are associated with actual objects or agents in the game, but very often they are there to create the impression of a world much more real and alive than it actually is. In the perfect game, there would be no such thing as one-shots like this because the environmental ambience would be comprised of hundreds of individual agents going around, doing their thing, and making the occasional noise—like in the real world. Given that most companies don’t want to bankrupt themselves by developing assets for every possible object that might be in a world, it’s our job to fake it by creating the impression that these things are there, even when they are not necessarily visible. So there might be imaginary birds in the trees, imaginary traffic just out of sight, and imaginary police cars in the distance.

Find the [Thunder] Ambient Sound in the level that references the {Thunder} Sound Cue you just looked at (using the ifig0006.jpg World Outliner panel search). Select it, press F to focus, and you’ll see that it is in the *Jungle: Area 02* (Bookmark 4). Using the ifig0006.jpg Details panel and the looking glass icon, locate the Sound Cue {Thunder} again in the ifig0006.jpg Content Browser, and double-click it to open the ifig0006.jpg Sound Cue editorif it is not still open.

fig0051

If you select the -Delay- node and look at the ifig0006.jpg Details panel, you can see that its settings are Delay Min = 8 and Delay Max = 20. So the system starts, and a random time count between 8 and 20 seconds is chosen. When that time is reached, a random choice is made to play one of the Sound Waves attached to the -Random- node. When that sound has finished playing, the -Looping- node restarts the system and chooses a new delay time, so we get a random delay between a random choice of sounds.

fig0052

In the first part of the *Temple Clearing 01* (Bookmark 5), there are 4 more examples of the source one-shot using the Sound Cues: {Creature_01}, {Creature_02},

{Creature_03}, and some {Frogs}.

fig0053

When you look at these Sound Cues in the ifig0006.jpg Sound Cue Editor, you’ll note that they have an additional node: the -Modulator-.

fig0054

This is very useful for increasing variety in your one-shots, as it allows you to randomize both the volume and pitch of the sounds between Min and Max settings. Another thing to note is that you can alter the Weights within the -Random- node to make sounds more or less likely to be chosen, so if you want one of your sounds to be chosen more rarely than the others, set its Weight to be lower than the others (see more discussion of randomization in Chapter 06).

Exercise 01_04: Source One-shots

In this exercise you will add source one-shots to the *Oasis* area of your exercise level using Sound Cues that are referenced by Ambient Sound Actors.

{Sound Cue}, -Looping-, -Delay-, -Random-

  1. You should have completed the area loops and source loops for the *Cave 01* area and *Oasis* during Exercises 01_02 and 01_03, so now we will add some randomized source one-shots like the ones above to bring some more life to the *Oasis* area (Bookmark 2).
  2. Import your sounds or some of the provided exercise sounds.
  3. Create a new Sound Cue. Click Add New in the ifig0006.jpg Content Browser and choose Sounds/Sound Cue. Give it an appropriate name and double-click it to open the ifig0006.jpg Sound Cue Editor.
  4. Drag and drop your Sound Waves into the ifig0006.jpg Sound Cue Editor Viewport.
  5. Create a -Looping- node in the ifig0006.jpg Sound Cue Editor by either right-clicking and selecting it from the menu or by dragging and dropping this node from the ifig0006.jpg Palette of nodes on the right-hand side. Now do the same to create a -Delay- node and a -Random- node.
  6. Connect your sounds to the -Random- node, creating additional inputs (Add Input on the -Random- node) as necessary.
  7. Attach these nodes in the following order from left to right: -Random- to -Delay- to -Looping- to -Output-.
  8. Set the Delay Min and Delay Max in the ifig0006.jpg Details panel of the -Delay- node (select the node to see this). This sets the random time in seconds between the playback of a random sound selected by the -Random- node.
  9. After auditioning the cue in the ifig0006.jpg Sound Cue Editor, drag and drop your new Sound Cue into the level to create an [Ambient Sound], and set this up with the usual attenuation details (Shape, Extents, Falloff Distance, and LPF settings).
  10. Add several of these to your exercise level, and don’t forget that you can set these up more quickly by adding multiple sounds already pre-connected to a -Random- node. Do this by selecting multiple Sound Wave files in the ifig0006.jpg Content Browser then using the right-click menu in the ifig0006.jpg Sound Cue Editor.

Polyphonic or Overlapping One-shots

Despite having random delays, you may have noticed some of your one-shot elements still may feel a little artificial or even have a looping feel to them—why is that? One of the problems with a looping delay that is implemented within a Sound Cue is that the -Delay- only actually starts once the first sound has finished playing (i.e., the delay is the time between sounds), so you’ll never get overlapping sounds—in other words, it is a monophonic (one voice) system. If you’re using short delays on sounds of a similar length, then this can start to sound a bit loopy.

To create a system that has random delays between the start of sounds and allows them to be retriggered with overlap (a multiple voice or polyphonic system), we need to allow for simultaneous sounds by using a -Mixer-.

fig0055

Again in the *Temple Clearing 01* area (Bookmark 5) over by the river is the Ambient Sound [Loons_01] that references the Sound Cue {Loons_01}. Here you can see that we’ve set up two looping delay systems. They will both randomly choose one of the Sound Waves but at different times, and since they are then connected to a -Mixer- node, you will be able to hear both sources play should they happen to overlap.

We’ve demonstrated source one-shots that are associated with specific locations in the game, but these sources could equally be imaginary ones. Combining these kinds of randomized one-shots with area loops in a single Sound Cue for an area is another approach you could take if the spatialized aspects were less of a priority in your game.

fig0056

Exercise 01_05: Overlapping One-shots

In this exercise you will add some overlapping source one-shots to the oasis area of your exercise level.

-Mixer

  1. Go back to some of the randomized one-shot Sound Cues you created for Exercise 01_04 and adapt them to be able to play overlapping sounds.
  2. Add a -Mixer- to your Sound Cue and feed your existing -Looping-/-Delay- system into it.
  3. Now create a second -Looping-/-Delay- system (either referencing the same sounds or a new set) and feed these into a second input on the -Mixer- (created using Add Input on the -Mixer- node.)
  4. Play the game and revel in the polyphonic joy.

Player-oriented One-shots

What’s the sound of one hand clapping in a forest when there is nobody there to hear? Well, we don’t know either, but having meticulously placed hundreds of one-shot sounds in the level to represent things that often aren’t actually there or visible, you might ask yourself if there’s a quicker alternative. After all there is little point in having the one-shots there if the player is not close enough to actually hear them. Player-oriented one-shots fulfill the purpose of representing these things in the world that you want there but can’t see, and ensure that the player will always hear them since they are actually oriented around the player’s location.

fig0057

This functionality doesn’t actually exist natively in the Unreal Engine, so we have cooked up a Macro, or a reusable Blueprint system, for you. This is imaginatively entitled the <GAB_Player_Oriented_ One_Shot>, and this is what is generating the kookaburra and fly sounds in the area immediately in front of the temple (*Temple Clearing02*, Bookmark 6). This macro is installed when you installed the levels in the following directory:

  • PC: C:Program FilesEpic GamesEngine VersionEngineContentGAB_Resources.
  • Mac: /Users/Shared/Epic Games/Engine Version/Engine/Content/GAB_Resources

fig0058

Open up the [Level Blueprint] from the Blueprints icon on the ifig0006.jpg Toolbar and find the Player Oriented Sounds section.

We have placed a [Trigger] in the game level on the bridge, since we only want these sounds to come on when the player has crossed into the final area. The [Trigger] outputs an event when the player overlaps with it and then the <Sequence> node triggers our two Blueprint macro systems.

fig0059

The XY values range from negative to positive, negative being behind (X) and to the left (Y), and positive being in front (X) and to the right (Y) relative to the game world axis. The XY values of the <GAB_Player_Oriented_One_Shot> represent potential distance ranges for the sound from the player in the XY plane of the game world axis. If you want the sound to originate from all directions you’ll want to use both positive and negative values. Play this area (starting prior to the bridge), and you should hear these sounds being randomly spawned around you (this is particularly effective with 5.1 surround). Note that in the case of the kookaburra, for example, this can potentially spawn up to 1,000 units away, so we have made sure that our sound has an attenuation fall off of greater than this otherwise when it does play we might not hear it.

By default this does not take the player’s rotation into account (the way they are facing), but if you specifically want sounds to always spawn in front or behind the player (or to the side), you can check the Use Player Rotation Boolean. By setting the X value to negative, for example, you can fix the sounds to always appear behind the player—spooky!

Exercise 01_06: Player-oriented One-shots

In this exercise we will be adding POS (Player-oriented sounds) to the *Oasis* area of your level. This is your first Blueprint system, so be brave! (Read the first part of Appendix B: Blueprint primer before starting this exercise)

<GAB_Player_Oriented_One_Shot>, [Trigger], <OnActorBeginOverlap Event>

  1. Create a Sound Cue in the same way that you did the source one-shot (i.e., with a -Looping-, -Delay- node that picks a -Random- sound.
  2. In the level create a [Trigger] as you enter the *Oasis* area (Bookmark 2). Search for “Trigger” in the ifig0006.jpg Modes panel and drag and drop the [Trigger] into your level. The easiest way to resize a Trigger is to use the widgets. Use the Spacebar to cycle through move/rotate/scale widgets (see Appendix A: Core Concepts/Manipulating Actors for more on widgets).
  3. With your [Trigger] selected in the ifig0006.jpg Viewport, right-click in the [Level Blueprint] and Add Event for Trigger—/Collision/OnActorBeginOverlap.
  4. Create a <GAB_Player_Oriented_One_Shot> node in your Blueprint by right-clicking and searching for this item in the ifig0006.jpg Graph Action Menu (you may need to turn off the Context Sensitive option).
  5. Connect this up (LMB click and drag out) to the <OnActorBeginOverlap> event you just created to Start the <GAB_Player_Oriented_One_Shot> when the player walks through this [Trigger]. You may also want to add another [Trigger] on the exit of the Oasis to Stop it when you leave the area.
  6. Check the Use Player Rotation option, set the Delay Min and Max to how frequently you want the sound played, and set the Range YMin and YMax to the distance left and right you want it away from the player. Remember that with rotation active, negative numbers will be to the left, and positive to the right.
  7. Set the Range XMin and XMax to be negative so that the sounds spawn behind the player.
  8. Check the Attenuation settings of your Sound Cue (in the ifig0006.jpg Details panel of the -Output- node) to make sure that when the sound spawns you will still be able to hear it (i.e., the Falloff Distance is greater than your X/Y settings).
  9. You can watch your Blueprints in action on a second screen as you play, and even free up the mouse to go and move them around by holding Shift and pressing F1. See Appendix C: Testing, Troubleshooting, and Good practice/Watching Blueprints.

One-shots: Sourcing and Masking

Although randomized one-shot sounds are ideal for generating variety and life in your ambient environments, it can be tricky to source the sounds in the first place. Typically these sounds exist alongside others in the real world, so when you try to edit them out as individualized elements, you get all the background noise as well. Although you should always aim to get sounds that are as clean and isolated as possible, one can get a little obsessive about this when editing one-shots in isolation. Don’t forget that the one-shots will likely be played against a background of both area loops and source loops. Often the frequencies in these background elements can help mask some of the noisiness on your one-shots or help to hide an abrupt decay tail, and they’ll sometimes sit in the mix better than you might imagine.

Embedding Source Sounds into Game Actor Blueprints

When you consider the massive scale of many modern games, you’ll appreciate that it’s not very efficient to have an artist go around and place lots of objects, and then a sound designer go around and find exactly the same objects to add sound to them. Since most objects will get reused numerous times throughout a game (e.g. tree type A), it would be useful if we can embed the sounds themselves in the Actor. Then we would have global control over the sound itself (through the Sound Cue), but we wouldn’t have to place them all. If things needed changing, we would only need to alter the cue, not each of the 500 Ambient Sounds!

In the illustration below, two trees are highlighted (*Temple Clearing 02*, Bookmark 6). These are actually Blueprint Actors {GAB_Tree_Blueprint} that have both the tree mesh and an ambient one-shot sound embedded.

fig0060

We’ve seen examples of this already in the shooter game, where you opened up various ship Blueprints and replaced the sounds. Open the {GAB_Tree_Blueprint} by either double-clicking on the asset in the ifig0006.jpg Content Browser or by selecting the asset in the ifig0006.jpg Viewport and clicking on Edit Blueprint in its ifig0006.jpg Details panel. When the ifig0006.jpg Blueprint Editor window is open, look at the ifig0006.jpg Viewport to see the components in this Blueprint.

fig0061

Here you can see the static mesh component ({Tree}) and the audio component (the Sound Cue {Bird_For_Tree}). This means that wherever this Blueprint is used, it will automatically refer to and spatialize this Sound Cue along with the visual asset. In some levels you may be hearing a lot of sound, but when looking around for the Ambient Sounds in the level, there appear to be none. This is because they are part of the Blueprint Actors. Much of what we’ve done in the demo levels is in the level Blueprint to make things easier to follow and understand, but some of this might more typically be done in Blueprint Actors, particularly if you have multiple instances.

Exercise 01_07: Embedding Sounds in Actor Blueprints

In this exercise you’re going to make your own Blueprint Actor that has an embedded audio component so you can reuse it throughout your level.

Actor Blueprint, components, audio component, static mesh

  1. Open up the exercise level.
  2. In the ifig0006.jpg Content Browser click Add New/Blueprints/Blueprint Class/Actor and give it an appropriate name. (You can also create Blueprints from the Blueprints icon in the toolbar with New Empty Blueprint Class.)
  3. Double-click it to open the ifig0006.jpg Blueprint Editor(Don’t forget to read Appendix B: Blueprint primer!).
  4. Find the static mesh asset {Demo_Small_Generator} in the ifig0006.jpg Content Browser (or another of your own choosing) and select it.
  5. In the ifig0006.jpg Components panel of your Blueprint click Add Component / Static Mesh (Demo_Small_Generator). Note that it is adding the component that you have selected in the ifig0006.jpg Content Browser.
  6. Do the same again to add your sound. Select the asset in the ifig0006.jpg Content Browser then Add Component/Audio (Your Asset). Given that this is not a triggered sound, you will want to choose either a looping Sound Wave or a Sound Cue with a looping node in it.
  7. Select the audio component in the ifig0006.jpg Blueprint Editor/ifig0006.jpg Viewports and determine its Attenuation settings.
  8. Click on the Compile button in the ifig0006.jpg Blueprint Editor (top left).
  9. You now have a new Blueprint Actor that you can drag and drop into your level.

Ambience Recap: An Artist’s Approach

Much of this chapter has dealt with creating background ambience to make your game world seem alive and real. A useful analogy when considering ambience is that of an oil painting. When you look at a finished oil painting, you get the impression of a complete and convincing picture. However, not one area of the painting is the result of a single brush stroke, but instead the final effect arises from the combination of layer upon layer of paint. You should think of your ambience in the same way. The final effect will need to be built up of many different layers of distant, mid-distance, and close sounds to produce the final effect.

Occlusion Issues

Summary: Triggers, fading Ambient Sounds in/out for occlusion

Triggers and Switching Ambience

So far we’ve managed to give our different areas (caves and jungle) a separate audio identity by careful use of the Radius/Extents and Falloff settings for our Ambient Sounds, but this is mainly because we’ve had relatively simple area shapes to deal with. Game engines typically do not have particularly sophisticated systems for dealing with audio occlusion (where sounds are attenuated by passing through materials such as walls) and so often we need to deal with this by hand. Imagine how you might approach an area like the one represented below. You could no longer just use large area loops since the jungle sound would be heard inside the temples, and the temples are awkward shapes that don’t align neatly with spheres, boxes, capsules, or cones.

fig0062

One solution is to use lots of overlapping sound areas with different shapes to work your way around and within the buildings, but that would be a lot of work and could lead to phasing issues between instances of the same sound playing simultaneously. A more pragmatic approach that is often used is to simply switch off the exterior sounds when you go inside (and switch on interior sounds) and vice versa.

In the image below, you can see the issue (*Temple Entrance*, Bookmark 7). The Ambient Sound [Swamp_Loop_01] that forms the background audio for the jungle protrudes into the temple, so you will hear it even when inside. Although not particularly realistic, many games use a simple method of placing a trigger in the entrance of a building or area and using this to switch the ambiences on or off.

fig0063

Open the Level Blueprint and find the “Ambience Switching” section. A sphere [Trigger] at the entrance to the temple gives us an <On Actor Begin Overlap> event in the [Level Blueprint] when the player walks through it. This is used to <Fade Out> the outside ambience and <Fade In> the temple music [Temple_Music_01_Loop].

fig0064

The Auto Activate option for the temple music [Ambient Sound] has been disabled in its ifig0006.jpg Details panel. In other words it does not start playing when the level starts, and so it will be silent until the <Fade In> command is received.

fig0065

The <FlipFlop> node alternates between its two outputs. It will send an execute command out of A, then B, then A, etc., so if the player walks back out of the temple, then the outside ambience is faded back in and the inside faded out again. We’ll be returning for a deeper look at occlusion later in Chapter 07, but for the moment this simple switching approach can work effectively.

You could of course extend this approach to deal with all the different Ambient Sound areas in your level, setting up Sound Cues that include both area loops and imaginary source one-shots, and then switching between them as you move between locations. See Exercise 05_01 in Chapter 05 for an adaptable system using arrays for this.

Since occasionally things don’t go to plan, it is a good idea to also have some kind of completely global subtle background tone throughout your whole level. Silence is a real glaring error and immersion breaker, so if the switching system does go wrong (maybe the sound is slow to be streamed from disk for example), then the game won’t sound completely broken.

Exercise 01_08: Switching Ambience

In this exercise we are going to use a Blueprint system for switching ambience when the player goes into or out of the buildings in the *Oasis* area of your level.

[Trigger], <FadeIn>, <FadeOut>, <FlipFlop>, <Gate>, <Sequence>

  1. In the *Oasis* area of the exercise level (Bookmark 2), choose one of the buildings to concentrate on first. For example in the ifig0006.jpg World Outliner, search for “Building_02”. You already have attempted some inner/outer ambiences for this area using Ambient Sounds but have perhaps found this difficult to get right since this building is an awkward shape.
  2. Place a [Trigger] in the doorway of the building. Remember these can be found by searching for Trigger in the ifig0006.jpg Modes panel. You’ll see that you have different trigger shapes available. A [Box Trigger] will work well for this, so click on this in the ifig0006.jpg Modes panel, drag it into your level, and position it in the buildings doorway.
  3. Use the scaling widget (with the [Box Trigger] selected, cycle through move/scale/rotate using the Spacebar) to flatten the box out so we get the trigger occurring just when we want it.
  4. Open the [Level Blueprint], and with the [Box Trigger] still selected in the ifig0006.jpg Viewport, right-click in the Blueprint ifig0006.jpg Event Graph and select Add Event for Trigger Box/Collision/Add OnActorBeginOverlap. When the player overlaps (i.e., walks through) this will trigger an event to be output from this node.
  5. Add references in the ifig0006.jpg Event Graph to the Ambient Sounds you want to toggle on or off. For example you might have a Jungle_Area_Loop and a few other one-shot loops that overlap with the building. You will also want an Inside_Building_Loop. To do this select them in the ifig0006.jpg Viewport, then right-click in the ifig0006.jpg Event Graph of the [Level Blueprint] and click Add Reference to— (make sure the Context Sensitive option is checked in the ifig0006.jpg Graph Action Menu). See Appendix A: Core Concepts/Referencing In-game Actors within Blueprint.
  6. To create the <FadeIn> and <FadeOut> nodes, you should click and drag out from one of the <Ambient Sound> references you have just created. There are different types of fade in/out nodes depending on whether you are targeting an Ambient Sound or an audio component (which we’ll look at later). Adding the node in this way ensures that you are using the right one.
  7. Now attach all the references to Ambient Sounds you want to be affected to the relevant target inputs of the <FadeIn> and <FadeOut>, and adjust the Fade Durations.
  8. Add the <FlipFlop> and connect the system up as shown in the illustration above.
  9. If your player will be starting the game from outside the building, then disable the Auto Activate (in the ifig0006.jpg Details panel) for the building’s [Ambient Sound]. When the player enters the building, this will fade in, and when they leave, it will fade out again. The reverse will occur for the outside Ambient Sounds.
  10. If you have an overlapping player-oriented one-shot system (Exercise 01_06) that you can still hear when inside the building, then you will need to toggle this on or off as well. You can do this by adding a <Sequence> to each output of your <FlipFlop> nodes, which allows you to trigger more than one thing from an event, or by triggering it from the output of the <FadeIn>/<FadeOut> s. Use one of these to stop the POS node and the other to restart it.
  11. You might note a number of other actions you can take on your Ambient Sound, such as <Play>. You could connect other in-game [Trigger]s to this to play one-off sounds in your level, such as dialogue instructions or specific sound events (don’t forget to disable the Ambient Sound’s Auto-Activate option).
fig0066

Reverb

Summary: [Audio Volumes] for reverb

The characteristics of a space can change dramatically according to its size and the materials within it since these affect the way that sound is reflected around. Think about the difference between singing in the shower and singing in a large cathedral for example. For your environments to sound convincing to the player, you need to carefully select the appropriate reverb setting for each space and apply this to sounds that occur within it (you can specify if you don’t want it applied to specific sounds, and we will look at that later in the section on sound classes in Chapter 08).

fig0067

As you enter the temple (*Temple Upper*, Bookmark 8), you will notice that your footstep and weapon sounds have reverb applied, and as you move through different sized rooms in the temple, you’ll hear that the type of reverb changes accordingly. The type of reverb effect is set in the ifig0006.jpg Details panel of the [Audio Volume] Actor, and you can specify the volume of the reverb effect and how long it takes to fade in after you enter the volume (this is to stop any abrupt changes).

fig0068

Exercise 01_09: Reverb

In this exercise you are going to add reverb to *Cave 01*, *Cave 02*, and the *Oasis Buildings* using [Audio Volume] s.

[Audio Volume], reverb effects

  1. Go to one of the caves or buildings in your exercises level, then search the ifig0006.jpg Modes panel to find the [Audio Volume] and drag and drop it into the map.
  2. Resize the [Audio Volume] to match your building using the scaling widget.
  3. In the ifig0006.jpg Content Browser menu View Options, make sure that the Show Engine Content option is checked so that you can see the reverb effects included in this folder. Pick an appropriate reverb effect for the nature of your building and set the Volume and Fade Times.
  4. Before you can hear the reverb being applied in your level, you need to rebuild the level’s geometry. You do this from the ifig0006.jpg Toolbar menu Build/Geometry/Build Geometry.
  5. Now add reverb to the other buildings and caves in the level, rebuild the geometry, and test them in game.

Triggering Sounds with Key or Controller Input

Summary: Triggering sounds directly with key of controller inputs

In the basement of the temple (*Temple Lower*, Bookmark 9), you can use the stone button in front of the fire pit to stoke the flames and…well, we won’t spoil the surprise. We have looked at how to turn Ambient Sounds on and off when the player overlaps a [Trigger] that has been placed in the game, but you might also want to trigger a sound or a piece of dialogue when a player interacts with an object or button by using it (typically through pressing X or A on the controller or E on the keyboard).

fig0069

Trigger Use Events

In order to trigger events from key or controller inputs anywhere in the level, we could just create a <Key Event> in the [Level Blueprint] and link it straight to a <Play Sound Attached>; however, we want this input to work only when the player is actually standing next to the relevant button. See the “Interact” section of the Level Blueprint.

fig0070

In order to do this, we use a <Gate> node that is opened and closed by the [Trigger] around the button. This way the <Key Event> E will not be allowed through to trigger the sound unless the player is in proximity to the button.

Exercise 01_10: Triggering Sound Events

In this exercise we will look at adding a sound that can be triggered by with a key input when using a button in the game world.

<Key Input Event>, <Play Sound Attached>

  1. In the back room of *Building 02* of your exercise map, there is a button that will open the door when you have set it up. Behind this door is an exciting present: a reward for having come this far!
  2. Place a [Trigger] around the button (from the ifig0006.jpg Modes panel) and resize it using the scaling widget.
  3. With the [Trigger] selected in the Viewport, right-click in the [Level Blueprint] and Add Event for Trigger—-/Collision/OnActorBeginOverlap, then do the same to add OnActorEndOverlap.
  4. Create a <Gate> and connect these up so that Begin opens it and End closes it.
  5. Create a <Key Event> for E. The quickest way is to right-click to bring up the ifig0006.jpg Graph Action Menu and type “E key”. Connect this to the Enter input of the <Gate>.
  6. Create a door opening sound and add it to a <Play Sound Attached>. You need to then attach this to the door mesh in the level. With the door selected in the ifig0006.jpg Viewport, right-click in the ifig0006.jpg Event Graph of the [Level Blueprint] to open the ifig0006.jpg Graph Action Menu. Find the <Get Root Component>, and this will add the node preconnected to a reference to the door mesh (see Appendix A: Core Concepts/Referencing In-game Actors within Blueprint for more). Now link this to the Attach to Component of the <Play Sound Attached>.
  7. Connect the output of your <Play Sound Attached> to the <Play> node for the [Matinee] we have already provided in the * Building 02 * section of the [Level Blueprint] (this opens the door). We will be looking at matinees in detail in Chapter 07.
  8. See Appendix A: Core Concepts/Key and Gamepad Inputs and Appendix A: Core Concepts/Events and Triggers/Trigger Use for more.

Exercise 01_011: DIY: Building Your Own Level

In this exercise you can have a go at building your own level. It is not essential, but the better understanding you have of the level designers work, then the better you can work together. Plus it’s fun!

Static mesh, snapping

  1. Open the Map: ExerciseMapEmpty.
  2. In the ifig0006.jpg Content Browser select the Game folder and filter the results by Static Mesh. This will show you all the visual assets available to build your level.
  3. Drag and drop static meshes from the browser into your level, and use the widgets (cycle with the spacebar) to move/scale/rotate them.
  4. You may find it useful at times to use the Snapping functions in the Viewport to snap the Actors to certain grid, rotation, or scaling factors (see Appendix A: Core Concepts/Manipulating Actors).


    fig0071

  5. You will probably also want to add some lights. Find these in the ifig0006.jpg Modes panel.
  6. If you’ve seen assets in other projects that you’d like, then you can migrate them to use in your project. Just open the project, select the asset, and right-click and select Asset Actions/Migrate. You will then need to specify the content folder of your project. Make sure you have permission to use any assets before making your game publically available!
  7. Now apply all the skills you’ve learned in this chapter to create a convincing and immersive audio environment.
  8. There are many levels and assets available via the Marketplace page of the Epic Launcher if you want to take this further.

Conclusion

Although the learning curve has no doubt been a little steep at times, you now have all the basic skills to populate a level with ambient audio and reverb. We’ve emphasized the implementation here, but do not overlook the importance of sound design. It is no good showing off a load of techniques if the end result just doesn’t sound any good. This is why the game sound designer, and as we will see later the game composer, needs a new skillset, one that encompasses all the skills from previous media (being a good sound designer and being a good composer) as well as all the new skills involved in implementation.

Recap:

After working through this chapter, you should now be able to:

  • Create area loops, source loops, and source one-shots using [Ambient Sound] Actors and Sound Cues;
  • Apply appropriate fall off distances and filters over distance;
  • Use the Blueprint <Player Oriented One-Shots> node to implement player-oriented sounds;
  • Embed sounds into game Actor Blueprints;
  • Switch ambiences on and off via triggers for occlusion purposes;
  • Implement reverbs;
  • Implement triggers on touch (beginoverlap) and use.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset