Managing audio latency is crucial in game development, as an interruption or a delay in the sound is much more noticeable than a dropped video frame. The sense of immersion will immediately be broken if the visuals and the sounds are not accurately synchronized.
Furthermore, many gameplays rely on tight synchronization. This is the case for instance for rhythm games, puzzle games, FPS or any games in which sound is played in response to the player’s input or as a situation indicator: if you hear an enemy sneaking up on you with a 200 ms delay, it may already be too late to react!
Thankfully, the new SonicSYNC feature of ADX2 makes it possible to reduce playback latency by up to 50%, thus enhancing the experience and the responsiveness of a game.
SonicSYNC minimizes the latency introduced by sound buffering to zero on iOS, Android and Nintendo Switch. This is more efficient than the regular low-latency playback feature provided by ADX2 until now, especially on Android.
In a normal playback situation, sounds are buffered to give time for the data to be decompressed, and effects and processing to be applied. This is where the largest delays are introduced. With SonicSYNC, these delays are eliminated by generating audio signals immediately, in direct synchronization with the sound driver. Eventually, only the delays caused by the hardware tap recognition and the output processing are still relevant, and the overall audio playback responsiveness is greatly improved.
Here is some data collected on iOS devices showing the improvements brought by the use of SonicSYNC.
And here are the numbers for Android devices:
These graphs show the results obtained from 20 latency measurements, from the triggering to the actual audio playback with the different methods available in ADX2.
Since audio latency is so much reduced with SonicSYNC, the use of Bluetooth headphones and speakers, which add their own latency, becomes more reliable for gaming.
Enabling SonicSYNC will allow ADX2 to play the sound without using any extra buffering. Because of this sound stuttering may occur when using Bus effects with a high CPU load such as PitchShifter, Reverb, I3DL2 Reverb and Headphone virtual surround. Usually, using a single one of these effects (other than the PitchShifter) should not be an issue. However, it is recommended to be careful when combining several effects.
Some processes can also trigger sound interruptions if they take too long: creating / discarding a Voice Pool, creating / discarding a Mana Player, loading / releasing ACB and AWB files, attaching / detaching DSP Bus settings, or locking with criAtom_Lock. To avoid potential issues, it is recommended to perform these operations when the game is silent.
Finally, since SonicSYNC playback offers a lower latency, the regular low latency playback function must be disabled.
With that in mind, using SonicSYNC in your game is really simple (students and indie game developers will be happy to know that it is also included in ADX2 LE). Here are the steps to activate SonicSYNC depending of your game engine.
To use SonicSYNC with the native version of ADX2, the threading model must be set to CRIATOMEX_THREAD_MODEL_MULTI_WITH_SONICSYNC in CriAtomExConfig when initializing the Atom library.
Note that since the processing of the library will be distributed across multiple threads, it will be necessary to call both criAtomEx_GetPerformanceInfo and criAtomExAsrRack_GetPerformanceInfo to get accurate measurements of the total processing load.
When using Unity, SonicSYNC has to be enabled for each platform in the CriWareLibraryInitializer. Additionally, for Android it is highly recommended to also enable Uses Android Fast Mixer. This device-specific property is used for a better synchronization with the sound buffer of the device, and the latency may be higher if it is disabled.
In Unreal, simply go to Project Settings > CriWare > Atom and enable the SmartPhone Use SonicSYNC property.
See it in action
SonicSYNC Gallery is a collection of mini-games showcasing the benefits of using SonicSYNC in various scenarii, from Rhythm to Shooting games. In order to experience audio latency in game and compare it directly with SonicSYNC, each game can be played with different latency profiles that can add up to 200ms of delay.