F. Data recovery

Byte magazine sponsored a symposium in November 1975 in Kansas City, Missouri to develop a standard for storage of digital computer data on inexpensive consumer quality cassettes, at a time when floppy disk drives cost over $1000 USD each.

We found an old casette with digital data on it. Unfortunately it seems to be recorded before the standard came out. Help us to recover lost information!

Input format

Inputs are wav files digitized from the cassette. Storage format:

The audio is sampled at 18000 Hz frequency using 8 bit samples and it is given as mono, uncompressed wav. (Wav headers can be easily skipped by ignoring the first 44 bytes and reading the raw data directly; each byte of raw data is an unsigned 8-bit integer.)

Output format

Your task is to decode the text from the digitized audio signal found on the cassette. The media is rather old and might be a bit distorted, do not expect clean wave forms. If some characters cannot be decoded due to the noise, try to figure them out from the context.

Solutions are compared to reference outputs byte by byte, except that we are tolerant with some specific cases of extra white spaces and we are also liberal on the newline format.

Example

example of recorded data for a single 'A' character

The above figure demonstrates character 'A' (ASCII 65) with clean sine waves: "0 02102 12". It begins with the start bit (1000 Hz), then contains the character data (1000, 3000, 2000, 1000, 3000), closing with the two stop bits (2000 and 3000 Hz).