在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:dimtass/DSP-Cpp-filters开源软件地址:https://github.com/dimtass/DSP-Cpp-filters开源编程语言:C++ 83.7%开源软件介绍:DSP filters in C++This repo contains some DSP biquad filters used in audio. I've extracted those
filters from the I've also implemented a real-time testing on a Cortex-M4 MCU, using the on-chip ADC and DAC. You can find the post here. This is the formula I'm using for the digital biquad filter in the source code:
All the filters are now header files and they are located in the Build & run testsYou can use cmake to build the tests. On Linux, you can just run this: ./build_tests.sh The above command will build the tests and run them.
Usage:The filters can be used in your C++ code in the part where the audio sample is about to be processed. You need to include the filter_common.h and filter_includes.h files and the create an object with filter(s) you want to apply and calculate the coefficients with the calculate_coeffs() function. Then in the sample processing function run the filter() function with the current sample as a parameter. I've used RackAFX to test these filters. Code exampleFor example, to use the so-LPF filter then first create a touch main.cpp Then add this code inside: #include <iostream>
#include <memory>
#include "filter_common.h"
#include "filter_includes.h"
int main() {
std::unique_ptr<SO_LPF> filter (new SO_LPF);
auto coeffs = filter->calculate_coeffs(1.0, 5000, 96000);
auto yn = filter->process(0.303);
std::cout << "Coeffs: " << std::endl;
std::cout << "a0: " << coeffs.a0 << std::endl;
std::cout << "a1: " << coeffs.a1 << std::endl;
std::cout << "a2: " << coeffs.a2 << std::endl;
std::cout << "b1: " << coeffs.b1 << std::endl;
std::cout << "b2: " << coeffs.b2 << std::endl;
std::cout << "yn: " << yn << std::endl;
return 0;
} Now to build the file run: g++ main.cpp -I./lib And then run the executable: ./a.out This is will print the filter coefficients and then will process
a sample with the value
|
2022-08-15
2022-08-17
2022-09-23
2023-10-27
2022-08-18
请发表评论