Python scripts for manipulating cassette tape data (etc.) for CyberVision 2001.
Some information.
"cybervision_decompose_cassette.py" decomposes a wav file into an audio track (if any), a series of text files and a configuration file.
"cybervision_decompose_cassette_new.py" is based on my analysis of the hardware. Unfortunately, it is currently not so good at reading the data.
python cybervision_decompose_cassette.py [-i] (basename)
This reads (basename).wav
and outputs a number of files.
With "-i" option, the phase is inverted.
See the beginning of the script for other options.
If the wav file is stereo (i.e. has 2 channels),
the left track is output as (basename)_audio.wav
.
From the data track, each continuous block of bits is written as
(basename)_nnn.txt
, where nnn is the serial number starting with 000.
This is a text file expressing the bits with 0
and 1
.
Finally, a text file (basename)_out.cfg
is generated,
which contains the information of the cassette and can be used as an input for
cybervision_compose_cassette.py.
See Configuration file for the format of this file.
A warning is given if the gap between blocks is too short (which might mean that the data was corrupt).
If the script gives many warnings or incorrect output, it might be because...
- The threshold for amplitude is too high or low. Change "amplitude_threshold = 0.02" to an appropriate value.
- The phase is inverted. Use "-i" option.
"cybervision_compose_cassette.py" creates a wav file to be used with CyberVision. Caution: this is SLOW.
python cybervision_compose_cassette.py (basename)
Reads the configuration file (basename).cfg
and create (basename)_out.wav
according to the configuration file.
Prints out the line currently being processed.
Each line of a configuration file is a command. In each line, anything after the first 2 words are ignored.
C (n)
F (n)
W (n)
Set the number of channels, framerate, or sample width to (n)
(an integer).
These should be used only once at the beginning.
A (filename)
Use (filename)
as the audio track.
This should be used only once at the beginning.
The number of channels, framerate, and sample width are overridden.
T (x)
Skip to time (x)
(a floating point number, in seconds).
S (filename)
Write serial data from (filename)
.
In (basename).txt
, anything other than '0' and '1' are ignored.
In the output from cybervision_decompose_cassette.py, the third word is the time where the block ends.
B (filename)
Write binary data from (filename)
.
A start bit (1) and a stop bit (0) are added at the beginning and the end of each byte.
python cybervision_serial2bin.py (basename)
Reads the text file (basename).txt
as a serial bitstream, with start bit 1 and stop bit 0,
and writes the binary to (basename).bin
.
Another output is a text file (basename)_split.txt
,
which is given by adding a newline before each start bit.
python cybervision_strings.py [-p] [-a] [-A] (filename)
Prints strings in a binary file. A character is an even byte between 0x0 and 0x4E. Consecutive character codes terminated by 0x88 are regarded as a string and is printed.
With "-p", treat the file as a program and read the header to set address. With "-a", print all strings of characters of length >=2 that may not end with 0x88. With "-A", print all characters.
If cybervision_decompose_cassette.py could not read the data correctly, it is often because of level drops. Then, typically, the script gives warnings.
Locating this by an application like Audacity,
reading the correct value and fixing the ''serial file'' manually
(*_split.txt
from cybervision_serial2bin.py might help)
and editing cfg file,
it is sometimes possible to fix the data.
A "Hello" program is in example directory. (I am not very sure about what should be in header.txt, but this works.)
Voiceover was generated by Micmonster.