# How to save 3D sound effects to wav files？

**URL:** <https://qa.fmod.com/t/how-to-save-3d-sound-effects-to-wav-files/14437>\
**Category:** FMOD Engine\
**Created:** [March 12, 2019, 3:54am UTC](https://qa.fmod.com/t/how-to-save-3d-sound-effects-to-wav-files/14437 "2019-03-12T03:54:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeros2619](https://avatars.discourse-cdn.com/v4/letter/z/7993a0/32.png) [@zeros2619](https://qa.fmod.com/u/zeros2619)\
**Post date:** [March 12, 2019, 3:54am UTC](https://qa.fmod.com/t/how-to-save-3d-sound-effects-to-wav-files/14437/1 "2019-03-12T03:54:11Z")

</div>

I designed a 3D sound effect, but the audio I saved is different from the one I previewed. How should I save the 3D sound effect?Here is the code I initialized to save:  
`
void FMODCore::saveInit3D(char *inputPath, char *outPath) {
FMOD_RESULT result;
result = system->setOutput(FMOD_OUTPUTTYPE_WAVWRITER_NRT);
ERRCHECK(result);
result = system->setSoftwareFormat(24000, FMOD_SPEAKERMODE_DEFAULT, 10);
ERRCHECK(result);
result = system->init(32, FMOD_INIT_NORMAL, (void *) outPath);
ERRCHECK(result);
result = system->set3DSettings(1.0, DISTANCEFACTOR, 1.0f);
ERRCHECK(result);
result = system->createSound(inputPath, FMOD_3D, 0, &sound);
ERRCHECK(result);
result = sound->set3DMinMaxDistance(0.5f * DISTANCEFACTOR, 5000.0f * DISTANCEFACTOR);
ERRCHECK(result);
}
`

---

<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:** [March 18, 2019, 2:38am UTC](https://qa.fmod.com/t/how-to-save-3d-sound-effects-to-wav-files/14437/2 "2019-03-18T02:38:17Z")

</div>

How is the sound different?

---

<div class="post-metadata">

**Author:** ![zeros2619](https://avatars.discourse-cdn.com/v4/letter/z/7993a0/32.png) [@zeros2619](https://qa.fmod.com/u/zeros2619)\
**Post date:** [March 19, 2019, 2:03am UTC](https://qa.fmod.com/t/how-to-save-3d-sound-effects-to-wav-files/14437/3 "2019-03-19T02:03:50Z")

</div>

The listener’s speed, position, and direction of movement are different from what I set.  
I solved this problem by using real-time save, but it was time-consuming.  
Can 3D effects be saved using NRT?

---

<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:** [March 21, 2019, 2:03am UTC](https://qa.fmod.com/t/how-to-save-3d-sound-effects-to-wav-files/14437/4 "2019-03-21T02:03:05Z")

</div>

Nothing in the system knows what the output is or behaves differently because of it.

How are you measuring the difference?

This post may help with understanding FMOD\_OUTPUTTYPE\_WAVEWRITER\_NRT a bit more:

> The way FMOD\_OUTPUTTYPE\_WAVEWRITER\_NRT works is it generates audio every time System::update is called. The amount of data generated per ‘update’ is governed by the bufferlength parameter of System::setDSPBufferSize.
> 
> So the faster you call System::update the faster the data is generated. Now the important part for your job is to convert ‘x’ number of calls to System::update into something you can match to your timeline.
> 
> By default FMOD operates at a sample rate of 48000 samples per second (configurable via System::setSoftwareFormat). So if you set ‘bufferlength’ to 1024, each time you call System::update 1024 samples will be generated (written to the wav file). So… 1024 / 48000 = 0.021333 seconds ~ 21.3 milliseconds of data is generated per call.

> <https://stackoverflow.com/questions/9082583/fmod-how-to-use-fmod-outputtype-wavwriter-nrt>
