CTAPE USERS WEBSITE

Welcome to the Worldwide Network of Active Users of CTAPE


Praise of CTAPE and TAR

by Gabriel Artigue
October 10, 2014


I started using computers in 1986. My first computer was a ZX Spectrum +. Loading games or programs from cassettes was a captivating experience. In fact, two things really caught my attention using the Spectrum: the load routines, as we called them back then, and speech synthesizers. Also playing, but playing was not really my main hobby. I was a compulsive copyist. I would exchange games with many people. So I had many copier programs. At that time I did not program. With a Specturm it is almost impossible not to know some BASIC, so I did know some BASIC. I've never really seriously learnt machine code. I missed the experience of creating my own load routine from scratch, which, I believe, I would have loved.
I did make modifications to load routines that others created. I knew how to find the parameters that change colors to choose those awful stripes at the border of the screen that flickered so annoyingly when loading from tape. Once I managed to set aside a quite small block (binary, we would say today, I guess) changing the blue and yellow stripes with white and black ones. It was a bit of which I hardly understand anything. I sent it to the Spanish magazine Microhobby who published it. Moreover, someone at the magazine disassembled it. I sent the binary, I think on paper, actually in hexadecimal. But someone disassembled it, which might suggest to readers that I had created it in machine code, and that was far from the truth.
For years or decades I wrote "cassette". For a year or so ago I decided to write it as it appears in the dictionary of the language in which I write. Now I write "casete" in Spanish. I do not judge those who do otherwise.
By 1989 my family bought a Spectrum +3. Despite the floppy drive, I never entirely abandoned cassettes. In 1990 my family bought a PC with a 5 1/4 floppy drive. Since then I've never had the need to use audio cassettes again to store computer-generated data. I wondered on occasion whether it is possible to use a present-day computer ("present-day" is an indexical, perhaps applicable to 1990-2013) to record programs or files on tape.
I started using PCs with DOS, and since then I was to use only DOS or operating systems sold by Microsoft for a long while. I think about the year 2010 I started using Linux. Using Linux changed my way of interacting with the computer a lot. For example, I'm now programmimg my own way, which I never did during my time as a Windows user and which I barely did in BASIC during my time as a user of the Spectrum -- because knowing a little BASIC was almost inevitable in a Spectrum. I want just to learn how to do a few things in some languages, such as, definition of variables, execution flow control, and little else. I don't need to know how to develop, I do not want to know perfectly any particular programming language, so I started to learn basic things in languages like COBOL, Fortran, a variant of BASIC (Chipmunk), and C ++. I realized that Linux users have more control over their own computer.
So, since I've been using Linux I am a diffeent user of computers. At some point the idea of using tapes for recording computer data sprang forth. I knew that tapes were used for home computers in the 80s, and I also knew that they had been used for storage for several years. I began to search for web pages on this subject, using search engines. I learned that spools of tape have been used uninterruptedly since the early 50s to record computer data. Spools of magnetic tape -- cassettes or cartridges -- are used today, especially for massive backing up of data in large companies.
I have no need for cassettes. Having purchased a modern drive to make a backup of, for example, 1 TB of my data, would have had very little resemblance to the experience of loading a small 40 KB game in five minutes, as I would do on the Spectrum. Realizing what my real needs were, and realizing what I did not want, I fine-tuned my goals and became more specific. I noticed that this interest of mine had to be described as a hobby. And what I was after was quite specific: to reproduce the experience of recording computer data on tape, but data of a current computer, and loading that data back to the computer.
I have several Spectrum emulators, but there are very few that support recording to cassette and loading from cassette. Overall the emulators replace the load routines with system calls (thus exiting the emulator) to save on hard disk and load from it. I think there is a Yugoslav emulator that runs on DOS that lets you use real tapes. I installed it on DosBox, and I have not succeeded yet.
Already knowing specifically what really interested me, my searches on Google were more specific. The first program I found was a python script made by Dave Beazley. Following that I learned about the Kansas City Standard, or KCS. I had to try Dave's script. I had no tape recorder in good condition at home. I realized that the KCS was maddeningly slow. I read that back in its day, in the mid-70s, it was already considered slow. Before getting a recorder, I could use Dave Beazley's script to successfully transfer files from one computer to another in real time, connecting them with a regular audio cable. What bothered me was not only that the KCS was so slow, but also that you had to record a wav file with the data in audio form first, and then decode it to binary. This stretched the entire loading process. Also, Dave Beazley's python script is only good for plain text files, but not for other file formats. In order to record a binary file or a jpg, for example, you had to convert it to Base 64 first, which is a way to encode binary data in ASCII, which inflates the file quite a bit. To the fact that it was a slow system to record data (the KCS) you had to add that the file had to be bigger if it was not a text file, and that it was mandatory to save it first to the hard disk as a sound (wav) file and only then decode it.
It was not that what made me give up using Dave's pythin script. What really made me give up were the failures with no exception when using actual cassettes. With difficulty I found a tape recorder in a store. It was a reporter's recorder, made in China by an Italian company. It was a new item, newly manufactured, not second hand. All attempts to use cassettes with Dave Beazley's python script failed. All of them. The decoding of the wav files was always frustratingly flawed. I knew the program worked, because I could transfer data from computer to computer with the audio cable. Dave's script was excellent. From the beginning the main suspect was the recorder. There was something in that tape recorder that made that the recordings be not good enough to successfully use this script. Yet the recorder worked well. As such it is a good device, and works well.
I could easily have stuck with this python script to use the KCS format, but the failure with the first recorder motivated me to keep for looking for alternatives. Google. This way I got to Ctape, a ruby script created by Oona Räisänen. This script does not reproduce any format -- current or past. It is barely inspired by the Commodore Datassette, but is not compatible with it. Ctape is not maddeningly slow as the KCS is. It is somewhat faster than the format the ZX Spectrum used.
I failed for a long time when trying to record the data generated by Ctape on tape. I knew I had to try another recorder. I bought another one, this time one from the 80s, a second-hand one, of course. It is a recorder very similar to that used for the Spectrum. It is a Sanyo SLIM 12A. The results with this Sanyo were mediocre, pretty bad actually: it recorded to the cassette, but rarely was it able to load. I thought that was random. Sometimes it would load, but not always, in fact only rarely did it load. I did not accept the explanation that it was random, that sometimes it would work just because, so that after I tried several different types of cassettes, I found the method to this madness. I tried with new cassettes, with old cassettes, with old but newly open cassettes, with cheap cassettes, with expensive tapes, with ridiculously cheap cassettes, with ridiculously expensive tapes, with 50, 60, 74 and 90 minutes cassettes, and also I tried cassettes type I and type II cassettes, though I had no idea what that meant.
With that Sanyo, the first thing I noticed was that it always loaded the recordings if I used type II cassettes. I stopped buying type I cassettes. It seemed absurd to me, it still seems absurd to me, because at the times of the Spectrum I think I never used type II cassettes. For some reason, today's computers are more demanding on the quality of the audio to be converted into data. Anyway, with type I cassettes the results were poor: a file would load back once out of fifteen or twenty attempts.
The type was the decisive thing. The cassette could be new or old, cheap or brand, but if it was type II it worked with Ctape and my Sanyo. But I was to find one more restriction. I bought some 90 minutes, type II cassettes. I saw that in some cases, the files stopped loading after a few days of being recorded. The worst result was provided by the BASF, type II and 90 minutes cassettes. In a BASF of those, sometimes in less than an hour a recording would become deteriorated so that the loading was impossible, and the recording unrecoverable. Along with the type, the duration was decisive. Ninety minutes cassettes were useless in combination with my Sanyo recorder and Ctape.
The main technical difference between the Sanyo and the Italian-Chinese recorder I was using is that the Sanyo has a thumbwheel to adjust the tone. My Sanyo recorder can only load the data recorded with Ctape if the cassette is of type II and less than 90 minutes, if the volume is very low and the tone to a minimum. The tone to a minimum. In contrast to the time of the Spectrum. Adjusting the tone is crucial. I think if I could control better the sound coming from the recorder I could use type I cassettes. In fact, some users have reported they have been able to record and load successfully using type I tapes although using a fairly good audio equipment. My personal experience is different. I cannot buy tape recorders all the time. I already bought two.
I stayed with the Ctape. It is faster than the KCS. And unlike Dave's script, Oona's script does not need an intermediate wav file, but it loads directly. Oona's script loads the file into the standard output. This is only useful if it is a text file. Moreover, if it is a long text file, it's no longer useful redirecting it to stdout. Fortunately Linux can redirect, so most of Ctape's usefullness is given by redirecting the sound coming from the cassette to a binary file. In fact, the way I use Ctape, it does not load the files from tape directly into memory, as did the Spectrum, but it copies from cassette to hard drive. I sought to replicate the experience of loading files from tape, it would have been a nuisance a real loading from cassette to memory. (Yes, a cassette loading to stdout is a way of loading into memory, but ... try to load a binary or a jpg to stdout.)
While searching for information on the use of cassettes to record computer data, I discovered that there was little interest in this. Few people talked about it, few asked on forums, and the least offered solutions, such as Dave and Oona. We should add that the few who mentioned these issues in forums are almost always misunderstood. I'll give you examples of the worst there is in the forums: people who understand nothing, but nothing at all, and still respond by giving information or advice without any humility. These forums are in English. They are http://www.tech-forums.net/forums/f78/tape-backup-52212/ y http://www.computerforum.com/13992-tape-backup.html Some of the comments in these forums are simply shameful.
The right thing would be to give the names of the miscreants. I don't have them. I'll give their nicknames.
A certain Adrian asks about the possibility of recording computer data on tape. Excellent. In a sense that Adrian is my representative in that forum (although that forum took place nine years ago). Someone nicknamed desiboi calls Adrian junkie for even thinking about the possibility of putting data on tape ("That's possible? Putting data on a tape? What are you on crack?"), shamefully ignoring the long and unbroken history spanning six decades of using magnetic tapes to store data. A certain DJ-CHRIS points out that the cassettes are limited in storage. Well. It must be assumed that the one who raised the question already knows that. So DJ-CHRIS actually is not contributing anything to the issue. A certain Harper gives one of the worst answers, saying that that technology is dead (he is an ignorant, that's simply a lie), and offers alternatives to make backups. He says, more or less, that if you want to make backups, he recommends the CDRW, the DVDRW, the I don't know what drive for backups, etc. As if the original question had been "Hello to all the members of the forum, I have a proposal that has not been ever put into practice so far, because I have an urgent need to back up thousands of GB of data: why not use audio cassettes for the first time ever to see if you can record computer data on them and, if possible, large amounts of GBs?". That Harper understood absolutely NOTHING. What happened to Wayniac? After commenting on the use of magnetic tape for data storage ... he suggests other ways to do backups, like DVDs or high-density DVDs. Many people did not understand what Adrian was asking. I do not understand why so many people had so much trouble understanding what Adrian was asking, I do not understand how it is possible that so many people did not understand anything of what Adrian was asking, when I myself, as an ignorant humanist who can barely use a computer, completely understood the original message that Adrian left in that forum. DJ-CHRIS adds that a cassette could not store much. Actually, he should have assumed that Adrian knew that. All those scoundrels who dared to reply to Adrian in these forums had to assume that this man uses means to backup his data. I myself use 1TB external hard drives, CDs or DVDs to store large amounts of data, but that issue has nothing to do with this different thing that motivates me now, which I guess was the same thing that motivated Adrian nine years ago: using audio tapes to store data because I like vintage things; as Adrian does, as he said in his first posting. DJ_CHRIS says that no sane person would create a software to write data to tape. That's insulting to people like Dave and Oona. A certain Byteman simply replied "no" to Adrian.
I'd like to add that my post was deleted from these forums after a few MINUTES. I just wanted to point out how shameful the responses Adrian received were. They punished my honesty. They punished the one who showed them the garbage, and swept it back under the carpet.
If Adrian is reading this, I am hereby inviting him to join my efforts, and I recommend him using Ctape.
So, I kept using the Ctape intensively with type II, less than 90 minutes cassettes. I recorded txt, jpg, zip, and tar format files. I had no visible problems with jpg files. With txt I had very few, and next is what happened to me with tarballs. Sometimes the file loaded from cassette displayed an error message, although it allowed to unzip and extract the files. Something was happening. I found the problem when saving and loading a source code, text file. I opened the file after having loaded it from cassette, and saw that it was missing the last line. The last line contained only a "}" or something like that, so I figured the last byte was missing.
I took a look at all the other files that I had loaded from cassette. I noticed that most were missing a byte, the last one to be specific. In some, few, cases, the file was intact though. The bug is thus manifested randomly and unpredictably. The jpg files have no visible damage for such a small corruption. I had to discover the bug in the way I found it out, or a very similar way: with a file in which a single byte is strictly necessary, as is usually the case for the source code.
Until today I could not determine if the files are recorded completely and the final byte is sometimes lost during loading, or if the final byte is sometimes lost in the recording and the loading is always complete.
A way to circumvent the problem had to be found. Solving the problem would imply learning ruby. I made an attempt to contact ruby programmers in the irc.ubuntu.com forums, but found none with the sufficient friendliness and motivation to be willing to study the short ruby scripts by Oona. To get around the problem, I remembered what I had done before with Dave scripts. Dave's python scripts only store ASCII code, so that to store a binary file it had to be converted to Base64 previously. So I did the same with Ctape. For some strange reason, I could always successfully convert the files loaded from cassette from Base64 to binary, despite the error messages caused by the fact that the last byte was lost. But it worked. This method has a major drawback, which is that the resulting file is larger than the original. But at least it worked.
After a while I decided to leave the Base 64. Personally, I was so glad I was able to successfully use Ctape, that I used it with Base64 for a while. It came to mind the necessary alternative when speaking of tapes: the tar format. I added a superfluous byte to a tar file, and I could open it successfully. The tar application seemed not realize that the file had an extra byte. Decompression was perfect. The problem had been solved. If the recording/loading left the file intact, then tar ignored the superfluous byte, and the process would take place in an excellent manner. If, as is the case most of the time, the file loses the last bye, it does not matter anyway because it is a superfluous byte, and the tar file is thus identical to the original.
The great advantage of tar over Base64 is that the resulting file is smaller or at least equal to the original, and never greater, nor certainly much greater - as was the case with Base64.
In addition, the tar format works great in conjunction with real tapes. Tar is more than a tool for compressing files. Useing tar with a cassette is to have a complete experience. If I only used cassettes, I would feel the need for something like tar; since tar exists, using cassettes I would come naturally this it. If I only used tar, I would feel something like an instinctive impulse to use cassettes.
The moment of improving the user experience of Ctape had come.
Painstakingly, I made a textual interface to use Ctape plus tar from an Ubuntu terminal. I used the dialog program, which uses the ncurses library. Through a menu controlled by the arrow keys, you can easily use Ctape. The script that generates the textual interface is responsible for compressing and decompressing by calling the tar application. It can be said that in this way the Ctape is really easy to use.
One must simply add the bash script I did to the two routines in ruby and the configuration file Oona wrote. The four files are in this page: http://gasconheart.sdf.org/tape/ctape-linux.tar.gz. You have to download the four files, put them in /usr/local/bin and give them executable permission with sudo chmod +x. This way, you can call from any Ubuntu command line by simply typing ctape.
The terminal does not respond to any key while the file is loading. To monitor the loading, open another terminal and type in: watch-n 0.1 ls /tmp/ -l
My thanks to Paolo Petrocelli who suggested using the watch command, and taught me many useful details regarding bash and using computers in general.
I tried Ctape in Ubuntu 10 and 13, Linux Mint 17, and it worked without problems. In Ubuntu 9 it did not work for me. I still have to find out if the real cause is the hardware I use, which is very old. In Ubuntu 9 Ctape works ... only in a useless way because the recording is interrupted leaving long silences.
Ctape dependencies are easy to satisfy. For Ctape to work properly you must have the following programs installed: ruby, sox, dialog, and tar. All these programs can be downloaded from the Ubuntu repostories.
I use Ubuntu and Mint as my main OS. I use other versions of Linux, only not that much. But I cannot help but notice that the majority of people are convinced that to use a computer you have to give money to William Henry Gates. I made a version of Ctape for those who use Gate's copyrighted OS. Do not even think of expecting a file like a setup.exe. In Linux you have to get dirty to make things work. This version of Ctape works on Gate's system, but it does so Linux-mindedly. To make Ctape work in Windows you need to install Cygwin, and the dependencies Ctape needs: sox, ruby, tar and dialog. Once you have installed Cygwin and those packages, copy these four files: http://gasconheart.sdf.org/tape/ctape-cygwin.tar.gz in the /usr/local/bin Cygwin's directory, make them executable just as it is done in Ubuntu, then you can call the script by simply typing ctape in the Cygwin terminal. I fell sorry for those who comfortably expect a setup.exe file, and I always will until they decide to get dirty (rhetorical exaggeration). I do not know how to program in bash, in fact I do not know programming at all. The ruby scripts Oona wrote are Greek to me. It took me hours (spanning several days) to make the bash script that calls the other scripts and dialog. It took me hours to realize what I had to change in the YAML file to run the scripts in Cygwin; the change was very small, but necessary, and a connoisseur of sox and Linux would have spotted it in a jiffy. I write mainly for Ubuntu users and users of other related variants of Linux. To people who come from other trenches, the first piece of advice I give them is that they become users of Linux. If you persist in being willing to keep giving money to the richest man in the world in order that he gives you permission to use your own computer, then I recommend you install Cygwin.
Using cassettes for recording computer data today, in 2014, does not satisfy a need. It is not true that no one in their right mind would develop an application to do so, as someone said. But, look, the authors of scripts to record computer data on tape, both felt a kind of shame. Yes, a kind of a shame that manifests itself in the explanations that they both voluntarily gave about why they wrote those scripts. Analyse Dave's explanation:
"Why Bother? Aside from the obvious nostalgia (the Superboard II being my first computer), why bother messing around with something like this? After all, we're talking about a long-since-dead 1970s technology. Any sort of practical application certainly seems far-fetched. [...] Anyways, getting back to my motivations, I don't really have any urgent need to access my Superboard from my Mac. I'm mostly just interested in the problem of how I would do it. The fun is all in the process of figuring it out" (http://dabeaz.blogspot.com.es/2010/09/using-telnet-to-access-my-superboard-ii.html).
Oona Räisänen says: "I had contemplated using Compact Cassettes as a cheap, fun and hipstery small yet valuable media for backups."
I do not mean a great shame, like one that could accompany the public confession of a very embarrassing deed. It's just this little thing, wanting to explain that voluntarily anticipating possible criticism, anticipating someone blurted them, ridiculing them: "why do you waste your time doing that?". It is a little shame if you want. Certainly not the huge embarrassment that accompanies ignominy.
I took the decision not to explain to ANYONE why I am an active user of Ctape. I proudly claim using ordinary audio cassettes for recording computer data. Ctape users have less social acceptance than gay people. We still have to do our utmost to explain why we do what we do. Currently, in general, a gay person does not have to explain anything to anyone about his or her essence. Indeed, today, fortunately, someone harassing a gay person asking for explanations about why he or she is the way he or she is is frowned upon. I am proud to use audio cassettes for recording computer data. I may have my reasons. I think I do. It's only that I give up looking for them just to satisfy a curious impertinent who thinks they deserve an explanation. It's like building a ship in a bottle. One can not approach someone building a ship in a bottle and go "numbskull, it is easier to build it out of the bottle." We must assume that he knows it, and that he has reasons, or just the motivation, to do it the way he does.
I'd like to organize a community of users of Ctape. If I might suggest some conditions they would be as follows.
Members must be active users of Ctape. Not just curious people that used Ctape once and then abandoned it.
They have to be people using real cassettes, not digital recorders of any kind.
Members need to be sure that they are free if they ever decide to explain to someone why they use Ctape. Giving explanations should not be forbidden, but discouraged instead, and above all we must give us the freedom to give these explanations or not.
The members have to share their achievements with the rest of the community. For example, describing what results are obtained with each type of deck and each type of cassette tape; adding the details of the recorder, such as brand, model, year of manufacture, etc., and data about the cassette, such as if it is of type I, type II, which brand it is, lenghth in minutes, etc.
The exchanging of audio tapes by mail can be organized. Other suggestions are welcome.


 
This template downloaded form free website templates