10 years ago I wrote a C++ program to convert programs from my old computer to binary files on the PC. There were several old computers of that kind, so it came down to supporting three different kinds of formats. Unfortunately I had only information on two of them at the time. It did its job, but finding the correct settings turned out to be very hard for users who did not know all details of the tape format. Now it has been high time to keep my promise to write a better and more intelligent program.
Getting the data off the tapes is the easiest part: Hook up the tape recorder to the PC's sound card and sample them as WAV files. The raw samples usually don't look very good. They come from more than 30 year old tapes and analog tape recorders. This is why some filtering was in order. Even the old program did a good job at reconstructing the original digital signal with the help of some mathmatical magic.
Now the buffer should contain a sequence of longer or shorter high/low sequences, representing bits. Plus static at the beginning and the end and possible errors in the data. Simply counting the samples would not have worked.
In the old program the user had to figure out the minimum and maximum sampling settings for both ones and zeros. That involved a lot of trial and error until reliable settings were found, but then it usually worked for all tapes from that computer.
It was not easy and involved something resembling fuzzy logic, but the new program has just successfully converted a WAV recording from my old computer correctly at just the second try. It figured out the correct timing, automatically corrected the inverted signal and then correctly generated a 4096 byte binary file of the program. The second try was only needed to (still manually) set the filtering to a stronger setting. There was a small glitch in the middle of the data.
Now I must wait fot WAVs from other computers to test the other formats, but I think the concept works. Getting the binary files onto the old computers actually is very easy. The program can generate a new WAV file from the binaries, in any of the three formats of course. Save them to tape or play them directly to the computer and they will load.
This way we can even program conveniently on the PC. I Use Visual Studio, a special little C compiler and an emulator for testing. When I'm finished, I just create a WAV from the binary file and then can import and run it on the real thing.
It's amazing, but most of the tapes still load into the old computer as they are. They were not the best quality tapes to begin with and the oldest programs are from 1978. It's really a small miracle that they still load. Other users were not so lucky when they brought back their old computers from the attic.