Re: [linux-audio-dev] rtlinux, MIDI timecode

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] rtlinux, MIDI timecode
From: Paul Barton-Davis (pbd_AT_Op.Net)
Date: Fri May 05 2000 - 02:17:10 EEST


>set up the RTC timer to 2Khz
>( 500usec precision).
>
>with this algorithm even if you lose a tick evey now and then,
>you will still have all MTC messages delivered with millisecond precision
>
>actual_time=get actual time
>next_mtc_time = actual_time += 8.3ms
>while(1) {
> read() from RTC device ( blocks our process for 500usec)
> actual_time=get actual time using TSC or gettimeofday()
> if(actual_time >= next_mtc_time) {
> send_the_2_MTC_bytes();
> next_mct_time += 8.3ms
> }
>}

>let me know what you think about the code above.

I'm going to try this after I try the even simpler (and less
IRQ-loading) approach of sending all the MTC data immediately after
sending a new fragment to the audio interface. This implies jitter of
the same as the fragment size/time, but I want to see if this is
accepted by the MTC receiver.

<If that doesn't work, then I'll go for something like your example above.
>If you have to sync the SMPTE for every frame/two frames, just modify my code
>above in order to check the differences between SMPTE time and
>next_mtc_time, and if they differ override it with the right time.
>Assuming that the floating point "next_mtc_time" variable increments in
>1/30 steps , the drift will be very very small compared to the real SMPTE time
>,
>and that means as soon a drift of 500usecs is detected, the next MTC message
>is delivered 500usecs later or sooner.
>
>Or am I missing something ?

Well, not much, just a little bit. The MTC receiver expects to see
*every* quarter frame message. Its not OK to skip a few, because then
it concludes that the MTC transmitter is broken. So whenever you find
that the current SMPTE time is ahead of the last-sent MTC, you have to
send all the qtr frame messages needed to catch up, not just those
representing the current time.

I'm going over the studio in 5 mins to try out some of this stuff.

--p


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri May 05 2000 - 02:49:13 EEST