Direct Digital Synthesis
API Keywords: direct digital synthesis mixer resampler downconvert upconvert
The dds family of objects enables direct digital up-/down-conversion and resampling as efficiently as possible.
An example of interpolation with the dds_cccf object is listed below.
// direct digital synthesis (dds) interpolation example
#include <liquid/liquid.h>
int main() {
// options
float fc = -0.2f; // target frequency (relative)
unsigned int num_stages = 3; // number of halfband stages
float As = 60.0f; // filter stop-band attenuation [dB]
float bw = 0.25f; // signal bandwidth
// create object
dds_cccf q = dds_cccf_create(num_stages,fc,bw,As);
// execute interpolator and up-converter
float complex sample_in;
float complex buf_out[1<<num_stages];
{
// initialize with baseband sample here
// run sample through object
dds_cccf_interp_execute(q, sample_in, buf_out);
}
// destroy object
dds_cccf_destroy(q);
}
An example of decimation with the dds_cccf object is listed below.
// direct digital synthesis (dds) decimation example
#include <liquid/liquid.h>
int main() {
// options
float fc = -0.2f; // signal frequency (relative)
unsigned int num_stages = 3; // number of halfband stages
float As = 60.0f; // filter stop-band attenuation [dB]
float bw = 0.25f; // signal bandwidth
// create object
dds_cccf q = dds_cccf_create(num_stages,fc,bw,As);
// execute down-converter and decimation
float complex buf_in[1<<num_stages];
float complex sample_out;
{
// initialize input buffer here
// pass samples through object
dds_cccf_decim_execute(q, buf_in, &sample_out);
}
// destroy object
dds_cccf_destroy(q);
}