jgaeddert / liquid-usrp

Toy programs for SDR applications
http://liquidsdr.org
57 stars 26 forks source link

Differnt results on Demodulation (ASK, GMSK) #13

Open Mas313 opened 6 months ago

Mas313 commented 6 months ago

I have modified this code to print input symbol and output symbol before modulation and after demodulation, in a loop, but demodulator output does not match with the input. Here is the code. Any idea whats going wrong

int main() {
    // options
    unsigned int k  =    10;    // filter samples/symbol
    unsigned int m  =     7;    // filter delay (symbols)
    float        BT =  0.25f;    // bandwidth-time product

    // create modulator/demodulator objects
    gmskmod mod   = gmskmod_create(k, m, BT);
    gmskdem demod = gmskdem_create(k, m, BT);

    unsigned int  i;
    unsigned int  sym_in;       // input data symbol
    float complex x[k];         // modulated samples
    unsigned int  sym_out;      // demodulated data symbol

    int n=0;
    while(n<20)

    {
    n++;
        // generate random symbol {0,1}
        sym_in = rand() % 2;
    printf("Input symbol=%d\n",sym_in);
        // modulate
        gmskmod_modulate(mod, sym_in, x);
    //for(int a=0; a<k; a++)    
    //  printf("output_complex real=%f img=%f\n",creal(x[a]),cimag(x[a]));

        // demodulate
        gmskdem_demodulate(demod, x, &sym_out);
    printf("output_decoded=%d\n \n",sym_out);
    }

    // destroy modem objects
    gmskmod_destroy(mod);
    gmskdem_destroy(demod);
}