[Bug] In FMOD_OUTPUTTYPE_NOSOUND mode, the DSP callback frequency is wrong

,

FMOD2.02.05 version is used in UE4.27.

First, I call the following code and set it to silent mode:

System->setOutput(FMOD_OUTPUTTYPE_NOSOUND);

Then, I use the setSoftwareFormat method to explicitly specify the sampling rate of 48000;

I added a DSP callback, and calculated the delta time(in milliseconds) between current callback and the last callback. The results are as this image.

During the playback process, the time interval at which the callback function is called suddenly decreases, and it stays at this level. It is irregular, sometimes it is very low at the beginning of the playback, and sometimes it suddenly decreases after tens of seconds of playback.

I am sure that this happens only in FMOD_OUTPUTTYPE_NOSOUND mode. I set FMOD_OUTPUTTYPE_NOSOUND to simulate the situation where there is no audio device on the computer.

This problem causes the audio PCM rate I get from the DSP callback to be unstable and Uneven.

I created a UE4.27 Demo project to test the difference between different versions of FMOD:

The environment is Windows10 x64 and UE4.27.2

I only added one line of code to FFMODStudioModule::CreateStudioSystem, which is handled in the same way for different versions of FMOD

lowLevelSystem->setOutput(FMOD_OUTPUTTYPE_NOSOUND);

Configure the sample rate to 48000 in the UE4 project settings > FMDOStudio

I created an Actor, created ChannelGroup and DSP in BeginPlay, very simple code

	auto StudioSystem = IFMODStudioModule::Get().GetStudioSystem(EFMODSystemContext::Runtime);
	FMOD::System* CoreSystem = nullptr;
	StudioSystem->getCoreSystem(&CoreSystem);

	FMOD::ChannelGroup* BaseCG = nullptr;
	CoreSystem->createChannelGroup("BaseCG", &BaseCG);

	FMOD::DSP* BaseDSP = nullptr;
	FMOD_DSP_DESCRIPTION Desc = {};
	Desc.numinputbuffers = 1;
	Desc.numoutputbuffers = 1;
	Desc.read = [](FMOD_DSP_STATE* dsp_state, float* inbuffer, float* outbuffer, unsigned int length, int inchannels, int* outchannels)-> FMOD_RESULT
	{
		const auto NowTime = FDateTime::Now();
		UE_LOG(LogTemp, Error, TEXT("Callback: %d"), (NowTime-PrevTime).GetFractionMilli());
		PrevTime = NowTime;
		return FMOD_OK;
	};
	Desc.userdata = nullptr;
	CoreSystem->createDSP(&Desc, &BaseDSP);

	BaseCG->addDSP(0, BaseDSP);

FMOD 2.02.04 and 2.02.05, only need to try once, no need to play any audio, after tens of seconds, the DSP callback frequency will be much faster.

FMOD 2.01.13, in the same situation, I tried more than three times, and the running time was longer, but there was no abnormality.

This error only appears in version 2.02 of FMOD and in FMOD_OUTPUTTYPE_NOSOUND mode.

When an error occurs, the frequency of callbacks will suddenly become faster:

I’m just investigating this further, are you able to get the same thing to happen with the FMOD Studio API? I can see it happening in the Unreal Engine but I want to confirm it’s confined to the UE4 integration first.

I’m not familiar with the situation outside UE4, and don’t have much energy to confirm whether this problem exists outside UE4. I hope the official can handle it.

I’ve replicated the issue with Unreal Engine but not with the FMOD Studio API itself, so I’m logging this as a bug in our system to be looked at at a different date.