Tapwav technical page

1. Does Tapwav generate sinusoidal or square waves?

From "The Commodore 64 Kernal and Hardware Revealed" (by Nick Hampshire) chapter about "Recording Method" we read (thanks to Mike for his scan of these infos):

"4.5 Recording method

[...] Whether the file being stored is binary or ASCII the recording method used is the same, involving an encoding method unique to Commodore and designed to ensure maximum reliability of recording and playback. Each byte of data or program is encoded by the operating system using pulses of three distinct audio frequencies. These are: long pulses with a frequency of 1488 Hz, medium pulses at 1953 Hz and short pulses at 2840 Hz. All these pulses are square waves with a mark space ratio of 1:1. [...]"

Tapwav generates perfect Square Waves (rising/falling time = 0 with every sampling frequency).

 

2. Why do Wav samplings of C64 tapes show the use of sinusoidal waves?

The sinusoidal type waves are created by the smoothing effect of capacitors in audio stages. This can be a problem in maintaining the sharp edges in certain types of instrumentation, and is the main reason why copies of copies lose the sharpness in sound quality, as they become dull or muffled.
This effect is shown below:

Even if the signal on a tape is a perfect Square Wave (yellow), a sampling done by playing the tape with an Audio Player would hardly produce anything close to a Square Wave, expecially if your audio deck is a low quality one.
The sampled signal would basically be a low-pass filter answer (cyan) to the square wave input, which is easily confused with a sinusoidal one (purple).
You may note this from a wav since equally spaced sampling of a sinusoidal signal produces values closer to the mid value (since I refer to unsigned 8 bit values) at the edges and, consequently, a slight inversion at the half (eg: 82 86 ...86 82 7D 7A ... 7A 7D). The cyan signal equally spaced sampling produces values which show exponential rising/falling timings and, consequently, an abrupt inversion at the half (eg: 86 89 8A ...8A 89 86 79 77 76 ... 76 77 79).
This is what I found out while building TapWav. Any correction is well accepted.

 

3. Why have longer waves a higher volume in Wav samplings of C64 tapes?

The reason for the big difference in amplitude of different length pulses is the fact the electrical circuit of an Audio Tape Player/Recorder (basically a Low-pass Filter) has a Gain not constant with frequency of the signals it can handle. This is more evident with low quality Audio Players/Recorders.
A Bode diagram shows this very well (note it's a qualitative one):

Gain of a Low-Pass filter

We see that longer pulses (lower frequency) correspond to higher Gain values, which produce a different scaling of different frequency waveforms. It's not just a different volume of waveforms.

Since I do not have an oscilloscope, I used a SoudBlaster Oscilloscope (OSCI V 1.0 by Ulrich W.Müller), and I report here some results obtained from tapes I had imported back, playing them with my audio deck:

Notes:

The deep difference between Source Signal (Square Waves) and Sampled Signal (.Wav file or Oscilloscope output itself) causes many problems with those programs which work with Wav samplings of C64 tapes to extract data. They will hardly recognize Synthetic Wavs due to this deep difference, so do not panic if you experience such a problem (eg: with Wavprg from Fabrizio Gennari or 64VOCTAP), it's normal.
Those programs were well coded to work with real Samplings. Giving them instructions to interpret .Wav files seeking for Square Waves would make them useless.

 

4. What about tapes imported back, did they give any success?

I've generated some Wavs with Tapwav 2.2, used Windows Media PLayer (I discourage the use of Windows Players to record Wavs on tapes) and my Audio Cassette Recorder (AKAI GX-M10) to record them on C64 tapes.
I've tested those tapes with a real C64 first, and they worked. I have no doubt: Tapwav generates Wavs whose structure is perfect (as 64TAPVOC does).
The only critical thing is recording back to tape: if you record the Wavs with the correct head position of your Tape Recorder, your C64 Datasette will work perfectly with them.
Also note that some Soundcards reverse samples. This may be a problem.
You may point out that reversion with an oscilloscope (or any substitutive software) and use the "reverse samples" option in Tapwav if you want to keep the original waveforms instead of inverted ones.

 

5. What if we analyze directly the signals coming/going directly from/to a Datasette?

The built-in hardware of a C64 Datasette does some signal adjusting before sending it to a C64.
Connecting my C64 Datasette to the Soundcard and using OSCI I've experienced the following signal, taken during CBM Lead-in train (a serie of short pulses at 2620 Hz corresponding to a TAP value of $2F) of a TAP I had converted and imported back with Tapwav:

We recognize Square Waves whose length is 380 microseconds about (exactly 2620 Hz). Amplitude is 1.4 V pp.
An identical result can be noticed by examining the RECORD Signal from a C64 during saving (unplugging the Datasette while doing this measure): the signal sent to the Datasette consists in Square Waves.
The same results may be obtained by examining original C64 Tapes.

I hope these results will remove any doubt about this topic. If you have corrections (also about my technical english) send me an email.

Luigi Di Fraia.

Last Modified: 21 Aug 2002.Back to C64 Section