Menu
Lumberyard
User Guide (Version 1.14)

Adding Ambient Sounds to Levels

This topic references tools and features that are legacy. If you want to use legacy tools in Lumberyard Editor, disable the CryEntity Removal gem using the Project Configurator or the command line. To learn more about legacy features, see the Amazon Lumberyard Legacy Reference.

Lumberyard has two audio entities that you can use to add ambient sounds to levels as well as Adding Reverb Effects to LevelsAudioAreaAmbience and AudioAreaEntity. Both entities are linked to a specified shape in a level that defines the area in which ambient sounds are triggered from.

You use these two entities to set multiple attributes with which you can define a PlayTrigger and StopTrigger, an environment, and a radius around the shape where your ambient sound starts to fade in and out.

To make use of the AudioAreaAmbience or AudioAreaEntity entity in a level, you must first create a new shape.

Note

The distance that is output by the AudioAreaAmbience and AudioAreaEntity entities is always scaled from 0 to 1 from the maximum range set in the RtpcDistance property. Therefore, the range of the RTPC (real time parameter control) value used by your middleware needs to be only 0 to 1.

To define an area shape for an audio entity

  1. In the Rollup Bar, on the Objects tab, click Area.

  2. Under Object Type, select either AreaBox, AreaSphere, or Shape. Then do the following:

    • In the case of AreaBox, click in your level to place it, and then under AreaBox Params, specify values for Width, Length, and Height.

    • In the case of AreaSphere, click in your level to place the shape, and then under AreaSphere Params, Radius.

    • In the case of Shape, click in your level to create points that define the boundaries of the shape. When finished, double-click the last point to complete the shape.

Note

The event listener, which is attached to the player character by default, needs to be inside an area shape for a sound to play. Set the shape's Height value to at least 15 to ensure there is room for the ambient sound to play even if the character jumps.

You can change an area shape by adding, removing, and moving points.

To edit a shape

  1. Select the shape in your level.

  2. In the Rollup Bar, under Shape Parameters, click Edit Shape.

  3. Select the applicable point on the shape and do the following:

    • Drag the point to move it to another location.

    • Press the Delete key to remove the point.

    • Press Ctrl+click to add a point to the shape

  4. When done, under Shape Parameters, click Reset Height to flatten the shape. This is useful when creating shapes over hilly terrain.

Note

If the Follow Terrain option was not selected, the area shape that you created may be located under the terrain. If so, select the Move tool and drag the shape up by clicking on the yellow z-axis arrow and dragging it up.

Setting Up the AudioAreaAmbience entity

The AudioAreaAmbience entity is the main audio entity for defining which ambient sound should play and how it should play, without the need to use the Flow Graph editor for advanced sound effects or behaviors.

To set up and link the AudioAreaAmbience entity

  1. In the Rollup Bar, on the Objects tab, click Audio.

  2. Under Object Type, click AudioAreaAmbience. Then click in your level to place the object.

  3. Under AudioAreaAmbience Properties, select the applicable property, and then click the folder icon that appears on the right. Do this for the PlayTrigger, StopTrigger, and Rtpc properties.

  4. In the Choose window, expand default_controls, select an ATL control to use for the property, and then click OK.

  5. For RtpcDistance, enter a value that represents the distance in meters at which sounds begin to increase in volume.

  6. Under Entity Links, select AudioAreaAmbience and click the Pick Target button. The object type is now linked to the shape that you created earlier.

  7. Press Ctrl+G to test the ambient sound.

The selected PlayTrigger control is called whenever the character is the distance away from the shape specified by the RtpcDistance value.

As the character moves closer towards or further away from the shape, the volume of the ambient sound increases or decreases in volume in accordance to the setup in your audio middleware. As long as your character is within the area shape, the sound plays without volume attenuation.

Setting Up the AudioAreaEntity entity

The AudioAreaEntity entity functions like the AudioAreaAmbience entity but requires manual setup in the Flow Graph editor to trigger the ATL controls. This extra step gives you access to multiple parameters and more advanced setup possibilities than the AudioAreaAmbience entity.

The AudioAreaEntity entity includes a FadeDistance parameter, which behaves like the RtpcDistance parameter except that it can be connected to any object in the Flow Graph editor and not simply to a default RTPC audio control.

Notice that the Properties panel does not include PlayTrigger or StopTrigger, as they are manually set up in the Flow Graph editor.

The AudioAreaEntity flow graph node does not have any playback functionality itself; Instead it triggers output when the character enters or leaves either the area shape or its outer values as defined by the fade distance. It also sends out a value that can be used to control any RTPC audio control with the Audio:Rtpc node. To use the AudioAreaEntity to enable playback of an ambient sound for your area, you need to add the Audio:Trigger and Audio:RTPC nodes to the flow graph.

After adding both nodes to the flow graph, right-click on each and select Assign Selected Entity. Now both the Audio:Trigger and the Audio:RTPC are set for the AudioAreaEntity entity.

A StopTrigger is not needed as the audio system automatically stops the PlayTrigger control if no StopTrigger is assigned. Ambient sounds that are set up using the AudioAreaEntity entity do not play by default as they are triggering the controls in the flow graph. To preview the AudioAreaEntity when not in game mode, click AI/Physics at the bottom of Lumberyard Editor.

Using Shape Priorities

When using multiple shapes in a level, you can set shape priorities to define how audio behaves when a character moves from one shape to another. You can set the priority per shape under Area, Object Type, Shape in the Rollup Bar.

When transitioning from one shape to another, the shape with the higher priority overrides the RtpcDistance and FadeDistance properties for lower priority AudioAreaAmbience and AudioAreaEntity entities respectively.

Note

With helpers enabled, pressing the spacebar on your keyboard displays pivots for all entities in a level. You can also do this to simplify the selection of areas that are nested together.

Select the DisplaySoundInfo check box to indicate any sound obstructions for the sides of an AreaBox or a Shape. Sound-obstructed sides appear in red and do not calculate ambient sound updates for that segment. Non-obstructed sides are displayed in green and do calculate ambient sound updates.