I guess this is the correct place to put this...

FFT code from: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1286718155

This program decoders 45.4 RTTY on analog 0 and outputs it to the serial console.

It has quite a bit of limitations.

RTTY shift has to be between 160-182hz.

It has to be ~45.4 baud.

The decode output has errors in it and its just a proof of concept but still cool.

--edit--

Also the RTTY center frequency has to be 300hz +/- 10

```
#include <avr/pgmspace.h>
#include "fixfft.h"
#include "fix_fft.cpp"
#define THRESH 27 //Bit threshold adjust for best decode
#define CHK(x) (sqrt(real[x] * real[x] + imag[x] * imag[x])) Convert FFT output to more usable form
#define PCK(ar) (ar[0] | ar[1]<<1 | ar[2] << 2 | ar[3] << 3 | ar[4] << 4) //Pack bits into byte
unsigned char lookup[] = { //Baudot lookup table
' ', 'E' , ' ', 'A', ' ', 'S', 'I', 'U',
'\n', 'D', 'R', 'J', 'N', 'F', 'C', 'K',
'T', 'Z', 'L', 'W', 'H', 'Y', 'P', 'Q',
'O', 'B', 'G', 0, 'M', 'X', 'V', 0, ' ',
'3', '\n', '-', ' ', '`', '8', '7',
'\r', ' ', '4', ' ', ',', '!', ':', '(',
'5', '+', ')', '2', '
```

, '6', '0', '1',

'9', '?', '&', 0, '.', '/', ';', 0};

int toffset=0; //Symbols and numbers shift

void setup(){

Serial.begin(115200); //115200 baud output

digitalWrite(A0, 1); //Turn this off depending on input source

}

void loop(){

char bits[6]={0,0,0,0,0};

char real[32],imag[32];

int ticker = 0;

unsigned char pbyte;

for(int a = 0;a < 16;a++){

real[a] = (analogRead(A0)-512) / 4; //Get samples

imag[a] = 0;

delayMicroseconds(780);

}

fix_fft(real, imag, 4, 0); //Preform FFT

if(CHK(6) > THRESH){ //Got a start bit?

for(int b = 0;b < 5;b++){ //Yes - start collecting bits

delay(7); //For timing

for(int a = 0;a < 16;a++){

real[a] = (analogRead(A0)-512) / 4; //Get more samples

imag[a] = 0;

delayMicroseconds(780);

}

fix_fft(real, imag, 4, 0); //Preform FFT

bits[b] = (CHK(6) > THRESH)? 0:1; //Check if we got a 1 or a 0

// bits[b] = (CHK(7) > THRESH)? 1:0;

}

pbyte = PCK(bits); //Pack the byte

if(pbyte == 0x1B){toffset=0x20; pbyte=0;} //Handle character set shift

if(pbyte == 0x1F){toffset=0x00; pbyte=0;}

Serial.print(lookup[pbyte+toffset]); //Print output

ticker++;

//if(ticker>60){ticker=0; Serial.println();}

/* for(int b = 0;b< 5;b++){

}*/

// Serial.println();

delay(12); //For timing

}

}