A primer by Dave Raybould
Popular on A Sound Effect right now - article continues below:
So, you’re wanting to get started with audio in Unreal..? Not sure where to start..? This article will provide you with a quick primer to get you up and running with sound in Unreal fairly quickly:
We’ll cover the basics of getting sounds into the engine, and then how you can get a functioning ambience going, with looping sounds, distance attenuations, spatializations, randomly timed one-shots, reverbs, and basic interactions.
All of which should stand you in good stead for creating interesting and compelling sonic environments that can help bring your game world to life.
Importing Your Sounds
The first step along the way to becoming an Unreal audio wizard is to be able to get your sounds in to the engine. Now, thankfully, this is actually pretty simple!
It’s probably worth creating a folder within your project’s structure for your sounds to make organizing things a little easier – simply right-click in the Content Browser and select ‘New Folder’
Unreal supports mono, stereo, 5.1, and ambisonic files, a few file formats (wav, aiff, flac, ogg vorbis), any sample rate, and a bit depth of 16bits (that last one is non-negotiable).
There are 2 ways to get your sounds into Unreal – with both methods you can import multiple files:
1. You can use the ‘Import’ button in the Content Browser, and then navigate to the sounds you want to import
2. You can simply drag and drop your sounds from Explorer (or Finder if you’re on Mac)
Importing sounds
Once you’ve got your sounds in to the Content Browser, you’ll notice that they’re marked as ‘dirty’ with a little asterisk on their icons. This means you need to save the assets that Unreal has generated otherwise they’ll be lost when you close the project.
It’s worth noting that the sounds themselves are not moved or copied into your project – Unreal generates a .uasset file for each sound as you import it.
If, at a later stage you decide that you wanted to rework one of the sounds that you’ve imported, then once you’ve edited the original source sound, you can right-click the asset within the Content Browser, and ‘Reimport’ the original source – you can also replace the asset with a new file (again maintaining all your references) by using the ‘Reimport with New File’ option. This means that any references to that asset within your project automatically update and your new sound is used throughout your project – which is handy!
Dave Raybould – the author of this primer – literally wrote the book on game audio implementation, and he’s co-created Ambient and Procedural Sound Design course on the Epic Online Learning site. Also, check him out on Twitter @TheNewTeed
Area Loops
Area loops are generally used to provide the background to an area or space – think of these as the underlying bed of your game’s sound – akin to ‘room tones.’ You probably want these to be at least stereo sounds (or quad, or higher, if you’re working in multi-channel), this will help your space feel more believable as there will be some inherent width to your sound already. You’re also going to need to ensure that your sounds will loop properly within your DAW (there are plenty of guides out there on how to do this in all flavours of DAWs). When designing your area loops, you probably want to keep them relatively simple, as anything ‘interesting’ that pops out will do so each time the sound loops round, and this can become noticeable.
Once you’ve got your area loop sounds in to Unreal, you’ll need to either double-click the asset, or right-click and select ‘Edit.’ In the Details window that opens up, you’ll need to enable Looping so that your sound loops within the game.
You can then simply drag your sound from the Content Browser into your level to create an AmbientSound actor that references your sound. You can use the Attenuation Settings to ensure that the sound can be heard across the entire area you want it to be. It is possible to create separate attenuation assets that can be re-used across multiple sounds, but for the sake of speed, we’ll just use the ‘override’ settings in the AmbientSound actor itself.
With the newly created AmbientSound actor selected, scroll through the Details window to the Attenuation section, and enable the Override Attenuation property.
Now, you’re able to use the properties within the Attenuation Distance section to define how much of an area the sound will cover.
(For a full breakdown of the attenuation settings, you can check out the official Unreal Engine Documentation online)
[tweet_box]How to Quickly Get Started With Game Audio in Unreal Engine — an essential primer[/tweet_box]
In the image below you can see an AmbientSound actor with a Sphere Attenuation Shape and two orange spheres within the editor that depict the Inner Radius and the Falloff Distance. The Inner Radius defines the distance within which the sound will be at full volume, and the Falloff Distance defines the distance at which the sound will be fully attenuated and will stop playing. The Attenuation Function defines how the engine handles this attenuation over distance, in this case it’s using a Linear function.
You can choose from a range of Attenuation Functions – it’s worth experimenting with these to find the one that best suits your sound and usage.
You can also choose from a range of Attenuation Shapes – it makes sense to use the shape that best suits the area you want to cover with your sound.
If you use a different shape than Sphere, the distance properties will change – for example, if you use a Box shape, then you get an Extents property instead of the Inner Radius, which makes sense given the shape.
For area loops, it makes to set your ‘inner’ distance (that which defines the full volume area) to be roughly that of the space you want to cover, and then you can use the ‘outer’ distance (falloff) to give you a ‘transition’ area as you move between different spaces.
In this video there are two hypothetical spaces (a cave and a jungle) – they’re both just simple boxes for the purposes of demonstration, but you’ll see how the inner attenuation distance has been set to roughly cover the entire space, and then the outer distance is being used to transition between the two spaces.
Area Loops
One other thing that you should bear in mind is whether you want your area loops to be spatialised within the game. This is entirely your choice, but the general rule is that they should not be spatialised (the sounds in the video above are not spatialised) – this means that the sounds will appear to just ‘exist’ in that space and not come from a specific location, and so won’t pan as the player moves around. Having area loops that are spatialised can feel disconcerting.
You can switch spatialization on and off using the Enable Spatialization property within the Attenuation Spatialization section (we’ll look at this section and its settings in the Source Loops section later).
This video gives a quick demo of the difference between spatialised and non-spatialised area loops.
Spatialization Comparison
Popular on A Sound Effect right now - article continues below:
HIGHLIGHTS:
-
82 %OFFEnds 1733353199
-
70 %OFFEnds 1733353199
Source Loops
Source loops are the sounds for specific objects / things in your world (but obviously, only those that would produce a looping sound – we’ll cover ‘non-looping’ objects next…). For example, there might be a generator-like machine within one of your spaces, or a waterfall in an outdoor space. These sounds would typically be mono, but you could use stereo if the object is large and you want to embed some natural width to the sound. Again, as with area loops, you’re going to need to ensure that your sound loops correctly.
Once you’ve got your sounds into the engine, and have edited the assets to make them looping sounds, you can drag them into the editor and position them in the same world location as your visual asset.
Now you can set up your attenuation settings to create the falloff behaviour you want from you sound, in terms of how far your sound should be audible as you move away from the object. The most typical Attenuation Shape for use with source loops would be Sphere as this emulates how sound propagates in the real world, but other shapes are available – choose the one that best suits the intended purpose and behaviour of your sound. The same goes for the Attenuation Function – choose the one that sounds best for your sound and situation.
Given that we want our source loops to actually come from the object that is producing the sound, we want to make use of the Spatialization settings, and so you’ll need to set the Enable Spatialization property to true.
This then allows you access to the settings that determine how the sound will be spatialized within your game. There are 2 Method options available within the Unreal engine by default:
If your game is going to be played on speakers (at any point), then you’re probably best off leaving the option set to Panning, but if you know that your players will be using headphones, you can make use of the Binaural option.
It’s worth experimenting with the Non-Spatialized Radius property, particularly if your object/sound is supposed to be quite loud and enveloping when up close – this can help reduce the sense of ‘sudden flipping’ that can occur when a point source sound moves across the player’s position (either because the sound itself is moving or because the player moves). This property defines a distance within which the sound will start to transition from fully spatialized (outside this distance) to being fully non-spatialized (at the sound’s origin).
Non-Spatialized Radius
Something to think about with source loops is the use of multiple AmbientSound actors (each playing a separate sound) to create layers within your sound that come in at differing distances – this can help emulate the fact that different levels of detail are audible within sounds at different distances.
Layering Source Loops Over Distance
There are other ways of achieving this same effect, but this is a pretty quick method and gives you quite a bit of control over how the different layers come in and out over distance.
If at this point you find yourself setting up the same sound across multiple objects / locations within your level, you may want to think about creating a Sound Attenuation asset so that you can re-use this and assign it to your AmbientSound actors. To create an Attenuation asset, simply right-click in your Content Browser and go to Sounds / Sound Attenuation.
You can then open the asset and set up your attenuations and then within the AmbientSound actors assign this to the Attenuation Settings property (you’ll need to disable the Override Attenuation).
The Ambient and Procedural Sound Design course on the Epic Online Learning site was produced by myself and Richard Stevens, and takes you through the principles of audio implementation within the Unreal Engine. We cover topics such as asset management and organization, looping sounds, one shots, attenuations, spatialization, occlusion, and procedural systems for the control and playback of sounds using both Sound Cues and Blueprints. By the end of the course, you should have a good understanding of interactive audio principles, and you’ll have the tool and knowledge to implement effective ambient sound into your games. The course comes with a full game world project that you can download that contains a fully populated level along with an ‘empty’ level (sound-wise) that you can use to follow along with the various techniques as we go.
Learn more about the course here
One Shots
So far, we’ve been using simple looping sounds to create the basis of a space’s sound, but if want to do anything more ‘complicated’ than playing back a single looping sound, then we’re going to need to look at the Sound Cue system – we can use this to create ‘systems’ that govern how sounds are played back within Unreal. For example, we may want to create a system that plays back a randomly selected bird sound at randomly timed intervals – while this may sound like quite a complex thing to build yourself, this can be achieved relatively easily through Sound Cues.
To create a new Sound Cue asset, right-click in the Content Browser, and go to Sounds / Sound Cue.
You can then double-click the newly created asset to open the Sound Cue Editor.
You can add new nodes to the Sound Cue by right-clicking in the empty space and selecting from the available list – if you have one or more Sound Wave assets selected in the Content Browser when you do this, then you get some ‘contextual suggestion’.
Let’s have a look at how we might create the birds example from above to get a feel for how Sound Cues work…
In the image below, there are 4 different variations of a bird call all connected to a Random node followed by a Delay node, and then a Looping node.
So, when this Sound Cue is activated, the Delay node is triggered which causes the system to pause for a period of time, after which one of the bird calls is randomly selected and played. The system then ‘loops’ and after another pause, another bird sound is selected and played. This continues for as long as the Sound Cue is active – it is the system that ‘loops’ rather than the sound itself that loops.
All of the nodes within a Sound Cue have their own unique set of properties, which you can access and change in the Details window. For example, the Delay node allows you to set Min and Max time values, meaning that you could (as illustrated below) create a system that produces a bird call sound at a random time between 1 and 12 seconds.
Sound Cues can be assigned to AmbientSound actors in the same way as simple Sound Waves, and so they can be placed in the level, and as they are an ‘asset’ they can easily be re-used multiple times. Not only does this make populating your worlds with sound a little quicker, it also means that if you use randomly generated times for the Delay node it can help you to produce non-repeating environments due to the changing combinations of sounds as the player moves around.
One Shot Sound Cue System
Reverb
Reverb is obviously fairly important for creating a convincing environment, and luckily it’s pretty simple to set up within Unreal – we can define different areas within our level, and assign appropriate reverbs to each one.
The first step is to create an Audio Volume within the level and set it’s location, shape, and size to match the space. From the Place Actors tab, go to Volumes and drag an Audio Volume into your level.
To start with your Audio Volume will just be a small wireframe cube
You can choose from a few different shapes, but the most typical shapes are Box (CubeBuilder), Cylinder (CylinderBuilder), and Sphere (TetrahedronBuilder). Once you’ve decided on the most appropriate shape, you can then define its size using the remaining properties within the Brush Settings section (these will change depending on the chosen shape).
The next step is to assign an appropriate Reverb Effect asset to the Audio Volume – there are a number of different reverbs within the engine (you’ll need to enable ‘Show Engine Content’ in the View Options), or you can create your own.
To create your own Reverb Effect right-click in the Content Browser and go to Sounds / Effects / Reverb Effect.
You can double-click the newly created asset to open it to edit the parameters in order to get the most appropriate reverb for your space.
At this point, you can test out your reverb, but there is one more thing you’ll want to check… As part of the Sound Attenuation settings for every sound, there is an Attenuation Reverb Send section which determines how much of the sound is sent to the current reverb effect based on the distance of the sound to the player. For the majority of sounds, the default settings will be fine.
The defaults will produce a drier sound the closer you are to the sound, and a wetter sound as the distance increases (which matches our experience of the real world). However, you may find that for ‘player sounds’, such as weapons and footsteps, you may want to increase the Reverb Min Send Level as these sounds will be very close to the player (if not at the same location) and with the default settings will only have a minimal amount of reverb applied.
Reverb Over Distance
The next thing to look at is how we can do ‘nested’ reverbs – there may well come a time when you have, for example, a small cave inside a larger cave. You would likely want to have different reverb effects for the different sized caves, but how does the engine know which reverb effect you want to use? The small cave is inside the larger one, so you’re technically inside of both…
To tell which Audio Volume (and therefore reverb) we want the engine to use we set the Priority within the Audio Volume’s properties. If we are technically speaking inside of multiple Audio Volumes, then the one with the higher Priority setting is the one that will be used.
So, in this example, we’d set the Priority of the large cave’s Audio Volume to 0, and the small cave’s Priority to 1. We can then use the Fade Time of the Reverb section of the Audio Volume’s properties to determine the speed of the transition between different reverbs as we move in and out of Audio Volumes.
Nested Reverbs
Highlights from A Sound Effect - article continues below:
Triggering Sounds
So far, everything we’ve looked at has involved a relatively ‘passive’ use of sound, in that the sounds are in the world and automatically playing. In order to create more compelling game experiences, you may want to trigger sounds to play at specific points within the game.
To do this, we need to use Unreal’s Blueprint system, which allows us to build complex systems that can control any aspect of the game using a graphical environment rather than writing code. Covering Blueprints in any kind of detail is beyond the scope of this article, but we can build a pretty simple system that will trigger a sound to play quite easily – so let’s do that.
In this scenario we’re going to trigger a ‘stinger’ effect when the player enters a specific section of the game, as a kind of sonic reward. The first step is to create a Box Trigger by dragging it in from the Basic section of the Place Actors tab.
You can then set its location and size as you need.
Now, with the trigger actor selected in the level, open the Level Blueprint using the Blueprints button.
You’ll be presented with an empty space (which can be a little daunting at first), but just like with Sound Cues, there is a degree of context-based suggestion available. Right-click in the blueprint and expand the sections to get to Add On Actor Begin Overlap (once you know what things are called you can just type their names).
This will create a node that fires off every time something enters the Trigger Box.
Drag off from the exec pin (the white triangle) and type ‘Play Sound 2D’, and then select that node from the list.
Congratulations! You’ve just created your first Blueprint system. Now you can assign your sound to the Sound property of the Play Sound 2D node.
Triggering Sounds
We used a Play Sound 2D node here because we’re playing a ‘non-diegetic’ stinger sound which we don’t want to be spatialized within the world (we want it to just play straight to the speakers/headphones), but if you wanted to play a sound and have it spatialized you could use the Play Sound at Location node.
Blueprints are very powerful, and it’s certainly worth spending some time learning what you can do with them if you want to build any form of interactivity into your sound systems… Having even just a passing knowledge of Blueprint systems will enable you to create prototype systems and tap into systems produced by other game dev disciplines – all of which will empower you as a game sound designer and make you more valuable within your team.
There is a lot more that you can do with the Unreal audio engine, for example, the attenuation settings allow you to set up occlusion on individual sounds, there are now some pretty complex analysis tools that you can use to drive gameplay elements, sample accurate timing of sounds and music is now possible using the Time Synth system, there are a range of different DSP effects that can be applied to sounds and sub-groups of sounds, you can route incoming audio from a microphone directly into the game-world, to name just a few. But covering these would take us beyond the scope of a ‘primer’, so if you’re interested in taking things beyond the basics in Unreal, then come check out our course (and future courses)…
Please share this:
-
20 %OFF
-
25 %OFF
-
30 %OFF