# How about to share experiences in optimization

**URL:** <https://qa.fmod.com/t/how-about-to-share-experiences-in-optimization/11204>\
**Category:** FMOD Studio\
**Created:** [November 4, 2013, 1:11am UTC](https://qa.fmod.com/t/how-about-to-share-experiences-in-optimization/11204 "2013-11-04T01:11:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdkid1412](https://avatars.discourse-cdn.com/v4/letter/g/898d66/32.png) [@gdkid1412](https://qa.fmod.com/u/gdkid1412)\
**Post date:** [November 4, 2013, 1:11am UTC](https://qa.fmod.com/t/how-about-to-share-experiences-in-optimization/11204/1 "2013-11-04T01:11:55Z")

</div>

I’m trying to embed fmod in our engine.I currently use only the lowlevel api.  
But I find it’s pretty slow when playing a sound.  
I just think How about to share experiences in optimization?

---

<div class="post-metadata">

**Author:** ![gdkid1412](https://avatars.discourse-cdn.com/v4/letter/g/898d66/32.png) [@gdkid1412](https://qa.fmod.com/u/gdkid1412)\
**Post date:** [November 6, 2013, 1:46am UTC](https://qa.fmod.com/t/how-about-to-share-experiences-in-optimization/11204/2 "2013-11-06T01:46:52Z")

</div>

In fact I do not have any experience,I just hope to discuss it with others.  
For 3D sound I just use a list to manage the FMOD::Sound\*, put the most common one in front.  
How to decide the size of the list? I mean a appropriate number.  
But I still feel it’s a little slow when loading a new sound.I just use the default configuration such as FMOD\_INIT\_NORMAL and my file callbacks.Is there a settings or parameters something can make it faster?

---

<div class="post-metadata">

**Author:** ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)\
**Post date:** [November 11, 2013, 11:42pm UTC](https://qa.fmod.com/t/how-about-to-share-experiences-in-optimization/11204/3 "2013-11-11T23:42:23Z")

</div>

Hi ,  
What do you mean by ‘slow’? FMOD is used in many commercial games because it is low overhead, playing 1 sound is basically negligible. Are you doing something like accidently loading the same sound every single frame?  
What metrics are you using to test performance? Playing 1 sound would execute about 3 DSP nodes which would add up to less than 0.05% of a current cpu including base overhead.

---

<div class="post-metadata">

**Author:** ![gdkid1412](https://avatars.discourse-cdn.com/v4/letter/g/898d66/32.png) [@gdkid1412](https://qa.fmod.com/u/gdkid1412)\
**Post date:** [November 12, 2013, 1:47am UTC](https://qa.fmod.com/t/how-about-to-share-experiences-in-optimization/11204/4 "2013-11-12T01:47:49Z")

</div>

I do not mean play a sound is cost a lot.  
I mean the first time I play a sound, I read the sound file into memory by my IO and register the sound resource. Then call createSound to create a FMOD::Sound. This process is a little slow.  
Such as the first time triggering a effect animation, we load a lot of stuff like particle,testure, mesh except sound.So I want as far as possilbe to shorten the loading time.  
That’s I mean Is there a settings or parameters something can make it faster?  
I think about using FMOD\_FILE\_ASYNCREADCALLBACK once,just want to have a try.But I don’t find the asyncio example.

---

<div class="post-metadata">

**Author:** ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)\
**Post date:** [November 12, 2013, 1:52am UTC](https://qa.fmod.com/t/how-about-to-share-experiences-in-optimization/11204/5 "2013-11-12T01:52:47Z")

</div>

That is not what the asyncio example is for, that is for deferred file read callbacks which are a different topic all together. It should probably be called job\_based\_io or deferred\_io or something to avoid confusion.

Simply add FMOD\_NONBLOCKING to your createStream/Sound call, to make the loading operation happen in the background.  
Sound::getState can be used to determine when it is ready, or you can just keep calling System::playSound until it succeeds with FMOD\_OK (instead of FMOD\_ERR\_NOTREADY).

Next, to reduce load time you can do 2 things.  
Turn off file seeking to the end of the file, with FMOD\_IGNORETAGS flag.  
Turn off formats you don’t want to query, and just tell fmod what file format you are using, use FMOD\_CREATESOUNDEXINFO::suggestedsoundtype for that, this will be your biggest speedup.

There will always be a delay between calling createSound/Stream and hearing it with playsound, but if you preload your sounds or streams, you won’t get a delay.
