DSPRelated.com
Forums

How to decode SMPTE timecode from LTC audio track?

Started by stephenbuck May 12, 2005
Hi,

I'm wondering if anyone has any code (C?) or suggestions for decoding
SMPTE timecode from an LTC audio track?

Thanks,
Steve

Assuming the quality of the timecode is good and a constant speed, it's not too
difficult.  Do you need help acquiring the audio track (e.g. with a soundcard)
or do you already have it and now need to decode it?  Assuming the latter, you
definitely want to take a look at the SMPTE format specification.  I would start
with converting the audio waveform into a 1-bit binary code, i.e. every sample
becomes either a 0 or a 1.  A fixed threshold might work for a very clean
waveform, but you might need some hysteresis or smart edge detection (i.e.
ignore transitions that happen to close together) if it's noisy.  Next find the
sync word and start reading in the bits based on the SMPTE spec.

It's bi-phase, so that means there is a transition at the start of every bit,
and if the data is a one, a second transition in the middle of the bit time.
Assuming you are synced up, look for a transition, then find the next transition
and see if it is 1 bit time or a half bit time offset from the previous.  This
is where the job is really easy if you have relatively constant speed timecode
but quite difficult if it is variable (e.g. from an analog tape player that is
speeding up/slowing down, aka varispeeding or scrubbing).  Go to the next bit
and repeat.  Once you have all the bits, it's very easy to convert to an actual
timecode value.  You might want to throw in some "sanity checking" especially
for noisy data, such as if you get one frame that is a wildly different value
from the previous/next ones, ignore it and interpolate.

Sorry I don't have code to give you.

"stephenbuck" <stephenbuck@mac.com> wrote in message
news:1115937709.250321.126410@f14g2000cwb.googlegroups.com...
> Hi, > > I'm wondering if anyone has any code (C?) or suggestions for decoding > SMPTE timecode from an LTC audio track? > > Thanks, > Steve >