views:

237

answers:

1

Hi all,

I'm working on an audio recording system. My task involves extracting the SMPTE time code from audio input stream, generated by a synchronizer device. I'm using ASIO SDK to get the time code of each callback buffer but it's always zero.

Perhaps somebody has experience in ASIO SDK (or any other platform/sdk that can be used to extract SMPTE timecode from audio stream) could help me?

Regards, Ben

A: 

LTC is straightforward, so If nothing else, you could just scan the audio stream for LTC data, as documented on wikipedia. Each 80 bit frame ends with 0011 1111 1111 1101, just scan for that byte sequence to synchronize, then cast the buffer data starting after that sync sequence to be an array of 80 bit struct timecode_t elements. If your buffer is sized as a multiple of 80 your calculations will be easier (but you do need to test for sync lossage, because soundcards lose bits with overruns).

The hard part is that if I am not mistaken, the time code "bits" are not the same of the bits of the sampled audio stream, so you would have to implement logic to detect the bit sequence. This can just be a for loop checking for the proper signal changes and appending bits to the buffer as appropriate (and then calling the function to interpret the buffer when it is full).

Justin Smith
Hi Justin, thanks for replying. My problem is: the ASIO driver always returns me timecode=0, so I can't decode it using the way you suggest. ASIO driver returns the audio stream separately from the timecode. The field 'tcSamples' from the driver info struct seems to be the only place I could look for time code, and it's always 0. So, I just don't know what to do next...
Ben
The SMPT LTC data IS the audio stream. You need to decode that audio stream to get the data. There are libraries that you can hand your buffer to and they return a struct, or you can do what I suggested and implement that yourself. If using an lgpl library is OK for your project http://ltcsmpte.sourceforge.net/ may work, or it may be Linux only (my experience is pretty much all Linux). Or you can find a Windows library that does the same thing.
Justin Smith