Good day, everyone.
I'd like to experiment loading in data via an audio signal. Something along the lines of this:

For starters, I just want to transfer simple text data using audio and save it onto a text file on the arduino sd card. What is the basic principle for discerning between a 0 and 1 for audio? From what I've heard in some youtube videos, there are two tones involved. A high pitch for 1 and low pitch for 0. That tells me that there is supposed to also be a some sort of frequency detection method that could tell the two audio signal frequencies apart. My other thought was to use Silence for 0 and Tone for 1. However this is where issues with clock come into play. Without a clock signal how can your program know if the silence it just sampled 15 times is actually just still one single 0 bit instead of 15 0 bits?.

Without using frequency reading, I'm thinking perhaps I can use an ADC and use amplitude instead. silence is clock, audio volume ~2.5v is a 0 and 5v is a 1. then I can use the silence in between the bits to indicate that this is the end of a bit and the program has to wait for the next silence to interpret the next bit?

I'm probably wildly overthinking this, I'm sure the engineers of the yore have had this problem solved a long time ago.

This is just a fascinating subject to me and I would love your input.

Haha. 40 years ago we used a 300 baud link using 2 different frequencies for communicating. It was used in audio modems as well as for saving data on casette tapes.
Why do You want to use such an old standard?

I want to implement the aesthetic of it for a tiny project of mine. Sure I can just pop the sd card out and copy the files but realistically the question isn't really how to transfer files. It's the replication of an authentic experience of loading data via tape that I want to try and re-create . The experience of it.

That old way of coding data made it possible to use a standard telefon, at that time, 1980, for data transfer. The telefon microphon/speaker was pushed inte a foum plastic holder….. I just don't remember the name of the coding/method.
I used it to type the source code for an operating system into RAM memory, then saving the code on a casette tape, starting the compilation and running the tape twice.

Sure, it's fascinating.
Search for that old standard! It's realy old and basic.

Using silence will be a problem. How do you tell the difference between silence because the data is all zeros and silence because there is no data.

Use two tones. There are libraries for Arduino that can do basic frequency determination. Or you can do that with hardware.

Google for old copies of Byte magazine and Kansas City standard interface circuits.

Delta_G:
Using silence will be a problem. How do you tell the difference between silence because the data is all zeros and silence because there is no data.

Use two tones. There are libraries for Arduino that can do basic frequency determination. Or you can do that with hardware.

You mean this? yeah that could work.

@TheMemberFormerlyKnownAsAWOL
You make the bells ring.

I built such devices 50 years ago, using FSK of 1200 and 2400 Hz. But good recorders at that time were too expensive, and voice recorders had horrible quality and noise. HiFi cassette recorders work better, also at higher frequencies. Get a cassette deck with a tape counter, so that you can locate your records later.

Creating two frequencies should not be hard for an Arduino. Eventually an RC low pass filter should be used to remove the sharp edges from the square waves before recording.

I remember "digital PLL" for decoding, using one or two flip-flops. But with a known base frequency and a sine-to-square wave converter (comparator...) it should be possible for an Arduino to determine the number of full waves of one of those frequencies, and convert that into a bit stream. Dont try analog input of sound, the Arduino ADC are too slow for reasonable results.

The Kansas City Standard cassette tape format is described here, with references.

Source code, or disassembled ROM listings to read and write files to audio cassette tapes are available for very few of the old computers. One example is the Tandy MC-10, see replies # 3, 4 and 5 in this thread.

C code (for PCs) can be used to decode Kansas City Standard cassette tapes that are dumped and encoded to .wav files by Audacity, and is presented and demonstrated here.

Hi,
This might help;

Tom...

I’m by no means an expert on this topic, but would using two levels rather than two tones be an easier way to implement this? You wouldn’t have to do all of the math to determine frequency, just need to look at the signal level. Of course, you’d have to make sure the volume on the tape player is set correctly which wouldn’t be nearly as important if you were determining the frequency instead.

To eliminate the need for precise timing, I would use dead silence to indicate the break between bits, then look for a medium (0 bit) or high (1 bit) level next.

Cassette tapes are useful only for low quality audio signals, and cannot record DC levels.

Try to learn more about the handling of audio material with an Arduino. Frequency detection is easy, by simply measuring the time between slopes. The only requirement is a digital (square wave) signal from the analog (sinuosidal) signal, using readily available modules.

DrDiettrich:
Try to learn more about the handling of audio material with an Arduino. Frequency detection is easy, by simply measuring the time between slopes. The only requirement is a digital (square wave) signal from the analog (sinuosidal) signal, using readily available modules.

For generation of the initial audio data, I'll be using python to covert the binary into an audio stream on my computer. For now the arduino reading and interpreting the data is more the problem that I need to work on.

One thing though. For audio input. Audio is a dc offset signal, -+5v right? So I can't just simply read a left or right channel of the audio jack because for a square wave, half of the wave forms will be below -5v. So if I sample the audio, I'd have to multiply the results by 2? Or would this library do that for me?

The circuit in this example seems to only amplify if I'm correct

Audio is AC, with zero average voltage. "Line Out" audio is typically about 1V root mean square amplitude.

To read an audio signal with the ADC, it has to be DC offset so that the signal is entirely positive. See https://forum.arduino.cc/index.php?topic=567581.0
Typical input circuit (input at right).