# Programmer Sounds length is always 0

**URL:** <https://qa.fmod.com/t/programmer-sounds-length-is-always-0/16955>\
**Category:** Unity\
**Created:** [March 28, 2021, 1:52pm UTC](https://qa.fmod.com/t/programmer-sounds-length-is-always-0/16955 "2021-03-28T13:52:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![florian13](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/florian13/32/597_2.png) [@florian13](https://qa.fmod.com/u/florian13)\
**Post date:** [March 28, 2021, 1:52pm UTC](https://qa.fmod.com/t/programmer-sounds-length-is-always-0/16955/1 "2021-03-28T13:52:59Z")

</div>

Hi,

I’m trying to programmatically get an async programmer sound length by doing:  
RuntimeManager.StudioSystem.getSoundInfo(key, out var dialogueSoundInfo);  
RuntimeManager.CoreSystem.createSound(dialogueSoundInfo.name\_or\_data, dialogueSoundInfo.mode, ref dialogueSoundInfo.exinfo, out var dialogueSound);  
dialogueSound.getLength(out var length, TIMEUNIT.MS);

but I always get a value of 0.

My code is based on this example: [https://www.fmod.com/resources/documentation-unity?version=2.1&page=examples-programmer-sounds.html](https://www.fmod.com/resources/documentation-unity?version=2.1&page=examples-programmer-sounds.html)

Any help would be much appreciated! Thanks

---

<div class="post-metadata">

**Author:** ![aishi](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/aishi/32/82_2.png) [@aishi](https://qa.fmod.com/u/aishi)\
**Post date:** [March 28, 2021, 11:18pm UTC](https://qa.fmod.com/t/programmer-sounds-length-is-always-0/16955/2 "2021-03-28T23:18:56Z")

</div>

Hi, can you try getting the target subsound and measuring that? I think the parent sound represents the bank itself if I’m not mistaken.

```
dialogueSound.getSubSound(dialogueSoundInfo.subsoundindex, out var subSound);
subSound.getLength(out var length, TIMEUNIT.MS);
```

---

<div class="post-metadata">

**Author:** ![florian13](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/florian13/32/597_2.png) [@florian13](https://qa.fmod.com/u/florian13)\
**Post date:** [March 29, 2021, 7:52am UTC](https://qa.fmod.com/t/programmer-sounds-length-is-always-0/16955/3 "2021-03-29T07:52:37Z")

</div>

That worked! Thank you so much @aishi

---

<div class="post-metadata">

**Author:** ![aishi](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/aishi/32/82_2.png) [@aishi](https://qa.fmod.com/u/aishi)\
**Post date:** [March 29, 2021, 9:27pm UTC](https://qa.fmod.com/t/programmer-sounds-length-is-always-0/16955/4 "2021-03-29T21:27:45Z")

</div>

You’re welcome! It’s great timing because I also just solved a related issue in my project.
