• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
What's the correct way to measure latency of audio input and output?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What's the correct way to measure latency of audio input and output?


  • Subject: What's the correct way to measure latency of audio input and output?
  • From: Dale Curtis <email@hidden>
  • Date: Fri, 28 Jul 2017 16:30:44 -0700

I.e. if a sound occurs at time T, how can we determine T during the
eventual AURenderCallbackStruct::inputProc() callback delivering that audio
data?

In Chrome we've always done this by roughly the following calculation:
T = inTimeStampReceivedByInputProc->mHostTime -
AudioUnitGetProperty(kAudioUnitProperty_Latency) -
 AudioObjectGetPropertyData(kAudioDevicePropertyLatency);

https://cs.chromium.org/chromium/src/media/audio/mac/audio_low_latency_input_mac.cc?l=1059

Is this actually correct? Specifically, I wonder if we really need to
manually include the two latency properties or if those are already baked
into the provided AudioTimeStamp?

Similarly, for output if we render a sound at time T, we expect it to play
at T = inTimeStampReceivedByInputProc->mHostTime +
AudioUnitGetProperty(kAudioUnitProperty_Latency) +
AudioObjectGetPropertyData(kAudioDevicePropertyLatency)

https://cs.chromium.org/chromium/src/media/audio/mac/audio_auhal_mac.cc?l=392

The playout case seems more reasonable to need to include the additional
latency fields, but again I can't find any documentation suggesting what is
actually correct. Thanks in advance for any clarity!

- dale
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: What's the correct way to measure latency of audio input and output?
      • From: Dan Klingler <email@hidden>
  • Prev by Date: Re: why is ExtAudioFileSetProperty raises c++ exception?
  • Next by Date: Re: What's the correct way to measure latency of audio input and output?
  • Previous by thread: Re: How to setup the sample rate in an AUGraph
  • Next by thread: Re: What's the correct way to measure latency of audio input and output?
  • Index(es):
    • Date
    • Thread