Adding a DSP

I’m trying to get waveform data that I can use to convert the data into colors. The only way I’ve found to add a dsp to an EventInstance is as follows

    eventInstance.start();
    yield return new WaitForSeconds(0.1f);

    FMOD.ChannelGroup channel;
    eventInstance.getChannelGroup(out channel);

    FMOD.DSP dsp;
    FMOD.DSP_DESCRIPTION dspDesc = new FMOD.DSP_DESCRIPTION();
    dspDesc.read = DSPReadCallback;

    RuntimeManager.LowlevelSystem.createDSP(ref dspDesc, out dsp);

    channel.addDSP(0, dsp);

However, doing this causes the first event it attaches a dsp to to not play through to the speakers and the following events all contain pop and cracks. This happens even when no processing occurs in the callback. A secondary issue is that without the hacky coroutine yield statement I get an ERR_STUDIO_NOT_LOADED and no events are played. Am I going about this the wrong way?

What does your read callback do? It needs to copy the input to the output otherwise it is a dead end for the audio stream.

The read callback is just there to gather data to use for the visuals. It doesn’t write the data to the output but it’s also not the primary dsp for that event. It was my understanding that I couldn’t attach a read callback to that one since the unity plugin was handing it’s creation.

all you have to do is copy the input to the output, that is the purpose of a dsp.