MacOS – sound drift correction on OS X and how should I use it

audiomacos

On Audio MIDI Setup there is an option to to enable/disable audio drifting for any sound output device?

What is this and how should I use it?

I do want to enable sound output for multiple devices: HDI TV and normal jack as I do not always know which one is connected.

Best Answer

(This is answering an old question, but since I was researching the topic...)

It's to do with keeping different hardware devices in sync.

When you create an aggregate device, more than one piece of sound generation hardware may be required to operate concurrently. Even if these devices are running at the same sample rate, they're probably all using independent hardware clocks to send buffered audio through their DACs and actually generate sound. If these clocks get out of sync, the audio would drift out of sync too and eventually one or more of the hardware devices would start exhausting its data buffer before others had finished with theirs. In short, it'd get glitchy and break.

So for example, you might connect a TV via HDMI and use it as a second monitor to watch movies, but you might want both the TV speakers and your computer speakers to be used - maybe you've plugged in computer speakers with a subwoofer and you like the added bass that the TV speakers can't produce. So you use Audio MIDI Setup to add an aggregate device for both your computer and the TV. But the computer is sending digital audio over HDMI to the TV which independently decodes it - there needs to be some way to make sure both the computer and the TV decode at the same rate, without any clock drift over time screwing things up.

Over digital links like SP/DIF, hardware devices can both transmit and receive a signal in addition to the audio data which is used to perform this kind of synchronisation. It's called word clock. It's really important when you're recording digital audio, so that the recording digital sink is kept rigidly in sync with the transmitting digital source. You can find out more about it here:

http://en.wikipedia.org/wiki/Word_clock

If your aggregate devices all support word clock, then you don't need software drift correction - the master will be used as a word clock source and the word clock data will be sent to the other devices. They'll all use that clock to keep themselves in sync. Otherwise, any devices except the master which don't support word click need the drift correction switch turning on. This uses some sort of software mechanism for trying to combat clock drift (I don't know how it actually achieves this, or how robust / reliable it is).

In the TV example, you'd set the computer as the master audio device and add in the TV audio output, enabling drift correction for the TV (but not for the master device as that wouldn't make sense - the TV audio clock is corrected using them master as the reference). For another example of how word clock and drift correction work together, see steps 11 and 12 here:

http://www.absolutemusic.co.uk/community/entries/set-aggregate-audio-device-mac-os-lion