Pd/Faust KCS Decoder Example ======== === ======= ======= This is a little demo for the Pd/Faust and Pd/Q interfaces featuring a decoder for the "Kansas City Standard" (KCS) signal produced by the FA-3 tape interface of the Casio PB-100, FX-730P and similar early Casio Basic calculators. KCS uses "frequency shift keying" to encode binary data; a 1200 Hz tone denotes binary 0, a 2400 Hz tone binary 1. KCS dates back to the venerable first microcomputers like the Altair, as a cheap way to record data and programs on tape recorders when floppy drives still cost a small fortune. It was subsequently used by various Basic-programmable calculators produced by Casio and other manufacturers in the 1980s. More information about KCS can be found on Wikipedia. A description of the hardware of the Casio PB-100 series of calculators and their implementation of the KCS interface is available at http://www.pisi.com.pl/piotr433/. EXTERNAL MODULES -------- ------- The Faust DSP module for decoding KCS can be found in the kcs~ subdirectory. It takes a KCS-encoded signal as input and produces an output signal with binary 0 and 1 encoded as single sample pulses of -1 and +1 (and 0 everywhere else). The bit~ subdirectory contains a little Pd external written in C, which translates the output signal produced by kcs~ to a control stream of 0 and 1 values. Precompiled Linux binaries for both externals are included in the tarball; if necessary you can recompile these by running "make clean" and then "make". If you also want to recompile the Faust source, you need to have the Faust compiler installed, available at http://faust.grame.fr/. The tarball also contains the Q module kcs.q which is used inside the Pd patch to do the symbolic processing, translating the stream of bits returned by kcs~ and bit~ into a stream of 8 bit bytes. This module can also convert the decoded byte stream into plain program text (this currently only works with Basic programs recorded in the format used by the SAVE/SAVEA commands of the Casio PB-100 series calculators). Note that you need both an installation of the Q interpreter and the Pd/Q external (available at http://q-lang.sf.net/) to make this work. USAGE ----- The KCSDecoder.pd patch is the main program which takes KCS audio input and shows the translated output in a GUI element as well as Pd's main window, either as a sequence of decoded bytes or as plain text. Note that the plain text output is slightly garbled since Pd insists on quoting some special characters like the semicolon. As a remedy, the output is also echoed on Pd's stdout. Also note that the main patch doesn't do any real processing of its own, it just provides the user interface, audio input and the necessary plumbing between the kcs~, bit~ and ksc.q modules which do all the hard work. The patch has an autosensing feature which makes it start decoding automagically when it senses an input signal. If this doesn't work for you, then you can uncheck the "autosense" toggle and start/stop decoding manually by checking and unchecking the "start/stop" toggle (make sure that the "dsp" toggle is checked before you do this). The patch also has a few scopes for monitoring the input signal and various intermediate signals, as well as a "thru" toggle which passes the input signal to Pd's audio output so that you can listen to the input signal while it is being processed. When using autosensing, you run the decoder by simply hooking up the white minijack of your Casio FA-3 interface to Pd's audio inputs (usually via the microphone or line input of your PC) and issuing the "SAVE" or "SAVEA" command on your Casio calculator which will transfer the current contents of the calculator's Basic program memory. The decoder should then do its thing, printing the decoded bytes and/or program text in realtime. (You'll have to be patient, as even transmitting a simple 3-lines Basic program at 300 bps takes its time. ;-) When running without autosensing, you'll first have to check the "start/stop" toggle, then start the transmission on the calculator, wait for the transmission to finish (i.e., until the calculator prompts you for the next input line) and finally stop the decoder by unchecking "start/stop" again. In any case, the kcs~ unit should automagically adapt to the level of the input signal. There is a "gain" control to adjust the input gain in case the input signal is too weak, but actually this shouldn't be necessary unless the input level is much too low to be usable anyway. I've also uploaded some recorded transmissions from the FA-3 as WAV files, for those of you who don't have a compatible calculator (the FX-730P can still be bought on ebay, but the FA-3 tape interface is getting hard to find these days). These can be found at the same location as this tarball. When using these files, you'll have to figure out how to pipe the output of your audio player into Pd, but this isn't a big deal when using Jack (http://jackaudio.org/). You do know Jack, don't you? ;-) Enjoy! :) 3-3-2007 Albert Graef