meilon
meilon

Reputation: 703

Read binary code transmitted via radio in WAV recording

I have some WAV files that were recorded from a radio transmission. It contains information about who has send the transmission and I want to be able to read these information. The information is transmitted by sending x hz for a 0 and y hz for a 1 ( More about AFSK on Wikipedia)

My problem is: How do I get the binary data out of the wave file? If there are controls for C# would be nice, but some source code for better understanding would be better.

Any ideas?

Upvotes: 1

Views: 1811

Answers (1)

Robert Harvey
Robert Harvey

Reputation: 180868

The WAV file specification is your blueprint for reading the sound data from the WAV file. Sample code for reading and manipulating WAV files can be found in this CodeProject article.

To achieve the tone mapping, you can read this article, which describes how to write software to transfer data between two sound cards. For example, to find out how much of a given frequency is present in a particular segment of the WAV file, you would use a Fourier Transform.

Something like this:

double fourier1(double x_in[], double n, int length) {

    double x_complex[2] = { 0, 0 };

    int i;

    for(i = 0; i < length; i++) 
    {
        x_complex[0] += x_in[i] * cos(M_PI * 2 * i * n / (double) length);
        x_complex[1] += x_in[i] * sin(M_PI * 2 * i * n / (double) length);
    }

    return sqrt(x_complex[0]*x_complex[0] + x_complex[1]*x_complex[1]) / (double) length; 
} 

Where x_in is a se­ries of num­bers be­tween -1 and 1, and n is the mod­i­fied fre­quency:

(length * fre­quency / rate)

Upvotes: 1

Related Questions