I’m interested in FMOD_OUTPUTTYPE_WAVWRITER_NRT, but don’t know where to start.
I’m even not sure if it’s the right one I’m looking for.
Let’s say, I’m playing a very short-length .mp3 file every second with several DSPs like a metronome at BPM 60. I want to convert the resulted sound to a one-minute .wav file.
-
Is it possible with FMOD_OUTPUTTYPE_WAVWRITER_NRT?
If so, is there an example of this?
-
How do we know if there’s no remaining signal (eg. reverb) anymore?
Is FMOD_DSP_TYPE_LOUDNESS_METER the way to go?
I want to include all DSP effects at the end.
You can certainly use OUTPUTTYPE_WAVEWRITER_NRT
to record a minute of audio. The loudness meter is more of an overall audio level used for mixing/mastering and not really for detecting the level of the current output. You can use DSP::getIdle()
on a group bus to detect if there is any input/output in that current bus, which should include reverb/delay tails.
https://fmod.com/resources/documentation-api?version=2.01&page=core-api-dsp.html#dsp_getidle
1 Like
Wow, thanks!
FMOD_DSP_GetIdle() seems very useful!
Also glad to hear that FMOD_OUTPUTTYPE_WAVWRITER_NRT is what I was looking for.
But still, it’s not clear how I can utilize it.
I haven’t tried FMOD_OUTPUTTYPE_WAVWRITER yet, but I guess I can just use the existing code with it because it’s a real-time version.
But FMOD_OUTPUTTYPE_WAVWRITER_NRT is a non-real-time one, so how do I call FMOD_System_PlaySound() to record a .mp3 file’s sound every second periodically for a minute?
My main question here is to control intervals between sounds when using the non-real-time API.
Is there any example of this?
Or any related threads I can refer to for a hint?
I want to implement an export feature.
WAVWRITER and WAVWRITER_NRT operate the same, with the exception that NRT will only write audio to a wav file when System::update()
is called. As long as you have an update loop going on already then it will act the same.
1 Like
We are making a music creation game using FMOD .
You can just think of it as simple DAW software for kids.
Recorded user data is saved as a music notation file format which is similar to .mid .
We are now want to add an export feature, so our users can play their music outside the app.
It needs to be a non-real-time way because waiting for three minutes for a three-minute song to be exported is a real pain.
Let’s say we have pseudo-version code like this:
void drumBeatThread() {
float curTime;
float nextHiHatTime = 0;
float nextSnareTime = 0;
while((curTime=getTime()) <= ONE_MINUTE) {
if(curTime >= nextHiHatTime) {
nextHiHatTime += HALF_SECOND;
FMOD_System_PlaySound(... hiHatSound ...);
}
if(curTime >= nextSnareTime) {
nextSnareTime += ONE_SECOND;
FMOD_System_PlaySound(... snareSound ...);
}
}
}
void mainThread() {
initFMOD();
while(true)
FMOD_System_Update();
}
So according to you, I will be able to record the sound by drumBeatThread() to a .wav file just by switching to FMOD_OUTPUTTYPE_WAVWRITER or FMOD_OUTPUTTYPE_WAVWRITER_NRT , right?
But my question is:
-
How do I shorten the export time like professional DAW software while keeping all the intervals between sounds correctly?
-
Do I need to increase the buffer size using FMOD_System_SetDSPBufferSize() to prevent stuttering/skipping/unstable sound when shortening the export time?
-
Also wonder if certain audio API (WASAPI, ASIO, OpenSL, etc) works better (like when we normally play audio).
Unfortunately we don’t support that. Wavwriter is designed exclusively for exporting the audio output of the FMOD engine, and has no audio processing capability of its own. The FMOD engine does all its processing in real-time, because that’s what it’s designed for. As such, if you want to use wavwriter to generate files based on audio processed using FMOD, it will always take at least three minutes to bounce out a three-minute song.
If your game needs a shortened export time like professional DAW software, you’ll have to write the audio processing code yourself instead of using FMOD.
1 Like
My main question is solved thanks to you. But let me ask the above again. The same questions, but this time, it’s about the Wavwriter ( FMOD_OUTPUTTYPE_WAVWRITER and FMOD_OUTPUTTYPE_WAVWRITER_NRT ).
- Do I need to increase the buffer size using FMOD_System_SetDSPBufferSize() to prevent stuttering/skipping/unstable sound for the Wavwriter too?
- Also wonder if certain audio API (WASAPI, ASIO, OpenSL, etc) works better (like when we normally play audio).
Increasing the buffer size can help with any stuttering, but it isn’t a hard and fast rule. It needs some trial and error to see the sweet spot for what you are using FMOD for.
In regards to audio API, there really isn’t a “works better” solution but something to be mindful of is that certain APIs like ASIO have an exclusive mode that can cause issues, as well as the state of the drivers for that API.
1 Like
In fact, I was asking if the audio API settings would even affect the Wavwriter in any way, but I assume your answer implies “yes”.
Thanks!