Dissonance Bugs

Hey folks! I’ve got a bug with FMOD (2.03.06) in conjunction with Dissonance in Unity 6000.0.37f1).

I’ve been speaking to @martindevans1 (developer of Dissonance) via email where he has identified:

Playback desync (XXXXms) AHEAD beyond recoverable threshold

When playback starts a timer is started. Every time the audio engine reads some audio another counter is advanced by however much time that audio represents. Desync is the difference between these two values. Obviously if the audio engine is reading audio at the correct rate they should always be in sync. “AHEAD” means that the audio engine has read more audio than it should have in the amount of elapsed time.

Buffer running dry! Offsetting sequence number back by 3

This means that 8 consecutive requests for more audio failed (because the input buffer was empty). We effectively rewind time a bit here, as a last-chance attempt to correct it.

Both of these things indicate to me that there’s something causing the audio engine to consume audio faster than real time. Since senders are only sending audio at real time rates would drain the buffer dry very rapidly.

Dissonance itself is not in control of the rate audio is consumed, it just provides audio when the audio engine requests it. So I think it’s most likely to be an external issue.

Is it possible you have some config in FMOD which is causing it to consume audio too quickly? For example a speed change or pitch shift effect?"

He suggested that I submit a forum thread on here to get support.

Any support is much appreciated.

1 Like

Hi, just chipping in with extra technical details of how Dissonance plays voice through FMOD.

We get the sample rate FMOD expects:

RuntimeManager.CoreSystem.getSoftwareFormat(out _sampleRate, out _, out _);

and then create a DSP:

var desc = new DSP_DESCRIPTION
{
    numinputbuffers = 0,
    numoutputbuffers = 1,
    read = ReadDSP,
    shouldiprocess = ShouldProcessDSP,
    userdata = (IntPtr)_handle,
};
RuntimeManager.CoreSystem.createDSP(ref desc, out _dsp);

_busLock = FMODChannelGroupLocks.Instance.LockBus(OutputBusID);
RuntimeManager.CoreSystem.playDSP(_dsp, _busLock?.ChannelGroup ?? default, false, out _channel);

The ReadDSP function will pull audio from the pipeline. It removes it from the network buffer, decodes it, resamples it (to the rate discovered above) and provides it to FMOD.


The two errors that Mattabulous has both indicates that audio is being pulled from the pipeline too fast. In particular the Playback desync one is just comparing a timer (since playback started) with total_samples_consumed * sample_rate, obviously those should stay in sync, but they get out of sync very rapidly!

My best guesses are that it’s either:

  1. A bug in my playback code that no one else has encountered.
  2. Something unusual in the way Mattabulous has set things up in FMOD. But I don’t know FMOD well enough to guess what it could be.