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 "debugtrace.hpp"
#include "lasp_thread.h"

View File

@ -45,9 +45,11 @@ void init_dsp(py::module &m) {
w.def_static("toTxt", &Window::toText);
py::class_<Filter, std::shared_ptr<Filter>> filter(m, "Filter");
/// 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("filter", [](SeriesBiquad &s, const vd &input) {
vd res = input;
@ -57,9 +59,9 @@ void init_dsp(py::module &m) {
/// BiquadBank
py::class_<BiquadBank, std::shared_ptr<BiquadBank>> bqb(m, "BiquadBank");
bqb.def(py::init<const dmat&,const vd*>());
bqb.def("setGains",&BiquadBank::setGains);
bqb.def("filter",&BiquadBank::filter);
bqb.def(py::init<const dmat &, const vd *>());
bqb.def("setGains", &BiquadBank::setGains);
bqb.def("filter", &BiquadBank::filter);
/// PowerSpectra
py::class_<PowerSpectra> ps(m, "PowerSpectra");
@ -69,14 +71,14 @@ void init_dsp(py::module &m) {
/// AvPowerSpectra
py::class_<AvPowerSpectra> aps(m, "AvPowerSpectra");
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("time_constant") = -1);
py::arg("nfft") = 2048,
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) {
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");

View File

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