Analog Frequency Modulator/Demodulator (freqmodem)

The freqmodem object implements an analog frequency modulation (FM) modulator and demodulator. Given an input message signal \(-1 \le s(t) \le 1\) , the transmitted signal is

$$ s(t) = \exp\left\{ j 2 \pi k f_c \int_{0}^{t}{ s(\tau)d\tau } \right\} $$

where \(f_c\) is the carrier frequency, and \(k\) is the modulation index. The modulation index governs the relative bandwidth of the signal. Two options for demodulation are possible: observing the instantaneous frequency on the output of a phase-locked loop, or computing the instantaneous frequency using the delay-conjugate method.

freqmodem_example.png

Figure [fig-modem-freqmodem]. freqmodem demonstration modulating an audio signal with a modulation index of \(k=0.1\) and a relative carrier frequency \(f_c/F_s = 0.1\) .

An example of the freqmodem can be found in [fig-modem-freqmodem]

An example of the freqmodem interface is listed below.


#include <liquid/liquid.h>

int main() {
    float kf = 0.1f;        // modulation factor

    // create modulator/demodulator objects
    freqmod fmod = freqmod_create(kf);
    freqdem fdem = freqdem_create(kf);

    float m;                // input message
    float complex s;        // modulated signal
    float y;                // output/demodulated message

    // repeat as necessary
    {
        // modulate signal
        freqmod_modulate(fmod, m, &s);

        // demodulate signal
        freqdem_demodulate(fdem, s, &y);
    }

    // clean up objects
    freqmod_destroy(fmod);
    freqdem_destroy(fdem);
}

A more detailed example can be found in examples/freqmodem_example.c located under the main liquid project source directory. Listed below is the full interface to the freqmodem object for analog frequency modulation/demodulation.

  • freqmodem_create(k,fc,type) creates and returns an freqmodem object with a modulation index \(k\) , a carrier frequency \(-0.5 < f_c < 0.5\) , and a demodulation type defined by type . The demodulation type can either be LIQUID_FREQMODEM_PLL which uses a phased-locked loop or LIQUID_FREQMODEM_DELAYCONJ which uses the delay conjugate method.
  • freqmodem_destroy(q) destroys an freqmodem object, freeing all internally-allocated memory.
  • freqmodem_reset(q) resets the state of the freqmodem object.
  • freqmodem_print(q) prints the internal state of the freqmodem object.
  • freqmodem_modulate(q,x,*y) modulates the input sample \(x\) storing the output to \(y\) .
  • freqmodem_demodulate(q,y,*x) demodulates the input sample \(y\) storing the output to \(x\) .