views:

377

answers:

1

I've never had to deal with signal/stream encoding or decoding before, at least not beyond fairly basic protocols like HTTP, so forgive me if I'm making this harder than I should be.

Several of the systems we use at work rely on SMPTE timecode to operate, a Manchester biphase-mark system that occupies 1kHz of bandwidth between 1kHz and 2kHz.

Because this is right in the audio spectrum, and at line-level, it can be plugged straight into the soundcard's line input, accessible using the audio API of your choice (I plan on using Core Audio on a Mac).

I'm fairly happy about decoding the digital bitstream itself to recover the time and parameters, but actually recovering the bitstream from the sampled analogue signal is less straight forward, and I'm not sure what the best way to approach the problem is.

My current plan is to allow a short amount of time once a signal is detected (1 second or 24-30 frames) to measure the maximum and minimum number of samples between zero-crossing levels (using a moving average filter to prevent spikes/dropouts affecting decoding) and the maximum and minimum recorded voltages to determine the zero crossing point (DC level).

I should then be able to use this information to construct a digital bitstream from the incoming analogue signal. Am I headed in the right direction, or is there a better way of doing it?

Thanks

+2  A: 

Your sound card is almost certainly AC coupled. So you shouldn't get a DC offset.

interesting dissection of sound card inputs here

Running a moving average to calculate software automatic gain control is probably a good idea.

your zero crossings will probably be near zero. You can also blur the data at 4khz (2*2k)[aka low pass filter at 4khz] and then edge detect it to get the zero crossings.

When I have signal processing issues like this, I graph the captured data in a custom application, then try things semi-interactively in code.

As a suggestion, try capturing some and see how you go feeding stored data to your parsing routines. Try different things and see what works

Tim Williscroft