Added setFilter possibility for Siggen, and removed one default debugtrace enabled

This commit is contained in:
Anne de Jong 2022-10-05 21:51:47 +02:00
parent 4b82977709
commit 01674db1e8
3 changed files with 18 additions and 15 deletions

View File

@ -1,4 +1,4 @@
#define DEBUGTRACE_ENABLED /* #define DEBUGTRACE_ENABLED */
#include "lasp_biquadbank.h" #include "lasp_biquadbank.h"
#include "debugtrace.hpp" #include "debugtrace.hpp"
#include "lasp_thread.h" #include "lasp_thread.h"

View File

@ -33,7 +33,7 @@ void init_dsp(py::module &m) {
fft.def_static("load_fft_wisdom", &Fft::load_fft_wisdom); fft.def_static("load_fft_wisdom", &Fft::load_fft_wisdom);
fft.def_static("store_fft_wisdom", &Fft::store_fft_wisdom); fft.def_static("store_fft_wisdom", &Fft::store_fft_wisdom);
/// Window /// Window
py::class_<Window> w(m, "Window"); py::class_<Window> w(m, "Window");
py::enum_<Window::WindowType>(w, "WindowType") py::enum_<Window::WindowType>(w, "WindowType")
@ -45,38 +45,40 @@ void init_dsp(py::module &m) {
w.def_static("toTxt", &Window::toText); w.def_static("toTxt", &Window::toText);
py::class_<Filter, std::shared_ptr<Filter>> filter(m, "Filter");
/// SeriesBiquad /// SeriesBiquad
py::class_<SeriesBiquad> sbq(m, "SeriesBiquad"); py::class_<SeriesBiquad, std::shared_ptr<SeriesBiquad>> sbq(m, "SeriesBiquad",
filter);
sbq.def(py::init<const vd &>()); sbq.def(py::init<const vd &>());
sbq.def("filter", [](SeriesBiquad &s, const vd &input) { sbq.def("filter", [](SeriesBiquad &s, const vd &input) {
vd res = input; vd res = input;
s.filter(res); s.filter(res);
return res; return res;
}); });
/// BiquadBank /// BiquadBank
py::class_<BiquadBank, std::shared_ptr<BiquadBank>> bqb(m, "BiquadBank"); py::class_<BiquadBank, std::shared_ptr<BiquadBank>> bqb(m, "BiquadBank");
bqb.def(py::init<const dmat&,const vd*>()); bqb.def(py::init<const dmat &, const vd *>());
bqb.def("setGains",&BiquadBank::setGains); bqb.def("setGains", &BiquadBank::setGains);
bqb.def("filter",&BiquadBank::filter); bqb.def("filter", &BiquadBank::filter);
/// PowerSpectra /// PowerSpectra
py::class_<PowerSpectra> ps(m, "PowerSpectra"); py::class_<PowerSpectra> ps(m, "PowerSpectra");
ps.def(py::init<const us, const Window::WindowType>()); ps.def(py::init<const us, const Window::WindowType>());
ps.def("compute", &PowerSpectra::compute); ps.def("compute", &PowerSpectra::compute);
/// AvPowerSpectra /// AvPowerSpectra
py::class_<AvPowerSpectra> aps(m, "AvPowerSpectra"); py::class_<AvPowerSpectra> aps(m, "AvPowerSpectra");
aps.def(py::init<const us, const Window::WindowType, const d, const int>(), aps.def(py::init<const us, const Window::WindowType, const d, const int>(),
py::arg("nfft") = 2048, py::arg("windowType") =Window::WindowType::Hann, py::arg("overlap_percentage") = 50.0, py::arg("nfft") = 2048,
py::arg("time_constant") = -1); py::arg("windowType") = Window::WindowType::Hann,
py::arg("overlap_percentage") = 50.0, py::arg("time_constant") = -1);
aps.def("compute", [](AvPowerSpectra &aps, const dmat &timedata) { aps.def("compute", [](AvPowerSpectra &aps, const dmat &timedata) {
std::optional<arma::cx_cube> res = aps.compute(timedata); std::optional<arma::cx_cube> res = aps.compute(timedata);
return res.value_or(arma::cx_cube(0,0,0)); return res.value_or(arma::cx_cube(0, 0, 0));
} });
);
py::class_<SLM> slm(m, "cppSLM"); py::class_<SLM> slm(m, "cppSLM");

View File

@ -34,6 +34,7 @@ void init_siggen(py::module &m) {
siggen.def("setLevel", &Siggen::setLevel); siggen.def("setLevel", &Siggen::setLevel);
siggen.def("setLevel", &Siggen::setLevel, py::arg("newLevel"), py::arg("dB") = true); siggen.def("setLevel", &Siggen::setLevel, py::arg("newLevel"), py::arg("dB") = true);
siggen.def("genSignal", &Siggen::genSignal); siggen.def("genSignal", &Siggen::genSignal);
siggen.def("setFilter", &Siggen::setFilter);
py::class_<Noise,std::shared_ptr<Noise>> noise(m, "Noise", siggen); py::class_<Noise,std::shared_ptr<Noise>> noise(m, "Noise", siggen);
noise.def(py::init<>()); noise.def(py::init<>());