Info About : Quick and simple introduction to the
sound system used in UE3. It does not cover music. Target Audience : Unreal Engine users - Very basic
skill required Platform : Unreal Engine 3 Last Update : November 2007
Introduction
On first sight the sound system in UE3 will look
wholly different for the system used in UE1 and 2, but don't let
those initial differences scare you, once you get past those it's
pretty similar to UE1 and 2 with the biggest change being the Cue
Editor, which isn't even required for setting up a basic sound.
The Cue Editor lets you basically mix and alter sounds through a
node based setup, similar to the Material Editor or Kismet. The
Cue Editor is great to create complex audio samples with. For example, a blowing wind sound with a wolf
howling every 30 seconds and a some distant thunder every
20 seconds would be three sounds mixed in the Cue Editor.
If you only wish to play a single sound, you would usually do best by adding it
the old way, by simply placing a sound actor and adding the sound
to it. It wouldn't require the fancy Cue Editor. However, in certain circumstances it might be desirable to simply always resort to the Sound Cue editor as it will make future changes easier. For example, lets say you have five levels, and in every level there are 10 sound actors with an alarm sound. During beta testing you find out that none of the alarms sound loud enough and you have to modify the volume of all 50 sound actors manually. Where as, if you would have used the Sound Cue editor you would only need to change the volume just once, and simply save the package.
If you only create a single level with not a huge amount of sound, it is easier to just use simple ambientsounds for most things, however, for larger projects such as entire games or large mods, it would probably be advisable to use the Sound Cue Editor even for sounds that may not really require it.
So there are two different systems now, and two different actors:
AmbientSound - This actor must use a cue and is therefore the
more advanced approach.
AmbientSoundSimple - This actor can not use a cue, and requires
a simple wav to play. This is exactly how it was in UE1 and 2.
And besides those two, the third system would be triggered sounds,
which are now embedded into Kismet. This tutorial will cover all
three systems.
The Basics
Importing sound is really simple. Sounds must be wav files, and must be 16 bit stereo. The frequency doesn't really matter but 22k Hz could be considered standard. UnrealEd does not like files with spaces in so be careful with those.
In the Editor go to the Generic Browser - top menu File - Import - select the wav's and import them. UnrealEd will display a dialog box asking for the package, group, filename, and a number of other options.
No names may contain spaces. You do not need to enter a Group name.
Of the options is bAutoCreateCue of most importance. If you intent to use the sound on a AmbientSoundSimple actor, you might want to disable this option as it will only create unnecessary stuff in your package. You can still manually create a cue if you do wish to come back on your decision later on.
Once imported you can play the files by double clicking them in the Generic Browser.
Placed sounds can be played in the editor by pushing the little joystick button at the top left of every viewport.
AmbientSoundSimple
In the Actor Browser navigate to Keypoint - Ambientsound - AmbientSoundSimple. Do not expand AmbientSoundSimple further, just use the main class. Then, in the level rightclick a surface and pick Add AmbientSoundSimple. You may need to have the sound you want to use selected in the Generic Browser while going through these steps.
Open It's properties and navigate to the AmbientSoundSimple section, and enter the wav sound, if it hasn't done so already.
Options given:
bAttentuate - If enabled the sound will fade out dependent on the distance to the player. bSpatialize - Required for positioning. Used to let the engine localize where the sound is coming from (3D/Surround sound) DistanceModel - How to fade out the sound dependent on the distance. MaxRadius - How far the sound can be heard, bAttentuate must be enabled for this to function. MinRadius - When inside this radius, the sound will be played at full volume. PitchModulation - How fast the sound is played, great to give some variation to the sound. VolumeModulation - Likewise, adds variation to the volume of the sound.
The LPF settings are unknown to me at this point.
AmbientSound - Cue Editor
In the Actor Browser navigate to Keypoint - AmbientSound, and rightclick on a surface in the level to add it. Note, pick Ambientsound and not one of its subclasses, you really want the top class which is directly below Keypoint.
If it hasn't done so automatically yet, navigate to the section Audio in its properties, and add the desired SoundCue to the actor. As you can see the AmbientSound has a whole less options available than the AmbientSoundSimple actor, not even the radius can be set. The actor relies entirely on the information in the Sound Cue.
To go to the Sound Cue Editor, go to the Generic Browser, rightclick the Sound Cue, and pick Sound Cue Editor at the top of the rightclick menu.
By default you will have two expressions available: the actual sound wav itself, in this case "wind", and Attenuation which controls the radius of the sound. Remember how bIncludeAttenuationNode was enabled in the import dialog window? That automatically created the Attenuation expressions you're seeing. If you were to remove the Attenuation node and connect the sound directly to the speaker, the sound would be played full volume without taking its source into account.
By rightclicking new expressions can be added to further alter the sound. Expressions can be moved by holding Ctrl and drag the mouse, connections can be made by dragging from one little black square to another. Alt clicking a connection will disconnect it.
These expressions are available:
Attenunation - This sets the radius of the sound. Concatenator - Adds two sounds together, but it will only play the second sound after the first one is finished, and vice versa. Delay - A pretty obvious expression, it will delay a sound with a random X number of seconds, dependent on the minimum and maximum DistanceCrossFade - Fades two sounds dependent on distance. The closer you get, the less you'll hear of one sound and the more you'll hear of the other. Looping - Continuously loops a sound. Variables are available to set the maximum number of loops permitted. SoundNodeMature - Pretty useless for regular use. Used to make the game filter out inappropriate language when mature content is disabled. Mixer - Mixes at least two sounds together. It also offers variables to determine the strength of every input. Modulator - Modifies Pitch and Volume. ContinuousModulator - Similar to Modulator, only this one allows the Pitch and Volume to be altered in real time. This needs to be used in combination with code. Oscillator - Likewise, this modifies the Pitch and Volume real time, but can be used without additional code. Can alter the sounds to add more variation. Random - Rather obvious, it randomly uses one of its inputs. SoundNodeWaveParam - Similar to the Param's in the Material system. Allows the Sound Cue to be accessed via code.
To add another sound to the editor, select the wav (not another cue!) in the Generic Browser while having the Cue editor open, and rightclick in the Cue Editor, it should now display an additional item in the rightclick menu, allowing you to add another sound.
Following setup mixes a door sound with a wind sound.
Two sounds, a door and a wind sound. The wind is set to loop by the Looping expression, it's pitch and volume is modified by the Modulator, and it is given a radius by the Attenuation. Likewise for the door sound, except for the Delay, which causes the door to only play every four seconds. The result is then mixed together.
By adding the Looping after the Delay, the sound loops with a pause. Adding the Looping in front of the Delay would result in a sound that would wait for X seconds to play for the first time, but continuously loop afterwards without taking the Delay expression into account.
Triggered Sounds - Kismet
Having a sound play when an elevator or a door is activated, having an alarm go off, having a sound play when a certain condition such as "player has X health", and so on is all done via Kismet, the visual scripting tool of UE3.
Setting it up is really simple. Rightclick in Kismet - Action - Sound - Play Sound, and in its properties, be sure to enter the desired Sound Cue. Also, you must set an actor as the target for the sound, or it wouldn't know where it needs to be located. Select the actor you wish to use, in my example it was an emitter, and rightclick in Kismet and pick New Object Var Using "NameOfActor", and connect it to Target. You're done. There's not more to it than that.
Following setup plays a sound once a Matinee sequence (could be an elevator or a door) has completed, it uses an emitter as its source/target.
Copyright 2006-2010 - Sjoerd "Hourences" De Jong - HTML by Frank Bakker