# Silence at the beginning of wav-file when using FMOD\_OUTPUTTYPE\_WAVEWRITER\_NRT

**URL:** <https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156>\
**Category:** FMOD Studio\
**Created:** [November 17, 2015, 9:50am UTC](https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156 "2015-11-17T09:50:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![g.fishilevich](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@g.fishilevich](https://qa.fmod.com/u/g.fishilevich)\
**Post date:** [November 17, 2015, 9:50am UTC](https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156/1 "2015-11-17T09:50:48Z")

</div>

Hi there,

using FMOD\_OUTPUTTYPE\_WAVEWRITER\_NRT to generate a wav-file as output, it works so far, but there are ~6 seconds silence at the start of every output file. I don’t see anything in docs about that. May be someone can help me?

(If I playing this bank live, without recoding, the will be played normal, without silence. Tests in FMOD Studio works as well)

Here is what I’m doing:

ERRCHECK( lowLevelSystem-\>setOutput(FMOD\_OUTPUTTYPE\_WAVWRITER\_NRT) );  
ERRCHECK( lowLevelSystem-\>setDSPBufferSize(1024, 16) );  
ERRCHECK( lowLevelSystem-\>setSoftwareFormat(48000, FMOD\_SPEAKERMODE\_STEREO, 0) );

ERRCHECK( system-\>initialize(32, FMOD\_STUDIO\_INIT\_NORMAL, FMOD\_INIT\_STREAM\_FROM\_UPDATE, extraDriverData) );

// here skip … loading banks, event, parameter …

ERRCHECK( surfaceParameter-\>setValue(0.0f) );  
ERRCHECK( eventInstance-\>start() );

for(int i = 0; i \< totalCalls; i++)  
{  
ERRCHECK( system-\>update() );  
}  
ERRCHECK( system-\>release() );

(I’ve modifed the event\_parameter from the examples)

Thank a lot,  
Grigory

---

<div class="post-metadata">

**Author:** ![g.fishilevich](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@g.fishilevich](https://qa.fmod.com/u/g.fishilevich)\
**Post date:** [November 17, 2015, 11:29am UTC](https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156/2 "2015-11-17T11:29:28Z")

</div>

I figured out some things, seems strange to me.

The param “surfaceParameter” is 0 - 6.  
If I set output mode to a kind “live” - I can start at every level (0-6) and it works.  
With wavwriter all levels except 6 creates silence at the beginning.

---

<div class="post-metadata">

**Author:** ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)\
**Post date:** [November 17, 2015, 10:57pm UTC](https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156/3 "2015-11-17T22:57:57Z")

</div>

Pass FMOD\_STUDIO\_INIT\_SYNCHRONOUS\_UPDATE to the second argument of Studio::System::Init(), otherwise Studio will create a thread that is ticking the low-level update in the background and writing WAV data when you don’t want (during your load for example).

---

<div class="post-metadata">

**Author:** ![g.fishilevich](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@g.fishilevich](https://qa.fmod.com/u/g.fishilevich)\
**Post date:** [November 18, 2015, 9:54am UTC](https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156/4 "2015-11-18T09:54:35Z")

</div>

> [@](#):
>
> Pass FMOD\_STUDIO\_INIT\_SYNCHRONOUS\_UPDATE to the second argument of Studio::System::Init(), otherwise Studio will create a thread that is ticking the low-level update in the background and writing WAV data when you don’t want (during your load for example).

I’ve tried the FMOD\_STUDIO\_INIT\_SYNCHRONOUS\_UPDATE as well, it’s all the same. Anyway this mode will be forced on using wavwriter (I did debug on to analyze this issue).

---

<div class="post-metadata">

**Author:** ![g.fishilevich](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@g.fishilevich](https://qa.fmod.com/u/g.fishilevich)\
**Post date:** [November 18, 2015, 10:04am UTC](https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156/5 "2015-11-18T10:04:11Z")

</div>

The main point I did not understand is:

- the bank has 7 markers (for every parameter value 0-6).
- all markers / transitions works as expected in FMOD studio and works as expected without wavwriter mode

but, in wavwriter mode ERRCHECK( surfaceParameter-\>setValue(6.0f) ); only produces no silence at the beginning, the music sounds immediately.

All over values (0-5) creates silence at the beginning. And the silence length is not constant, it’s between 5-7 seconds.

The wavwriter mode is update() driven, the only difference ist the params value which I start with. Param value = 6 -\> no silence, Param value 0-5 -\> silence on start. Happens only with wavwriter.

I’ve attached the screenhot of the fmod project, the marker 6 is at the end.  
 ![banks](https://cdn.pbrd.co/images/2e2O2cVm.png)

---

<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 18, 2015, 10:39am UTC](https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156/6 "2015-11-18T10:39:03Z")

</div>

ERRCHECK( lowLevelSystem-\>setDSPBufferSize(1024, 16) ); seems excessive, it should be 1024,2 with NRT, you dont need 15 buffers ahead, which will be silence at the start.

---

<div class="post-metadata">

**Author:** ![g.fishilevich](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@g.fishilevich](https://qa.fmod.com/u/g.fishilevich)\
**Post date:** [November 18, 2015, 11:21am UTC](https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156/7 "2015-11-18T11:21:16Z")

</div>

> [@](#):
>
> ERRCHECK( lowLevelSystem-\>setDSPBufferSize(1024, 16) ); seems excessive, it should be 1024,2 with NRT, you dont need 15 buffers ahead, which will be silence at the start.

It helps a little. With (1024,2) the silence got shorter, about 2 sec. not 5 sec. But, on DEBUG compile only, on RELEASE it’s still the same.

---

<div class="post-metadata">

**Author:** ![g.fishilevich](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@g.fishilevich](https://qa.fmod.com/u/g.fishilevich)\
**Post date:** [November 18, 2015, 11:23am UTC](https://qa.fmod.com/t/silence-at-the-beginning-of-wav-file-when-using-fmod-outputtype-wavewriter-nrt/12156/8 "2015-11-18T11:23:13Z")

</div>

It seems to me, NRT ist NOT only update() driven as API docs say.  
It seems to me, wav file will be written before any update(), on setParam() or event-\>start().
