views:

35

answers:

1

My aim is to have a set of frequencies like 2 frequencies that represent the bits (0 and 1). I want to send those frequencies to the audio out through sound card. At the other end I connect the cord to mike in of the sound card. I like to sense that signal (generated series of 2 fixed frequencies) from other computer and re-form the data.

How can I do this?

A: 

Well, first you have to generate two sine waves of a particular frequency. Basically, you get to know the current samplerate of your soundcard and just generate a series of floats that represent a sine wave of a certain frequency at that samplerate. I.e. for a soundcard with 48000 Hz and a frequency of 1000 Hz, each full sine wave (one hill, one trough) should consist of 48 samples.

Note that the maximum frequency you can generate is half the samplerate.

Next, you generate the second sine wave with the second frequency. Make sure that the two frequencies have a certain distance from one another. A frequency factor of one semitone should suffice for that factor >= (1+1/12).

Also make sure that the sum of both sinuses does not overshoot the max amplitude. The easiest way to do this is by limiting both sinuses to amplitudes <= 0.5. Overshooting will clip the signal, which will create new frequency peaks.

On the receiving end, do a FFT of short time slices (around 256-1024 samples) of the incoming signal. For better frequency resolution, take overlapping slices and gradually fade out the ends, then time-average the spectral slices. In the resulting spectrum you should clearly see peaks at the two sent frequencies.

If you don't know much about audio, this is probably a pretty tough task.

BastiBechtold