Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37488

Re: Is time an illusion?

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.java.programmer
Subject Re: Is time an illusion?
Date 2017-09-26 23:32 -0400
Organization A noiseless patient Spider
Message-ID <oqf64f$pn2$1@jstuckle.eternal-september.org> (permalink)
References (2 earlier) <oqbv8t$mp1$1@dont-email.me> <oqea94$tu8$1@dont-email.me> <oqemvu$m1f$1@dont-email.me> <oqet7m$m6m$1@jstuckle.eternal-september.org> <oqf29h$7o7$1@dont-email.me>

Show all headers | View raw


On 9/26/2017 10:26 PM, Daniele Futtorovic wrote:
> On 2017-09-27 03:00, Jerry Stuckle wrote:
>> On 9/26/2017 7:13 PM, Daniele Futtorovic wrote:
>>> On 2017-09-26 21:37, Eric Sosman wrote:
>>>>       I'm somewhat curious about why you need such lock-step agreement.
>>>> What are you trying to accomplish?  Why do you need to measure the
>>>> same interval on two independent stopwatches?
>>>
>>> I'm rendering audio over a network, in real-time, or as close to
>>> real-time as I can get. It's not just a matter of "render as much of
>>> this as you can, when you can"; I want to be able tightly to control the
>>> rendering, as well as have accurate measurement of the resulting latency
>>> -- possibly over multiple endpoints.
>>>
>>> The upside is that I'm not constrained by absolute time; I just need
>>> relative time. Also, the human ear is sufficiently forgiving that I can
>>> afford to be a couple milliseconds off -- but not too many (I think).
>>>
>>> Specialised equipment is out of the question for me, as the software is
>>> intended for general consumption. But based on the feedback here, I've
>>> incorporated clock synchronisation into my protocol, and it seems to
>>> work well enough, at least at low latencies. It's still an open question
>>> how well it will work when they get higher, but I'll burn that bridge
>>> when I get there.
>>>
>>> Thanks a lot for the assistance.
>>>
>>
>> If you're trying to synchronize audio with video, anything less than
>> 100ms is generally considered sufficient and regular updates with ntp
>> should work fine.  However, if you're trying to synchronize two
>> different audio signals (i.e. left and right channels), you have to be
>> less than around 50ms (1 cycle at 20 Khz), which you won't get reliably
>> without additional hardware.
> 
> I don't think I want to sync audio signals, but... what makes you say I
> wouldn't get better than 50ms resolution?
>

Sorry, that should have been 50 microseconds, not 50 ms.  That's what 
you would need as a minimum to synchronize audio signals because the ear 
can easily hear phase differences between signals.

> The way I see it, provided I get my clocks synched, the only other
> problem is the drift; otherwise I can do whatever I want. Therefore if I
> find a workable time interval over the length of which drift is
> negligible (say, <1ms), synchronisation is the only problem.
> 

It all depends on the computers themselves.  There is no way to 
guarantee drift on its own will be < 1ms, and no internet-based 
synchronization will keep them that close.

> In my current dev setup with random hardware, I see a drift of about 1ms
> per minute. I can work with and correct that. And as for the clock
> synching, as I understand it, it's a matter of the symmetry between the
> upward and downward leg of the packet roundtrip between both ends -- the
> more symmetric, the more accurate. And that difference is itself
> constrained by the roundtrip time, i.e., the error can never be greater
> than the overall roundtrip time.
> 

That's with your current hardware.  Different hardware can be or or less.

> Again, I'm targeting a LAN. Possibly a WLAN. Roundtrip in such
> environments should be magnitudes smaller than 50ms, especially if I go
> pure UDP for the synching. Wouldn't you agree?
> 
> Also, can you tell me how you arrive at the 20Khz figure?
> 

It's generally considered about the minimum for synchronization for 
non-high fidelity audio (i.e. voice and general sounds) - up to around 7 
kHz or so.  The human ear can hear up to 15 kHz or so so you need 
something higher than that.  For high quality audio you're looking at 
around 45 kHz (3x maximum audible frequency).

>> The problem here is that CPU clocks, even if they are crystal
>> controlled, are not perfectly accurate.  A clock on a PC can easily be
>> off by a minute or two per week.
> 
> Indeed, and that was the big revelation of these last few days. I feel
> silly for not having thought of it before -- it's kinda obvious, when
> you look at it -- but, ah well.
> 

What is so important about keeping the time down to < 1ms?  You can have 
more variation than that even in must processing a signal due to the 
multiprocessing nature of the computers.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-25 22:30 +0200
  Re: Is time an illusion? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-09-25 18:02 -0400
    Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-26 00:16 +0200
      Re: Is time an illusion? Jerry Stuckle <jstucklex@attglobal.net> - 2017-09-25 19:18 -0400
      Re: Is time an illusion? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-09-26 15:37 -0400
        Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-27 01:13 +0200
          Re: Is time an illusion? Jerry Stuckle <jstucklex@attglobal.net> - 2017-09-26 21:00 -0400
            Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-27 04:26 +0200
              Re: Is time an illusion? Jerry Stuckle <jstucklex@attglobal.net> - 2017-09-26 23:32 -0400
                Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-28 10:58 +0200
                Re: Is time an illusion? Jerry Stuckle <jstucklex@attglobal.net> - 2017-09-28 12:50 -0400
            Re: Is time an illusion? Eric Douglas <e.d.programmer@gmail.com> - 2017-09-27 05:25 -0700
            Re: Is time an illusion? Arne Vajhøj <arne@vajhoej.dk> - 2017-09-30 22:57 -0400
  Re: Is time an illusion? Arne Vajhøj <arne@vajhoej.dk> - 2017-09-25 20:22 -0400
  Re: Is time an illusion? Marcel Mueller <news.5.maazl@spamgourmet.org> - 2017-09-26 20:18 +0200
    Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-27 01:30 +0200
      Re: Is time an illusion? lewbloch@gmail.com - 2017-09-28 10:52 -0700
  Re: Is time an illusion? Eric Douglas <e.d.programmer@gmail.com> - 2017-09-26 12:59 -0700
    Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-27 01:42 +0200
  Re: Is time an illusion? lewbloch@gmail.com - 2017-09-28 10:49 -0700
    Re: Is time an illusion? Robert Klemme <shortcutter@googlemail.com> - 2017-09-28 22:33 +0200

csiph-web