Hi,
There's another installment from Dave Beazley on his Superboard II.
This time he's decoding an audio recording from it into bytes. (Some of
the Python may be a bit harder to follow than before.)
Decoding Superboard II Cassette Audio Using Python 3, Two
Generators, and a Deque
http://dabeaz.blogspot.com/2010/08/decoding-superboard-ii-cassette-audio.html
He uses a deque as a sliding window over the audio samples, maintaining
a count of the number of zero-crossings in the deque. Given that the
`silence' before the data starts is the high frequency of a 1 and the
start-bit is a lower-frequency 0, when that ZC count drops low enough,
he knows the start bit sits squarely in the deque. He can then chomp
through the following audio samples a bit's worth at a time until the
whole byte and two stop-bits are consumed before returning to the
sliding window search.
http://en.wikipedia.org/wiki/Deque
http://en.wikipedia.org/wiki/Zero-crossing
He provides code and WAV to download and run. Here's the output with
cat(1) showing up the CR, NUL, ..., LF that the SII outputs as a delay
for when it has to read and process the data later.
$ python3 kcs_decode.py osi_sample.wav | cat -A
^...@^@^...@^@^...@^@^...@^@^...@^@$
^...@^@^...@^@^...@^@^...@^@^...@^@$
10 FOR I = 1 TO 1000...@^@^...@^@^...@^@^...@^@^...@^@$
20 PRINT I;^...@^@^...@^@^...@^@^...@^@^...@^@$
30 NEXT i...@^@^...@^@^...@^@^...@^@^...@^@$
40 end...@^@^...@^@^...@^@^...@^@^...@^@$
ok...@^@^...@^@^...@^@^...@^@^...@^@$
$
I expect the next installment will be to translate a subset of Python
bytecode to 6502. :-)
Cheers,
Ralph.
--
Next meeting: Blandford Forum, Tuesday 2010-09-07 20:00
Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/
How to Report Bugs Effectively: http://bit.ly/4sACa