Using drift correction to keep aggregate device audio in sync

On MacOS, aggregate devices provide a way to merge multiple distinct audio devices into one single virtual device. Users often include Loopback virtual devices within an aggregate device. When doing so, special care must be taken, to avoid issues with audio sync.

The problem of out of sync audio

While aggregates appear on the system as a single device, their audio is of course provided by each of the distinct audio devices contained within. Audio devices rarely operate at exactly the sample rate they claim (e.g. 44099 Hz vs. 44100 Hz), which means that every audio device within an aggregate will produce or consume audio at a slightly varying sample rate. Over time, these miniscule sample rate differences can build up, and can cause audio to get out of sync.

Fortunately, this limitation of aggregate devices can be worked around.

Clock sources and drift correction

One device within an aggregate device serves as the “clock source”, and its sample rate is what will be used for the overall sample rate of the aggregate.

The other devices within an aggregate will have slightly varying sample rates, as mentioned above. If these diferences aren't mitigated, audio will eventually go out of sync. Fortunately, there is a solution to avoid this problem.

Within Audio MIDI Setup, the Drift Correction setting can be enabled for the devices contained within an aggregate. This makes their sample rates match that of the clock source audio device.

For best results, drift correction should be enabled for all devices within an aggregate. Audio MIDI Setup smartly enables drift correction for some devices, but it fails to do so for others, including Loopback virtual devices. When including a Loopback virtual device in an aggregate, ensure that its Drift Correction checkbox is enabled, along with all other devices.

By setting up your aggregate device this way, you will ensure audio stays in sync over time.