2022-08-16 19:22:35 +00:00
|
|
|
#include "carma"
|
|
|
|
#include "lasp_biquadbank.h"
|
2022-07-20 12:58:48 +00:00
|
|
|
#include "lasp_siggen.h"
|
|
|
|
#include "lasp_siggen_impl.h"
|
2022-08-16 19:22:35 +00:00
|
|
|
#include "lasp_slm.h"
|
|
|
|
#include "lasp_window.h"
|
2022-06-29 10:25:32 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <pybind11/pybind11.h>
|
|
|
|
|
|
|
|
using std::cerr;
|
|
|
|
namespace py = pybind11;
|
|
|
|
|
2022-08-16 19:22:35 +00:00
|
|
|
void init_dsp(py::module &m) {
|
2022-06-29 10:25:32 +00:00
|
|
|
|
|
|
|
py::class_<Window> w(m, "Window");
|
|
|
|
|
|
|
|
py::enum_<Window::WindowType>(w, "WindowType")
|
|
|
|
.value("Hann", Window::WindowType::Hann)
|
|
|
|
.value("Hamming", Window::WindowType::Hamming)
|
|
|
|
.value("Bartlett", Window::WindowType::Bartlett)
|
|
|
|
.value("Blackman", Window::WindowType::Bartlett)
|
|
|
|
.value("Rectangular", Window::WindowType::Rectangular)
|
|
|
|
.export_values();
|
|
|
|
|
2022-07-20 12:58:48 +00:00
|
|
|
py::class_<Siggen, std::shared_ptr<Siggen>> siggen(m, "Siggen");
|
2022-08-16 19:22:35 +00:00
|
|
|
siggen.def("setLevel", &Siggen::setLevel,
|
|
|
|
"Set the level of the signal generator");
|
2022-07-20 12:58:48 +00:00
|
|
|
|
|
|
|
py::class_<Sine, std::shared_ptr<Sine>> sw(m, "Sine", siggen);
|
|
|
|
sw.def(py::init<const d>());
|
|
|
|
|
2022-08-16 19:22:35 +00:00
|
|
|
py::class_<SeriesBiquad> sbq(m, "SeriesBiquad");
|
|
|
|
sbq.def(py::init<const vd &>());
|
|
|
|
sbq.def("filter", [](SeriesBiquad &s, const vd &input) {
|
|
|
|
vd res = input;
|
|
|
|
s.filter(res);
|
|
|
|
return res;
|
|
|
|
});
|
|
|
|
|
|
|
|
py::class_<SLM> slm(m, "SLM");
|
|
|
|
slm.def_static(
|
|
|
|
"fromBiquads",
|
|
|
|
py::overload_cast<const d, const d, const us, const d, const dmat &>(
|
|
|
|
&SLM::fromBiquads));
|
|
|
|
slm.def_static(
|
|
|
|
"fromBiquads",
|
|
|
|
py::overload_cast<const d, const d, const us, const d, const vd &,
|
|
|
|
const dmat &>(&SLM::fromBiquads));
|
|
|
|
slm.def("run", &SLM::run);
|
|
|
|
slm.def_readonly("Pm", &SLM::Pm);
|
|
|
|
slm.def_readonly("Pmax", &SLM::Pmax);
|
|
|
|
slm.def_readonly("Ppeak", &SLM::Ppeak);
|
2022-06-29 10:25:32 +00:00
|
|
|
}
|