Symbol streamer (symstream)

The symstream family of objects generate a stream of linearly-modulated symbols interpolated with an appropriate pulse-shaping filter. The resulting data samples are stored in a buffer provided by the user. This object is intended for generating a signal source appropriate for testing synchronization techniques such as carrier recovery , symbol timing recovery , or estimating power spectral density .


Figure [symstream-example]. symstreamcf example


The following listing creates the data in Figure [symstream-example] at the top of this page.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include "liquid.h"

int main()
    // create stream generator
    int          ftype   = LIQUID_FIRFILT_ARKAISER;
    unsigned int k       =     4;
    unsigned int m       =     9;
    float        beta    = 0.30f;
    int          ms      = LIQUID_MODEM_QPSK;
    symstreamcf  gen     = symstreamcf_create_linear(ftype,k,m,beta,ms);

    // create spectral periodogram
    float        alpha   =   0.01f; // PSD estimate bandwidth
    spgramcf periodogram = spgramcf_create_default(nfft);

    unsigned int buf_len = 1024;
    float complex buf[buf_len];

    // generate 50 buffers worth of samples
    unsigned int i;
    for (i=0; i<50; i++) {
        // write samples to buffer
        symstreamcf_write_samples(gen, buf, buf_len);

        // push resulting sample through periodogram
        spgramcf_accumulate_psd(periodogram, buf, alpha, buf_len);

    // compute power spectral density output
    float psd[nfft];
    spgramcf_write_accumulation(periodogram, psd);
    for (i=0; i<nfft; i++)
        printf("  %12.8f %12.4e\n", (float)i/(float)nfft-0.5f, psd[i]);

    // destroy objects
    return 0;