Aug 28, 2012

Vintage bits on cassettes

I had contemplated using Compact Cassettes as a cheap, fun and hipstery media for small yet valuable backups. Perhaps it would even be possible using only an ordinary tape recorder. So finally I thought: How hard could it be? Let's give it a try!

Searching led me to a Wikipedia article about the Commodore Datassette. It was a tape format used by the Commodore personal computer. It used two different frequencies to encode ones and zeros, and they were read back by simply detecting zero-crossings. I exploited this invention and modified it a bit by adding start and stop bits and a 50-byte lead-in tone:


The resulting program is on GitHub.

Compact Cassettes sell for 20 cents at flea markets. They come in many colors and capacities. Using the data rate I chose about 1.2 MB fits on a single cassette.

Video proof below!


By the way, I only used text for demonstrational effect. All kinds of data can be saved onto the cassette. A nice way to do this is to use .tar files (which, incindentally, stands for "Tape Archive"!).

Edit: Here's some PNG data:

Update 2/2013: I've improved the modulation scheme since. I added a slight inter-channel delay that alleviates short losses of signal on the tape. There's also a calibration header to account for polarity or stereo reversal.

15 comments:

  1. sooooooooooooo cool!!

    ReplyDelete
  2. So, can you store more bytes on an audio CD in data mode, or as an 80 minute .wav file from your program in audio mode? :D

    This is extremely interesting (even more than your dial-up modem poster, imo). Excellent work!

    ReplyDelete
  3. Fantastic! I also have a nice tape deck near my PC, thinking about taking this for a spin.
    Love that you're going back and analysing the old data storage/transmission methods, unveiling the ingenuity of the engineers who designed this old technology.

    ReplyDelete
  4. Would be interesting to use all 4 tracks of a cassette at the same time.

    ReplyDelete
  5. It would be cool to start sharing "secure" data this way, to see what people can come up with. This would make software encryption look dumb. Awesome work, btw you should upload more of your work to youtube

    ReplyDelete
  6. Larry: You could do stereo, double sided. Just have to flip the tape over.
    There are 4-track recorders like the little Portastudios, but then you need an audio output on your computer to handle a 4-track sound file

    As for "security", it's "security through obscurity" in this case. There's plenty of sensitive information passed on tape, where the cost of reading it is too high for the average PC user. Here, the reading mechanism is so common that if someone guesses what the tape is, reading it is trivial thanks to miss Oona here :)

    ...it's still loads of fun to do :D
    I've been looking into data storage on VHS after this, it's a LOT more complex due to the way VHS heads read and write in a helical manner, which makes for a superbly dense storage medium but introduces the tracking problem that plagues old VCRs. For analogue video that's not so bad, when you're dealing with data it's a far larger issue.

    ReplyDelete
  7. Using both channels separately would indeed double the capacity! As for security, the data could simply be encrypted before encoding.

    A problem I've noticed is when an old tape has short demagnetized or wrinkled sections and the audio disappears for a split second. The data format needs some redundancy for error protection.

    ReplyDelete
  8. I was running a course with a colleague in the late '80s and we were due to run it just after a holiday time so there was no way of posting the document to him. We had a course plan written in an early word processor - on a machine which could save to cassette. I discovered if you played that cassette down the phone (headphones on the phone mouthpiece) and my colleague recorded it through a microphone at his end and then played his tape into his computer - voila! The text magically reappeared. Way before email. Seemed totally magical at the time and genuinely useful for our planning.

    ReplyDelete
  9. Ye olde computers had so little processing power that they had to resort to simple FSK/PSK at very low bitrates. But what if trellis modulation is used, for example, like in modern modems? Tape is much better than phone line, no line noise, no evil exchange putting sticks in the wheels. Theoretical limit for lower-than-decent tape recorder at 12.5kHz BW with 50dB SNR is about 200kbit/s, 25kB/s, which would make about 135Mb per 90 min if using mono, 270Mb for stereo. Curious! Imagine legible video playback from an audio tape.

    ReplyDelete
    Replies
    1. PXL-2000 used a Compact Cassette as a video cassette.

      Delete
    2. I heard about it before. It's not really very interesting, or rather interesting from the low-end side of things: it did not use any sophisticated data modulation, more like simply ignored the limitations.

      Here we're talking about high-end cassette tape data storage :) Anyway, something to muse about. Wikipedia says that high-density data streamers using regular audio cassete actually existed and stored up to 60MB per tape.

      Delete
    3. Some cassette data recorders (like the DAT?) used helical scanning, IIRC. But it'd be interesting to try and squeeze more data onto it :)

      Delete
    4. In converting existing audio to image, I haven't had any time to sit down and play with it, but you seem magical with the skillz, so here's a suggestion... create the 'image' from the audio by first folding up the 'paper' that the image will be printed upon in the manner used to create different 'snowflakes' by folding and cutting the paper. Once the 'paper' is folded, the same audio can be converted to video, either filling the entire area (like your LP from sound image) or taking sections and creating video. So with a known range of signal values, the 'paper' can transition from 'solid' at one end to 'cut away' at the other. With different types of folding templates, different kaleidoscope effects could be obtained with the same general philosophy. Good Luck!!

      Delete
  10. Way to go! I worked on a similar concept for my undergrad research project in '97-98 using a sound blaster and consumer cassette deck, but I failed mostly due to aiming too high instead of using a simple encoding. I suspected as well that the processors then couldn't deal with the FFT I was using to detect multiple data tracks.

    Also, there was a system out in that time frame that used VHS tapes to store much more data as video thanks in part to the helical scanning method and the larger tape area. The tapes would play in a VCR and had numbers in the upper left corner of the screen to represent the memory page index, so one could use a reference index to "seek", i.e. fast forward, to a specific file.

    ReplyDelete
    Replies
    1. The scheme used here is very simple, so the tape could be read back using only a 1-bit ADC. No signal processing is needed, either.

      Whoa, the visual seek sounds interesting :o

      Delete