Archiving C64 Tapes Correctly
pagetable.com
pagetable.com
I was quite busy with that system, and ended up building a library of several dozen tapes, containing off the shelf software, but mostly software and data that I'd created and saved.
The problem I had was tape reliability. At the time, I estimated that each tape had about a 2-3% chance of becoming corrupt per day. Having more time than sense, I ended up going forward with an intensive, structured tape backup/duplication scheme, not unlike tape backup rotations I'd end up administering professionally some years later.
With the gear that I had, a tape duplication took 30-40 minutes, so this was a time consuming process, but it worked.
Why did my tapes go bad so frequently? In retrospect, there were two factors:
1. There was a high voltage step down transformer on a power pole about 20 feet from my room. I remember as a child that this transformer had problems at least a couple of times. In one case, it spectacularly sprayed sparks down on our back yard, and the electric company came out and messed with it multiple times besides.
2. In the other direction, our neighbor had a very tall CB antenna. Probably 30 feet or more, and the base of this thing was only 60 or so feet from my room. We know that he transmitted on illegal frequencies. (We sometimes heard his voice on our TV, I'm totally not kidding.) It would not surprise me if he was using illegal power levels too.
Good times.
That's most likely about power levels, and not illegal frequencies.
I worked at an AM radio station that was built in the middle of nowhere. Eventually the suburbs surrounded it, and the neighbors would complain about the sound of our station coming out of all kinds of electrical things.
That's what you get when you move into a house next to a radio station.
My first hardware hack was cutting the trace to the HLT line on the 8080A CPU and wiring up to a toggle switch to act as a pause button.
Also good times. :)
The problem I had was tape reliability
And now you know why the C=64 didn't use consumer tape recorders.
Ordinary tape recorder speed and volume of recording can vary from machine to machine. The 64's datasette was more strictly engineered, for compatibility between systems.
It's why on CP/M machines, you could hook up a generic tape recorder to record your programs, or you could spend extra money for a "data" cassette recorder, which helped improve reliability.
(The C=64 part is according to what I've read. I never had a datasette for it. I was one of the fortunate who started out right with a 1541.)
For computers they sold cassettes in short lengths such as 15-minutes.
The Datasette had a digital interface to the computer. This and the known calibration went a long way to help it.
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
[2] 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
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.
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. 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).
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/manchest...
Kansas City Standard: 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.
I can also recommend the command line tool UberCassette for easy conversion: http://www.retroreview.com/iang/UberCassette/
May be a way to find a bunch of different tapes on ebay, and recreate old classics.
EDIT: this is actually performed later in the article, whoops, I should have read the whole thing before commenting.
And that should also work for floppy disks, right?
It sounds like most of the devices used in the article would have low end quality motors, heads, etc. Such that a (still glitchy) copy on a new tape might read better.
I suppose it's possible the important bits of a high end cassete player aren't any better. Audiophile equipment is sometimes funny that way.
Edit: Found the full service manual for the Commodore 1530/1531 Datasette: ftp://www.zimmers.net/pub/cbm/schematics/datassette/C2N-1530-1531_Service_Manual_Preliminary_314002-002_(1984_Oct).pdf (hrm, guess HN doesn't linkify ftp:// urls?)
It's a different problem domain too. A non-linear tape head/amplifier may help with recovering pulses but have unpleasant distortion for audio.
At the time I wondered if data could be written to the tape to play a particular song. Anyone else wonder this and actually try it?
Otherwise the closest thing I can think of is Aphex Twin’s windowlicker where a particular sound in the song displays Richard D James face in a spectrum analyser ...
But if you have the original drive you might want to try to copy it off first rather than risk mailing it off anywhere. There are multiple options for that including the 1541 Ultimate II (1) if you have a C64 to do the actual copying (as far as I understand anyway), and USB adapters for the 1541 called XU1541(2) and XUM1541/ZoomFloppy (3). The USB adapters might be your easiest option; the ZoomFloppy is listed at $35 (note: I have not dealt with this company, so can not guarantee they're reliable).
If you do image it, I'd strongly recommend you submit any non-private content to one or more of the archives - there's still plenty of stuff floating around that's not archived anywhere.
(1) https://en.wikipedia.org/wiki/1541_Ultimate
(2) https://spiro.trikaliotis.net/xu1541
(3) http://www.go4retro.com/products/zoomfloppy/ and http://www.root.org/~nate/c64/xum1541/
Now back to those old cassettes. If saving them from one device to another or sampling and filtering them doesn't work, it may just be the poor 1531 that cannot cope with a signal too much dirty because it lacks the brains to recognize it, but our eyes could indeed spot the problem. No kidding, In the old days I spent hours for every single music track cleaning them from vinyl scratches by zooming the waveform in Cool Edit Pro until I could see every single sample. Scratches became clearly visible for having a very different shape, often a few samples at a level not compatible with normal music. With time I learnt to spot them even more easily, and after finding them and verifying that they were actual scratches, I spent even hours for a single track cleaning them by reshaping the waveform, by hand, one sample at a time. The reason behind this was Cool Edit's vinyl cleaning algorithm which at the time sounded like garbage.
Cleaning digital data should be much easier: one can load the waveform into an editor then zoom it until the signal becomes visible. It doesn't have to be readable by a 35 years old 1531, but merely recognizable by a human. Then either correct it manually (slow!), or write some macros to put x 1 or 0 samples where the mouse is according to a keypress. Then one can scroll the wave to a point where it starts an unknown bit; we know both data speed and carriers speed, therefore we know how many samples a bit is made of, this way when an unknown bit is met we know what to search for and based on this interpretation press a key which turns that series of unreadable samples into a nice 0 or 1 of the right duration and frequency. Still slow, but doable.
Analyzing the waveform at single sample level would also make possible to correct wow and flutter: again, we know the carriers frequencies and tape speed, so we know for sure how much long a bit must be and apply corrections where necessary.
Also, it might be interesting to sample all tracks at the same time into a multitrack file just like the cassette was a single side media. The reason being if the tape got damaged at a point, we can analyze the other track as well (yes, it's reversed but we're aware) to see if recovering one of them can help to save the other one too just by comparing a probably very similar damage done to two signals, one of which hopefully is easier to recover.