As I keep getting asked what blue bands and green pixels stand for in my tape dumping firmware (DC2N3 and DC2N5-LC), client software (DC2N4-LC), and analysis software (e.g. Web-based tape analysis tool, TAP Studio), I thought to take a moment and explain it all.
Let’s first have a look at an example:
Going by the definition of the TAP format: the duration of square waves is recorded using 8-bit samples, with a resolution of about 8.12 microseconds, or, if you prefer, using a counter rate of 123.156 kHz.
Back in the day, square waves were used to hold information on cassette tapes: different durations mean different information bits to be conveyed. The CBM Standard loader for the C64 uses three such durations, often referred to as short, medium and long. Obviously due to the tolerance of the electronics and moving parts involved in reading and writing tapes, when sampling CBM files we often observe a cluster of values around the three “ideal” durations as per CBM’s specification.
Using a 5 MB TAP file that contains exclusively CBM files, “Cassette 50 side 2” contributed by Peepo, I created a diagram of the occurrences of each sample in the TAP file, focusing on the range $22-$5B as there’s very little outside such range:
Going by CBM’s specifications, we know that things make sense. Specifically, long pulses are less frequent as they are only involved in the definition of stop bits at a byte boundary, and short pulses occur way more often than medium pulses as pilot and trailer sequences use short pulses exclusively.
As we can appreciate from the above image, samples 0x2F, 0x41 and 0x55 are occurring the most here, with similar values clustering in their neighborhood. These clusters appear to be very well separated from each other and very much tight around mean values: this is an indication of the fact that the quality of the sampling is good, meaning that the negative effects of the tolerance of the electronics and of the inaccuracy of the alignment and operation of moving parts are negligible. This is extremely good news because further analysis and data extraction should be quite simple a task when the starting point is a good sampling.
Based on field learnings, gathered from the analysis of hundreds (probably thousands by now) of TAP files sampled over the years by different contributors, I would comfortably say that when samples do not deviate from the ideal values more than 3 units each way (in TAP resolution terms), then the sampling is very likely to be good. In other words, we shall say that given a tape with CBM files in it, if samples from such files satisfy the following criteria, then the sampling is good:
- short pulse samples are bounded in the range: $2C-$32 (2463 Hz – 2800 Hz)
- medium pulse samples are bounded in the range: $3E-$44 (1811 Hz – 1986 Hz)
- long pulse samples are bounded in the range: $52-$58 (1400 Hz – 1502 Hz)
Bear in mind that this is not equivalent to saying that CBM files for which the above criteria are not met are not good. In other words, the above condition is sufficient, but not necessary for a sampling to be good. The reason is going to be the topic for a more advanced discussion on this subject at a later time.
Back to ranges: blue bands are nothing else than the graphic representation of such ranges. Given a CBM file, if green pixels, i.e. TAP samples, consistently cluster inside such blue bands, then the sampling is good.
In other words, the position of green pixels relative to blue bands is a way to visually inspect samplings for quality, using references gathered from the analysis of a massive amount of CBM files.
For completeness, let’s now have a look at a tape sampling that is not as good as the one discussed earlier as the green pixels form larger clusters that also get worryingly close to each other at times:
And now a couple from the category of samplings that are not good at all:
Believe it or not, these last two are actually completely faulty samplings of CBM files: the pilot part should be easily recognizable as it does, more or less, fall into its own reference band.