ProSoundWeb Community

Please login or register.

Login with username, password and session length
Advanced search  

Pages: [1] 2 3   Go Down

Author Topic: Realtime latency measurement  (Read 5626 times)

Andrew Broughton

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2311
    • Check Check One Two
Realtime latency measurement
« on: December 11, 2020, 02:00:39 PM »

Anyone know mathematically how, given 2 audio sources containing the same signal, but one delayed from the other by a continuously changing amount (think streaming over WiFi or Internet), you would continuously calculate the exact latency in real time?
Logged
-Andy

"Well, my days of not taking you seriously are certainly coming to a middle..."

http://www.checkcheckonetwo.com
Saving lives through Digital Audio, Programming and Electronics.

David Sturzenbecher

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1966
  • So. Dak.
    • Sturz Audio
Re: Realtime latency measurement
« Reply #1 on: December 11, 2020, 03:59:11 PM »

Anyone know mathematically how, given 2 audio sources containing the same signal, but one delayed from the other by a continuously changing amount (think streaming over WiFi or Internet), you would continuously calculate the exact latency in real time?

Can you just run them into Smaart and have the tracker turned on?
Logged
Audio Systems Design Engineer
Daktronics, Inc.
CTS-D, CTS-I
AES Full Member

Dave Garoutte

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 3379
  • San Rafael, CA
Re: Realtime latency measurement
« Reply #2 on: December 11, 2020, 05:21:29 PM »

Embed some timecode?
Logged
Nothing can be made idiot-proof; only idiot resistant.

Events.  Stage, PA, Lighting and Backline rentals.
Chauvet dealer.  Home of the Angler.
Inventor.  And now, Streaming Video!

Scott Holtzman

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 7503
  • Ghost AV - Avon Lake, OH
    • Ghost Audio Visual Systems, LLC
Re: Realtime latency measurement
« Reply #3 on: December 11, 2020, 08:42:26 PM »

Anyone know mathematically how, given 2 audio sources containing the same signal, but one delayed from the other by a continuously changing amount (think streaming over WiFi or Internet), you would continuously calculate the exact latency in real time?


I would need to brush up a bit, however yes I thought that was what time code was for.  Stable local clock (GPS is easiest, we used to use TV color sync in old days to align simulcast transmitters) plesiochronous time sync is then very "doable" on asynchronous connections.  The buffering can then be synced to the nodal clocks at the source.
Logged
Scott AKA "Skyking" Holtzman

Ghost Audio Visual Solutions, LLC
Cleveland OH
www.ghostav.rocks

Frank Koenig

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1318
  • Palo Alto, CA USA
Re: Realtime latency measurement
« Reply #4 on: December 13, 2020, 11:54:40 AM »

Anyone know mathematically how, given 2 audio sources containing the same signal, but one delayed from the other by a continuously changing amount (think streaming over WiFi or Internet), you would continuously calculate the exact latency in real time?

I can guess at what problem you're trying to solve and, as others have noted, timecode is likely the practical answer, if it's available.

More generally, a cross-correlation between two signals can provide an estimate of the time difference and will give an exact answer for identical, noise-free (and not otherwise pathological, like DC) signals with a constant time difference. If the time difference is variable, as you stated, this becomes a hard problem, the tractability of which depends on the spectrum of the signal in relation to the spectrum of the delay variation. Intuitively, the cross-correlation needs a long enough segment of the signal to "grab onto", but if the time difference varies appreciably during that segment then the cross-correlation is a poor estimate. It works if the time difference changes slowly compared with the frequency content of the signal.

If the spectra are well enough behaved for cross-correlation to be useful, then I believe that the computation can be done in real time in the formal sense, meaning that one can place a finite upper bound on the time taken by the computation. To be clear, real time does not mean instantaneous. It takes time (latency) to determine latency. Causality sucks...

--Frank
Logged
"Nature abhors a vacuum tube." -- John Pierce, Bell Labs

Andrew Broughton

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2311
    • Check Check One Two
Re: Realtime latency measurement
« Reply #5 on: December 13, 2020, 12:32:10 PM »

Can you just run them into Smaart and have the tracker turned on?
Been a very long time since I looked at SMAARY. Would that work continuously in real-time? I thought it only calculated the delay when you used the delay finder?
Logged
-Andy

"Well, my days of not taking you seriously are certainly coming to a middle..."

http://www.checkcheckonetwo.com
Saving lives through Digital Audio, Programming and Electronics.

Andrew Broughton

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2311
    • Check Check One Two
Re: Realtime latency measurement
« Reply #6 on: December 13, 2020, 12:34:12 PM »

Embed some timecode?
Can timecode be imbedded inaudibly? Think audio going to and coming from a source that you have no control over, and it only accepts regular aac audio.
Logged
-Andy

"Well, my days of not taking you seriously are certainly coming to a middle..."

http://www.checkcheckonetwo.com
Saving lives through Digital Audio, Programming and Electronics.

Andrew Broughton

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2311
    • Check Check One Two
Re: Realtime latency measurement
« Reply #7 on: December 13, 2020, 12:36:43 PM »

I can guess at what problem you're trying to solve and, as others have noted, timecode is likely the practical answer, if it's available.
It's not.

Quote
More generally, a cross-correlation between two signals can provide an estimate of the time difference and will give an exact answer for identical, noise-free (and not otherwise pathological, like DC) signals with a constant time difference. If the time difference is variable, as you stated, this becomes a hard problem, the tractability of which depends on the spectrum of the signal in relation to the spectrum of the delay variation. Intuitively, the cross-correlation needs a long enough segment of the signal to "grab onto", but if the time difference varies appreciably during that segment then the cross-correlation is a poor estimate. It works if the time difference changes slowly compared with the frequency content of the signal.

If the spectra are well enough behaved for cross-correlation to be useful, then I believe that the computation can be done in real time in the formal sense, meaning that one can place a finite upper bound on the time taken by the computation. To be clear, real time does not mean instantaneous. It takes time (latency) to determine latency. Causality sucks...

--Frank

This is what I'm talking about. Any links to the formulas or programming needed to do this sort of calculation? I think if it gets it right more often than not, it might be workable.
Logged
-Andy

"Well, my days of not taking you seriously are certainly coming to a middle..."

http://www.checkcheckonetwo.com
Saving lives through Digital Audio, Programming and Electronics.

Mac Kerr

  • Old enough to know better
  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 7546
  • Audio Plumber
Re: Realtime latency measurement
« Reply #8 on: December 13, 2020, 12:53:44 PM »

Been a very long time since I looked at SMAARY. Would that work continuously in real-time? I thought it only calculated the delay when you used the delay finder?

Been a long time for me as well, but the last I looked, yes the SMARRT delay finder can run continuously, and displays the varying latency.

Mac
Logged

David Sturzenbecher

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1966
  • So. Dak.
    • Sturz Audio
Re: Realtime latency measurement
« Reply #9 on: December 13, 2020, 02:03:00 PM »

Been a long time for me as well, but the last I looked, yes the SMARRT delay finder can run continuously, and displays the varying latency.

Mac

Yes, it can run continuously and will show the changing delay. However, it does need signal to work, so it may go wild with no signal...like in between songs...I haven’t tested this though. There is a free demo if you wanted to try it out.  There is also an API available on request, so if you wanted to write some code to repackage just this portion you could.
« Last Edit: December 13, 2020, 02:39:13 PM by David Sturzenbecher »
Logged
Audio Systems Design Engineer
Daktronics, Inc.
CTS-D, CTS-I
AES Full Member

ProSoundWeb Community

Re: Realtime latency measurement
« Reply #9 on: December 13, 2020, 02:03:00 PM »


Pages: [1] 2 3   Go Up
 



Site Hosted By Ashdown Technologies, Inc.

Page created in 0.038 seconds with 21 queries.