> For the complete documentation index, see [llms.txt](https://docs.msquared.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.msquared.io/creation/unreal-development/features-and-tutorials/the-m2-example-plugin/footsteps-audio.md).

# 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/aGuY95IppAqNhoOGY6hc" 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/sscNRwa3SdanuWBoowcH" 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/nngA8xfp2SCpoob413po" 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/DANS65adpAbul6cPL60h" 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/VzgvQsYyD7E8DCOgyGBS" 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](/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")
