Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,39 @@ To encode a text file into a WAV file suitable for playback, do this:
This reads the file 'input.txt' and writes a WAV file 'output.wav'. The
resulting WAV file is encoded in mono with a framerate of 9600 Hz.


To decode a WAV file containing KCS data that you have recorded, do
this:

% python3 kcs_decode.py input.wav

Decoded text contained in the WAV file will be printed to standard
output. This decoding process will strip NULL bytes and convert
line endings to the native line endings for your platform.
output. To save the output to a file instead, type this:

% python3 kcs_decode.py input.wav > output.txt

### About input wave files

* The decoding script only suports .wav files encoded in PCM.
Other WAV file formats (such as compressed ones) won't work.
* Please make sure that the audio track starts with the leading tone and ends
with the trailing tone, otherwise extra bytes will be added to the output.
* The decoding script will only process the left audio channel.
* The script seems to work decently well with audio files containing moderate
white noise. If the audio is extremely noisy you could use an audio application
such as Audacity to clean it up. Audacity's noise reduction or equalization
around the 1.2 KHz and 2.4 KHz frequencies can help with this.


If you want to decode raw binary data, type this:
## Space Considerations

% python3 kcs_decode.py -b input.wav
Each byte in the payload is encoded into a 11 bits frame.
The Kansas City Standard encodes information at 300 bauds (bits per second).
That means that the output audio will have a duration of 0,036666667 seconds
per payload byte.
The encoding script also adds a 5s. leading tone and a 5s. trailing tone.
As a reference, a 90 min. cassette tape can hold 143,55 kB in each side.

In this case, output is still directed to standard output, but
is exactly as found in the audio (including all NULL bytes).

## More Information
See the following blog posts for more information:
Expand Down