# Get length/duration of Programmer Instrument audio table loaded sound

**URL:** <https://qa.fmod.com/t/get-length-duration-of-programmer-instrument-audio-table-loaded-sound/13911>\
**Category:** Unity\
**Created:** [May 30, 2018, 12:57am UTC](https://qa.fmod.com/t/get-length-duration-of-programmer-instrument-audio-table-loaded-sound/13911 "2018-05-30T00:57:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![facaelectrica](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/facaelectrica/32/105_2.png) [@facaelectrica](https://qa.fmod.com/u/facaelectrica)\
**Post date:** [May 30, 2018, 12:57am UTC](https://qa.fmod.com/t/get-length-duration-of-programmer-instrument-audio-table-loaded-sound/13911/1 "2018-05-30T00:57:11Z")

</div>

As the title says, I need to know the length of a sound (from an audio table) that is being called in an Event with a Programmer Instrument.

I’m using Programmer Instruments just like in the Unity example:  
[https://www.fmod.com/resources/documentation-api?page=content/generated/engine\_new\_unity/script\_example\_programmersounds.html#/](https://www.fmod.com/resources/documentation-api?page=content/generated/engine_new_unity/script_example_programmersounds.html#/)

Any help very appreciated!

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 1, 2018, 4:43am UTC](https://qa.fmod.com/t/get-length-duration-of-programmer-instrument-audio-table-loaded-sound/13911/2 "2018-06-01T04:43:41Z")

</div>

Calling createSound with the info from getSoundInfo will open an FSB, after which you need to call getSubSound. Then you should be able to get the length of this sound.

`
(After createSound)
FMOD.Sound subSound;
dialogueSound.getSubSound(dialogueSoundInfo.subsoundIndex, out subSound);
uint length = 0;
subSound.getLength(out length, FMOD.TIMEUNIT.MS);
`
