* Does anyone know of source code for decoding Biphase/Manchester encoding from analog signal? I am looking for source code for a biphase decoder. The application is extracting SMPTE/EBU time code data from analog audio signals (recorded by professional audio/video equipment). I found source code that looks at signal crossing an adjustable threshold (by Maarten de Boer) ftp://www.iua.upf.es/pub/mdeboer/projects/SMPTE/ However, this is not robust for real-world signals. I assume I need a clock recovery algorithm, then sample the signal between clock edges. * Where can I find a clock-recovery software algorithm, or source code? If there is none, here is what I would try doing: - create a narrow band-pass filter 2.4 kHz - recover clock by running the data signal through the filter and obtain close-to-sine-wave around 2.4kHz - detect zero-crossing of the recovered clock - sample or integrate data signal between the zero-crossings to detect positive or negative symbol. * Is this the right way to go? * Which band-pass filter should I use: Butterworth, Chebyshev, Elliptic, other? * The clock frequency shifts so I might need a PLL, or an adaptable filter. Any advice there? More information on the encoding is at: http://www.philrees.co.uk/articles/timecode.htm Thanks, Laza
Software clock recovery for biphase demodulation
Started by ●February 7, 2005
Reply by ●February 7, 20052005-02-07
Does your module need to support variable speed SMPTE time code or only fixed speed? Variable speed is usually only obtained with analog recorders with the time code recorded (striped) to an analog track. Then when the analog recorder is played back slower or faster (varispeeded), the time code signal changes as well. If you don't need to support variable speed, I've found that zero-crossing detection works quite well, as long as sufficient hysteresis is used. Some pre-filtering might not be a bad idea, but I found it wasn't strictly necessary in my application. Checking for errors in the sync word, illegal time values, or time that is way out of whack with the previous frame(s) is a good way to add robustness as well, and can all be easily done in a post-processing step. "Laza" <zoranlazarevic@yahoo.com> wrote in message news:1107804001.755081.11210@c13g2000cwb.googlegroups.com...> * Does anyone know of source code for decoding Biphase/Manchester > encoding from analog signal? > > I am looking for source code for a biphase decoder. The application is > extracting SMPTE/EBU time code data from analog audio signals (recorded > by professional audio/video equipment). I found source code that looks > at signal crossing an adjustable threshold (by Maarten de Boer) > > ftp://www.iua.upf.es/pub/mdeboer/projects/SMPTE/ > > However, this is not robust for real-world signals. > > I assume I need a clock recovery algorithm, then sample the signal > between clock edges. > > * Where can I find a clock-recovery software algorithm, or source code? > > If there is none, here is what I would try doing: > - create a narrow band-pass filter 2.4 kHz > - recover clock by running the data signal through the filter and > obtain close-to-sine-wave around 2.4kHz > - detect zero-crossing of the recovered clock > - sample or integrate data signal between the zero-crossings to detect > positive or negative symbol. > > * Is this the right way to go? > * Which band-pass filter should I use: Butterworth, Chebyshev, > Elliptic, other? > * The clock frequency shifts so I might need a PLL, or an adaptable > filter. Any advice there? > > More information on the encoding is at: > http://www.philrees.co.uk/articles/timecode.htm > > Thanks, > > Laza >
Reply by ●February 7, 20052005-02-07
No, I do not need variable speed time code. However, my signal is coming from a minidisc recording in MP3 format. I tried running it through Maarten de Boer's code (threshold = 50% of max) and it did not decode any correct time codes. BTW: since all is done in software (Winamp/Windows Media Player), even when speeding up the playback, the same number of samples are still being processed. That is equivalent to constant speed time code. However, the speed probably shifts a little and might not be 100% stable due to dubbing from analog tapes to digital format. Thanks for advice.
Reply by ●February 7, 20052005-02-07
I've never looked at time code after MP3 compression/decompression. Have you looked at the decompressed waveform with a wave editor or oscilloscope? Does it look reasonable? I'm not at all familiar with Maarten de Boer's code, but it well may that the underlying mechanism is sound but there is a simple bug/issue with the implementation. I'd be interested in knowing what effect MP3 has on SMPTE time code! Back when I was working on it, there was no MP3 (at least in common use) and since I was usually dealing with analog recordings, I was concerned with issues like noise, wow/flutter, frequency response, cross-talk, etc.. "Laza" <zoranlazarevic@yahoo.com> wrote in message news:1107807998.557671.265220@c13g2000cwb.googlegroups.com...> No, I do not need variable speed time code. However, my signal is > coming from a minidisc recording in MP3 format. I tried running it > through Maarten de Boer's code (threshold = 50% of max) and it did not > decode any correct time codes. > > BTW: since all is done in software (Winamp/Windows Media Player), even > when speeding up the playback, the same number of samples are still > being processed. That is equivalent to constant speed time code. > However, the speed probably shifts a little and might not be 100% > stable due to dubbing from analog tapes to digital format. > > Thanks for advice.
Reply by ●February 7, 20052005-02-07
Laza wrote:> * Does anyone know of source code for decoding Biphase/Manchester > encoding from analog signal? > > I am looking for source code for a biphase decoder. The applicationis> extracting SMPTE/EBU time code data from analog audio signals(recorded> by professional audio/video equipment). I found source code thatlooks> at signal crossing an adjustable threshold (by Maarten de Boer) > > ftp://www.iua.upf.es/pub/mdeboer/projects/SMPTE/ > > However, this is not robust for real-world signals. > > I assume I need a clock recovery algorithm, then sample the signal > between clock edges. > > * Where can I find a clock-recovery software algorithm, or sourcecode?> > If there is none, here is what I would try doing: > - create a narrow band-pass filter 2.4 kHz > - recover clock by running the data signal through the filter and > obtain close-to-sine-wave around 2.4kHz > - detect zero-crossing of the recovered clock > - sample or integrate data signal between the zero-crossings todetect> positive or negative symbol. > > * Is this the right way to go? > * Which band-pass filter should I use: Butterworth, Chebyshev, > Elliptic, other? > * The clock frequency shifts so I might need a PLL, or an adaptable > filter. Any advice there? > > More information on the encoding is at: > http://www.philrees.co.uk/articles/timecode.htm > > Thanks, > > LazaI come from a communications background, so some of these comments may not apply to audio. To recover clock from a PSK waveform, one can subject the signal to a nonlinearity to collapse the modulation into a single tone at the bit rate or a multiple of it. Example nonlinearities include absolute value and half-bit delay and multiply. The nonlinearity is sometimes preceded by a filter and always followed by one. I have had good luck with 2nd order Butterworth bandpass filters after the nonlinearity. After the BPF, one can trigger on alternate zero crossings to obtain sampling instants. If the clock frequency varies, the zero crossing will track, but the BPF bandwidth must be wide enough to accomodate the variation. Sometimes a PLL is used after the BPF to lock onto the recovered clock and provide a "flywheel" effect where the trigger instants continue even in the absence of zero crossings due to transitionless patterns and signal fades. Hope that helps some. John
Reply by ●February 8, 20052005-02-08
Laza wrote:>No, I do not need variable speed time code. However, my signal is >coming from a minidisc recording in MP3 format. I tried running it >through Maarten de Boer's code (threshold = 50% of max) and it did not >decode any correct time codes. > >BTW: since all is done in software (Winamp/Windows Media Player), even >when speeding up the playback, the same number of samples are still >being processed. That is equivalent to constant speed time code. >However, the speed probably shifts a little and might not be 100% >stable due to dubbing from analog tapes to digital format. > >Thanks for advice. > >The ear is largely insensitive to phase above about 2kHz. Music compression, therefore, saves bits by making no attempt to preserve the phase. I doubt any phase modulation technique will pass through MP3 compression/decompression. Regards, Steve
Reply by ●February 8, 20052005-02-08
Minidisc's (normally) do not use MP3 compression. Minidiscs normally use ATRAC compression which is similar perceptual compression but not the same as MP3. It would be hard to predeict what MP3 or ATRAC would do to the SMPTE signal. Your first step should be to examine the playback signal and see if it is even possible to recover the data. Mark
Reply by ●February 8, 20052005-02-08
John, thanks a lot. I think I will try the 2nd order Butterworth bandpass filter. I looked at the signal in Scilab software (free Matlab clone). Instead of having square waves, the signal is very rounded. The signal is bi-polar (either +1 or -1). Shifting by 1/2 bit and multiplying is not enough because that generates two clock pulses for "1" and one clock pulse for "0". Applying absolute value yields constant signal (+1) Steve, If the phase is lost in MP3 compression, how would that affect compressing a square wave train? I assume there would be a delay or an advance introduced randomly. Right?
Reply by ●February 8, 20052005-02-08
Rounding of the signal shouldn't make it unrecoverable, as long as What bitrate of MP3 were you using? I did a quick informal experiment on a snippet of SMPTE LTC I found on the web and found that with sufficient bitrate (say > 128kbps) the signal looked pretty good even after MP3 compression/decompression. But I was just looking at the waveform, not trying to actually decode it. To address another point, is it really MP3 or is it the ATRAC usually used on minidisc? I suppose you can use minidisc as a generic storage mechanism, and hence use any type of file/compression you like, but if it is recorded as a standard audio device, it will be ATRAC (at least AFIAK). "Laza" <zoranlazarevic@yahoo.com> wrote in message news:1107879397.409906.123360@g14g2000cwa.googlegroups.com...> John, thanks a lot. I think I will try the 2nd order Butterworth > bandpass filter. > > I looked at the signal in Scilab software (free Matlab clone). Instead > of having square waves, the signal is very rounded. > > The signal is bi-polar (either +1 or -1). Shifting by 1/2 bit and > multiplying is not enough because that generates two clock pulses for > "1" and one clock pulse for "0". Applying absolute value yields > constant signal (+1) > > > Steve, > > If the phase is lost in MP3 compression, how would that affect > compressing a square wave train? I assume there would be a delay or an > advance introduced randomly. Right? >
Reply by ●February 8, 20052005-02-08