There’s a couple of ways to accomplish what you’re trying to do.
The simplest would be to essentially implement a “manual” WAVWRITER by placing a Capture DSP somewhere in your system to retrieve audio data and store it in memory, and then writing the captured data to a WAV file as required at a later point. A simple example script that does this can be found here: Capturing Unity game’s FMOD output (5.1 / Busses) - #7 by Leah_FMOD
A step up in complexity would be to use actually the WAVWRITER output, which will, if you’re using the FMOD for Unity integration, require you to make some changes to the integration code. A simple example of using the WAVWRITER output with the FMOD integration can be found here: Capturing Unity game’s FMOD output (5.1 / Busses) - #2 by Leah_FMOD
For your purposes, however, this will likely require you to reinitialize the existing system, or initialize a separate system, in order to both pass the intended WAV filepath as extradriverdata
for Studio::System::initialize
, and to set the output to WAVWRITER (the output can be changed after init on Android, but not on iOS). This may be more or less difficult depending on the complexity of your music app - i.e. if the “state” of events and parameters in your music app are essentially “saved” outside of the FMOD system, and you definitely don’t require simultaneous playback AND writing, it should be on the simpler side of thing to initialize a new system and swap to it to write to WAV. If this isn’t the case, it may be more complex.
The previous two methods both work in real-time. If you’re able to get WAVWRITER working for you, the next step up would be to use WAVWRITER_NRT instead, which will allow you drive audio mixing from Studio::System::update
and record/write as fast as possible, without needing to wait for events to play out in real-time.