Recommended method for rendering FMOD Studio event waveforms

Hello,
I’m currently working on the Godot 4.5 source code, making a custom FMOD engine module. The rest of the integration is unimportant in its implementation, but I am currently dealing with rendering a waveform of Studio 2.03.13’s output of the provided event.

I’m using FMOD_OUTPUTTYPE_NOSOUND_NRT for the output type and initializing with the studio flags FMOD_STUDIO_INIT_SYNCHRONOUS_UPDATE and the core flags FMOD_INIT_STREAM_FROM_UPDATE | FMOD_INIT_MIX_FROM_UPDATE.

For the rendering itself, I’m setting up a capture DSP (attached to the master channel group) with a read that only appends the inbuffer across all channels to an external array and copies them to the outbuffer afterwards (for which I can share any specific code as needed).

The issue I’m having with this process is that it’s producing inconsistent and unclean results. Rendering of the waveform in-game is broken into chunks of the song, and these often have leading silence (which I trim at render-time to preserve the requested duration of render) and, more importantly, incorrect data or even no data at all for no apparent reason.

For capturing an event’s final output at a position for a duration, is there a recommended method that I should consider? If not, are there any issues with things I could be missing, like initialization flags or other setup? Again, I can share any code as needed, but the module code is uploaded to my profile for viewing.

Thank you.

Thanks for uploading your module code. At a glance, your capture DSP and read callback seem fine. Our general recommendation for capturing audio from a specific channel is to use a capture DSP in the way you have. The alternative is to use FMOD_OUTPUTTYPE_WAVWRITER or the NRT version to capture the whole mix, which may be an alternative for you if you’re only playing back a single event at the time. It’d difficult to diagnose exactly what the issue is without more info, so I have a few questions:

  • Does using Studio default mixing init flags (i.e. asynchronous update and mixing) or a real-time output type make any difference?
  • Are you able to reproduce the issue with the WAVWRITER or WAVWRITER_NRT outputs?
  • Can I get you to you set FMOD’s logging level to “LEVEL_LOG” with Debug_Initialize, and upload a log where the issue occurs?
  • If possible, can I get you to upload the recorded audio file of the issue from the capture DSP, and the “correct” audio from an external program like OBS, so that I can compare the two?