From 14a3f9471a289138932aababe483db611e1b099e Mon Sep 17 00:00:00 2001 From: homer-jay Date: Wed, 31 Jul 2024 03:39:05 +0200 Subject: [PATCH] Update README.md Fixed the decoding script instructions since the line break processing has been removed from the code. Added info on how to redirect the standard output to a file. Added sections for the supported wav files and about the expected output audio duration. --- README.md | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a0d4a9f..751a5e3 100644 --- a/README.md +++ b/README.md @@ -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: