Warning
This is the english API documentation. For french language API, please refer to the following page: https://tsdconseil.github.io/libtsd/fr

Libtsd provides functions in C++ for digital signal processing, with the following design goals:

  • Ease of use: using vector-type classes (Vecf, Veci, ...) for easy vector computing (Matlab / Numpy like),
  • A clear distinction between API (header files) and implementation (source files). Hence, templates are used only parcimonously.
  • A multilanguage API (at least, english using the interface file dsp/dsp.hpp, french using tsd/tsd.hpp)
  • Easy to read code: using for instance UTF-8 non standard symbols (like \(\pi\)), which is usually unrecommanded in traditionnal C++.

The library is hosted on the Github platforme (https://github.com/tsdconseil/libtsd).

Simple example (english API)

#include "dsp/dsp-all.hpp"

int main()
{
  // Example 1 : simple plot
  {
    Figure f;
    let x = linspace(0, 8 * π, 100);
    f.plot(x, cos(x));
    f.save("./cosinus.png");
  }

  // Example 2 : filter design
  {
    // Low-pass, 31 taps, cutting at fs/4
    let h = design_fir_win(31, "lp", 0.25);

    Figure f;
    f.plot(h, "|o", "impulse response");
    f.save("./filtre.png");

    let n = 500;
    let x = sigcos(0.01, n) + 0.1 * randn(n),
        y = filter(h, x);

    f.clear();
    f.plot(x, "b-", "Noisy signal");
    f.plot(y, "r-", "Filtered signal");
    f.save("./filtering.png");
  }
  return 0;
}

Note the usage of the let keyword which is just a define for auto.