3 ms·
Can anyone recommend decent method of decoding such signal? Here is description[1], it uses variant of frequency-shift keying (continuous phase FSK?). Accordin
by ungzd 8y ago
Can anyone recommend decent method of decoding such signal? Here is description[1], it uses variant of frequency-shift keying (continuous phase FSK?).
According to Wikipedia[2], which cites service manual[3], actual hardware just clips this signal, and (probably) software on C64 just detects zero crossing, using CPU clock for sampling. Are there better approaches, more tolerant to noise and inconsistent tape speed? Maybe using matched filters? Almost everything that I found was about radio which does not have problem of "changing speed of time": you have to correct drifting phase, but not frequency. I know only basics of DSP.
I'm interested primarily in ZX Spectrum, not Commodore 64, but it has almost the same modulation/encoding. It uses regular tape recorder, input port with two levels (above zero and below zero), no dedicated clock for sampling, and software decoding. Routine in ROM finds zero crossings and measures time of pulses. I think it's possible to do better with modern computers, and achieve better noise and tape speed tolerance.
[1] http://wav-prg.sourceforge.net/tape.html http://wav-prg.sourceforge.net/tape.html
[2] https://en.wikipedia.org/wiki/Commodore_Datasette#Physical_coding https://en.wikipedia.org/wiki/Commodore_Datasette#Physical_c...
[3] ftp://www.zimmers.net/pub/cbm/schematics/datassette/C2N-1530-1531_Service_Manual_Preliminary_314002-002_(1984_Oct).pdf
- avian 8y agoFor Spectrum, at least as far as ROM loader is concerned, decoding the signal is basically the matter of deciding whether a pulse is length t0 or t1. Technically it's FSK, but since each symbol is only one period long, it's more convenient to talk about pulse lengths. I don't think traditional matched filters are any help here. With a modern computer you could record lengths for all impulses present in the signal and then find a threshold that best divides the two groups. You could then do probabilistic decoding. E.g. if checksum doesn't match, try flipping the bits that are closest to the threshold and are most likely to have been decoded incorrectly.
- ungzd 8y agoBut maybe such "binarization" throws out information which might be useful? ZX Spectrum generates rectangular signal, after writing to tape and reading back, it becomes heavily low-pass filtered. So, I thought, if we take typical tape frequency response, pass ~1KHz and ~2KHz rectangle pulses through it, we get typical "0" and "1" signals as passed through tape, and if we cross-correlate them with tape signal, maybe we can achieve better results than by zero crossing detection? Also, what I felt unattractive in binarization/zero-crossing is that you should do band pass filtering anyways to fix DC offset and ripples that can affect zero crossings: https://imgur.com/ys78f1M https://imgur.com/ys78f1M. So, maybe if single filter is used for both frequencies of "marks" and "spaces", then we are doing it wrong and filters matched to marks and spaces could do it better? As alternative to filtering we can use adaptive binarization threshold and then morphology on binarized signal (AFAIK, this approach is popular in detecting various barcodes on photos).
- 8bitsrule 8y agoIn FSK (radioteletype or 'RTTY' is a well-documented case used commercially for decades) the most important factor in accurate recovery (especially for deteriorated signals) is the quality of the filters and clocking. Cheap circuits avoid using them, and so the methods they fall back on give poorer results. High-quality circuits will have excellent results even when the signal level is below the noise level. Since your software has to work with the output of an A-D converter, that has to be as good as you need it to be. A couple of widely-used, vintage standards: Manchester encoding: https://www.allaboutcircuits.com/technical-articles/manchester-encoding-what-is-it-and-why-use-it/ https://www.allaboutcircuits.com/technical-articles/manchest... Kansas City Standard: http://www.dabeaz.com/py-kcs/index.html http://www.dabeaz.com/py-kcs/index.html On the other side of archiving, get the best tapes and recorders you can manage, and get a good, strong signal to the tape. (Time will weaken that signal.) Then keep them shielded from magnetic fields.