x42 / ltc-tools

tools to deal with linear-timecode (LTC)
GNU General Public License v2.0
71 stars 20 forks source link

jltcntp - needs protection from Jack XRUN #22

Open mungewell opened 4 years ago

mungewell commented 4 years ago

Since 'we' are receiving a continuous stream of audio data we are likely(?) to experience an XRUN from time to time.

The LTC frame is not protected, so a missing section of audio could mean that 2 part frames could be interpreted as one to produce incorrect data.

Write up and fix in process.

x42 commented 4 years ago

Depends on your hardware and system. pro-audio systems can be tweaked to run reliably (zero x-runs) at sub millisecond latency. -- While some casual consumer systems have issues to with even 20-30ms periods.

If it's important to you, Implementing some x-run recovery or gracefully handling discontinuities (flywheel) may be prudent. Then again you are better off to prevent the x-run in the first place.

mungewell commented 4 years ago

Agreed, no xruns would be better.... but I already wrote some code ;-)

With SyncIO driving Digi888's word clock with SPDIF output fed via M-Audio USB sound card, I got 3 xruns in a 8hr (overnight) session.

mungewell commented 4 years ago

Example output, with faked xrun. Note how you 'loose' a few timecode frames

00-00-00 +0000 03:17:59:27
00-00-00 +0000 03:17:59:28
00-00-00 +0000 03:17:59:29
00-00-00 +0000 03:18:00:00
00-00-00 +0000 03:18:00:01
00-00-00 +0000 03:18:00:02
Restarting LTC decoder: Wed Jul 29 12:36:17 2020

00-00-00 +0000 03:18:00:05
00-00-00 +0000 03:18:00:06
00-00-00 +0000 03:18:00:07
00-00-00 +0000 03:18:00:08
00-00-00 +0000 03:18:00:09
mungewell commented 4 years ago

Now I am observing XRUNs I am seeing a shift in the time continuum. I an not (yet) understanding why.... please hold on implementing patch until I figure out why.

Note: this only occurs with real XRUNs, but not when I create a fake one.... restart_glitch

restart_glitch_mon

mungewell commented 4 years ago

May have found the reason for the XRUNs, from the "Fast Track 'not-so-pro'" manual.... guessing that there is a slight difference in SyncIO's clock rate. fast_track_pro

Time to MOTU up I guess. :-)

dimitry-ishenko commented 3 years ago

I agree with @x42 that XRUNs should be handled outside of the scope of this tool.