Omar Alshaker
Omar Alshaker

Reputation: 879

AFSK Demodulation in Android

I am modulating my own AFSK signal in Android using this function

public static double[] MyFSK(char bit) //bit 1 or 0
{
    double[] a = new double[SamplesPerBit]; // SamplesPerBit =  44100 / 1200 (baudrate)
    for (int i = 0; i < a.length ; i++)
    {           
        if(bit == '1')
            a[i] = Math.sin(2 * Math.PI * i * C.FreqHigh / SamplesRate);
        else
            a[i] = Math.sin(2 * Math.PI * i * C.FreqLow / SamplesRate);
    }
    return a;
}

Now my problem is the demodulation part, I successfully used FFT algorithm to find the frequency, but FFT downside is its need for a long data stream (1024-2048 samples) in order to find the frequency, which causes a very low baud rate.

So is there any more suitable way to find the frequency with lower sample count ? for me to handle 1200 baud ?

Upvotes: 2

Views: 2031

Answers (1)

dodgy_coder
dodgy_coder

Reputation: 13033

Goertzel's Algorithm requires far fewer samples and is more performant than an FFT for your use case. It can be used to distinguish between two or more known frequencies. Here's a PDF about it (includes code samples)...

http://www.cs.washington.edu/education/courses/cse466/12au/calendar/Goertzel-EETimes.pdf

Upvotes: 1

Related Questions