# Using Inspector to preview FMOD event

**URL:** <https://qa.fmod.com/t/using-inspector-to-preview-fmod-event/21106>\
**Category:** Unity\
**Tags:** unity, csharp\
**Created:** [January 16, 2024, 3:07am UTC](https://qa.fmod.com/t/using-inspector-to-preview-fmod-event/21106 "2024-01-16T03:07:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinth](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@martinth](https://qa.fmod.com/u/martinth)\
**Post date:** [January 16, 2024, 3:07am UTC](https://qa.fmod.com/t/using-inspector-to-preview-fmod-event/21106/1 "2024-01-16T03:07:02Z")

</div>

Hi there 🙂  
I’m currently working on a way to preview an FMOD event in the inspector when I press a button in a script while outside of playmode.

Essentially, my needs would be something like:

```auto
Public void PreviewSoundInInspectorOnButtonPress()
{
//Play FMOD event preview
]

```

If, additionally, anyone knew of a way to get the duration of the event, as well as how one would play from x seconds, that would be incredible too 😊

While FMOD has a way to preview audio already, this use case is relevant to me, as I need to sync some elements in the inspector 🙂

I’m afraid I’m not quite able to comprehend a lot of FMOD code currently, so if someone would be able to lay out the steps, that would really help me, and I’d be very thankful 🙂

Thank you for your time

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [January 19, 2024, 5:35am UTC](https://qa.fmod.com/t/using-inspector-to-preview-fmod-event/21106/2 "2024-01-19T05:35:03Z")

</div>

Hi,

If you want to play sounds outside of runtime you will have to create your own FMOD Studio system which can then play your events. We have C++ examples of creating Studio Systems included in the FMOD Engine download here: [Download FMOD - FMOD Engine](https://fmod.com/download#fmodengine). Then in the download, the example can be found here: `C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\examples\vs2019\examples.sln` I would suggest looking at the `simple_event` project.

In regards to getting the length of the event is isn’t that straight forward as you are actually trying to get the length of the audio source. You would have to dig down to the `FMOD.Sound` and call [Sound::getLength](https://fmod.com/docs/2.02/api/core-api-sound.html#sound_getlength).

Hope this helps!
