I’ve been developing a project that aims to leverage the DSP processing capabilities of FMOD in Unity game/ virtual environment development. I am also looking to employ the capabilities of a network-based Immersive Sound system.
Essentially, I’m looking to pass audio samples across to a server which can then playback the samples using the ASIO SDK.
To this end, I’ve generated a custom FMOD DSP plugin that has an embedded socket client that communicates with the server on every process callback. A sample buffer is filled with all the samples in the process callback function loop, and is transmitted after the “processing” is complete. Essentially, each FMOD event (bound to object or not) will have a unique instance of the DSP plugin, and will therefore act as a unique client. The server will receive (store in a buffer) and playback samples from each client, and assign each client an output channel (which the Immersive sound system will then use to spatialize the sound upon receiving 3D coordinates from the relevant client/FMOD event).
I’ve been successful in receiving the samples on the server side and playing them back. However, the audio is nested with artefacts. This leads me to believe that I have a synchronization error (my audio driver is consuming samples at a slower rate than the processing callback is producing).
I was wondering whether anyone could shed some light on how I would be able to synchronize both processes.
At the moment, I’m looking to implement circular buffers on the server, so that I minimize the chances of the server receiving samples while the ASIO driver is reading and playing them back.
If you require any additional information, please don’t hesitate to ask. Other important information:
-> The ASIO driver uses a buffersize of 512, so I’ve accordingly used the setDSPBufferSize function to assign FMOD DSPs with a buffersize of 512.
-> The ASIO driver has a sample rate of 44.1kHz, therefore I’ve set the samplerate of the FMOD system to the same rate using the setSoftwareFormate() function before the system is initialized.
technically these settings should mean that the driver consumes data at the same rate as the processing (around 11ms).