Silence at the beginning of wav-file when using FMOD_OUTPUTTYPE_WAVEWRITER_NRT

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

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.

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).

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

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.

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().