I'm calculating sound card drift for reasons of acoustic echo cancellation. My algorithm is:
drift = samples_played - sampled_recorded
Where *samples_played* is incremented by 1 when a 320, 640 or 1920 byte audio frame is sent to the playback device and where *samples_recorded* is incremented by 1 when a 320, 640 or 1920 byte audio frame has been output by the capture device.
A description of what I am trying to accomplish is provided by WebRTC as follows:
WebRtc_Word16 skew Difference between number of samples played and recorded at the soundcard (for clock skew compensation).
My question is two-part:
- Is the algorithm correct?
- Is the increment correct?