# Get Duration of Looping SoundCue

**URL:** <https://forums.unrealengine.com/t/get-duration-of-looping-soundcue/294795>\
**Category:** Audio\
**Tags:** unreal-engine, looping, question\
**Created:** [September 28, 2014, 4:16pm UTC](https://forums.unrealengine.com/t/get-duration-of-looping-soundcue/294795 "2014-09-28T16:16:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_243f69651](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_243f69651](https://forums.unrealengine.com/u/anonymous_user_243f69651)\
**Post date:** [September 28, 2014, 4:16pm UTC](https://forums.unrealengine.com/t/get-duration-of-looping-soundcue/294795/1 "2014-09-28T16:16:18Z")

</div>

I’m trying to get the actual duration of the sound file looped in a Sound Cue.  
When I try to get this using the GetDuration function it works fine when using a non-looped sound but as soon as I tick the ‘Looping’ check box in the Sound Cue Editor and save, the duration jumps up to 10000.000000.

Is there a way to get the actual duration of the looped wave file itself? I’ve tried using a workaround by checking if the sound is playing and restarting it when it has stopped playing but it doesn’t loop seamlessly in that case.

---

<div class="post-metadata">

**Author:** ![IdentityCrisisUK](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IdentityCrisisUK](https://forums.unrealengine.com/u/IdentityCrisisUK)\
**Post date:** [September 29, 2014, 9:47am UTC](https://forums.unrealengine.com/t/get-duration-of-looping-soundcue/294795/2 "2014-09-29T09:47:53Z")

</div>

In code we define INDEFINITELY\_LOOPING\_DURATION as 10000 to show that a sound will loop forever (and to ensure that anything using it literally won’t stop for a long time at least). Even in a non-looping SoundCue the duration can be a best guess, if there are random nodes involved or changes in pitch etc.

If you want to get the original duration of the sound file then you will need access to the SoundWave that you are using in the SoundCue (or just use a SoundWave instead of a cue if it is a simple sound loop). There you’ll want to check the Duration property (which is inherited from SoundBase). There is also a GetDuration function but this works just like the SoundCue, it returns INDEFINITELY\_LOOPING\_DURATION if the SoundWave’s Looping property is set.

If you do need to access the SoundWave from within the SoundCue, then I would advise using USoundCue::RecursiveFindNode like this:

```
// get all the waves this cue uses
TArray<USoundNodeWavePlayer*> WavePlayers;
Cue->RecursiveFindNode<USoundNodeWavePlayer>(Cue->FirstNode, WavePlayers);

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_243f69651](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_243f69651](https://forums.unrealengine.com/u/anonymous_user_243f69651)\
**Post date:** [September 29, 2014, 12:21pm UTC](https://forums.unrealengine.com/t/get-duration-of-looping-soundcue/294795/3 "2014-09-29T12:21:46Z")

</div>

Thanks, that did the trick. I’m using this to sync up multiple music tracks once they switch between one and another in our dynamic music system.
