Play sound while

Hello guys !

I am new to UE and I didn’t find answer to my question yet.

I would like to play a sound WHILE my condition is true.
I mean, let’s say my sound is 30 sec long.
If my IF condition is true for like 10 sec, I want the sound to play from 0:00 to 0:10.
If my IF condition is true for like 5 sec, I want the sound to play from 0:00 to 0:05.

( I want my turret to play a mechanism sound while it is rotating to align target )

All I managed to do until now, is create bug loop or sound playing on top of each other.

Can anybody explain me ? Thank you a lot.

Use the Stop node to stop the sound playing when the condition is false (see Stop | Unreal Engine Documentation )

This video covers some basics which might be helpful: MetaSounds in UE5: From Miniguns to Music | Unreal Engine - YouTube

There are some great courses covering audio in the Unreal online learning portal, such as:
Ambient and Procedural Sound Design
Dynamic Audio

Thank you JeKyan for all thoses ressources, i’m going to have a deep look a this.

Have a great day