# Footsteps Audio

{% hint style="info" %}
This doc page is for release v39 onwards
{% endhint %}

The `BPC_M2Example_FootstepsAudioComponent` is our example implementation of adding sound effects when characters take footsteps, or land after being airborne.

## Summary of the implementation

### Linking footstep audio to our animations

Each of our animations with footsteps triggers a notify: `AnimNotify_Audio_MovementSystem`

<figure><img src="/files/HfDBN5lIpSbPP73pj10r" alt=""><figcaption></figcaption></figure>

The bone associated with the footstep (used to determine left vs right foot), and the "audio movement state" (i.e. whether the footstep is a regular step vs landing after a jump etc.) are passed in to the notify.

These notifies are then passed to any components on the animated actor that implement `BPI_Footstep_Listener`, triggering `NotifyFootstep` - both the `BPC_M2Example_FootstepsAudioComponent` and the deprecated `BPC_Audio_MovementSystem` implement this. These components then determine what sound effect to play (see the section below)

### Handling different audio based on terrain

Responding to the `NotifyFootstep` event, the `BPC_M2Example_FootstepsAudioComponent` uses a line trace to determine what physics material is underfoot.

<figure><img src="/files/u5OaZMoAEgoiINtJzyVq" alt=""><figcaption></figcaption></figure>

We use this physics material to map to a footsteps sound asset, via the `FootstepSoundsDataAsset` property in the component. This maps to a data asset which contains a map, along with a default sound for when we are using an unknown physics material.

<figure><img src="/files/3800OH4faCiUe20O0mdX" alt=""><figcaption></figcaption></figure>

If you want to add more physics materials to the list, or swap out the sounds used, you can replace the `FootstepSoundsDataAsset` with your own `BP_M2Example_FootstepSounds` Data Asset. We recommend copying one of the existing `A_M2Example_Foley_Footsteps_[X]` assets as a starting point, and swapping out the `Sounds_[Y]` arrays inside

#### "Land" sounds vs "Moving" sounds

For each material, we want the sound played when landing after a jump to be different to regular footsteps. Therefore, we pass in whether the `NotifyFootstep` was from a "Land" notify or not into the sound. Our sound sources use this to determine what sound to play.

See `A_M2Example_Foley_Footsteps_Grass` for an example.

<figure><img src="/files/qX7m1oy8bIksf0K7R7Xh" alt=""><figcaption><p>Each sound source has a list of sounds for "movement" footsteps and "landing" footsteps, and it picks one at random, adding some slight pitch shifting, to add variation between each footstep.</p></figcaption></figure>

In our basic example, the only different "movement states" we care about are "Land" vs the rest (movement related states, i.e. walk, jog, sprint)

<figure><img src="/files/Whp7KM3wWUBvrqIwOuJm" alt=""><figcaption><p>The "Jump" state is effectively ignored, since we don't trigger any notifies in our animations for it.</p></figcaption></figure>

## I was using the now deprecated BPC\_Audio\_MovementSystem. Anything to be aware of?

The new stripped down example `BPC_M2Example_FootstepsAudioComponent` is similar to the now-deprecated `BPC_Audio_MovementSystem`, but has some changes to be aware of:

* The "wind audio" has been separated out into `BPC_M2Example_InAirWindAudioComponent`. If you want the wind noise playing while airborne, you can add this component too.
* The physics material-to-audio source mapping, and the audio sources themselves have been modified - see [#handling-different-audio-based-on-terrain](#handling-different-audio-based-on-terrain "mention"). The old data table approach (i.e. `DT_M2_Audio_FootstepSounds`), and the old audio cues with integer `MovementState` will not be compatible. If you want to use the old system, we recommend making local copies of the deprecated assets, and using those.
* Our example footsteps component doesn't pitch shift footsteps based on the actor's size. The old logic from `BPC_Audio_MovementSystem::BindMorpheusEvents` could be copied across to your own implementation if desired, but we recommend using the new resizing component, outlined in [Resizing](/platform-documentation/creation/unreal-development/features-and-tutorials/the-m2-example-plugin/resizing.md).
* Our example has a more limited physics material-to-sound source mapping. If your project has materials that you need audio for, you can add them as outlined above in [#handling-different-audio-based-on-terrain](#handling-different-audio-based-on-terrain "mention")


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.otherside.xyz/platform-documentation/creation/unreal-development/features-and-tutorials/the-m2-example-plugin/footsteps-audio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
