Getting started with KFR

24 September 2026

KFR is a C++ framework for digital signal processing, audio applications, and general numerical work. It provides the low-level building blocks needed for fast array operations, then builds higher-level tools—such as Fourier transforms, filters, resamplers, and audio file codecs—on top of them.

Simple declarative reflection in C++20

21 December 2022

Almost every real-world application requires a lot of similar operations such as saving its internal state, making API requests, logging events, etc. This leads to writing hundreds of lines of code to convert classes to JSON, serializing to various formats, and so on.

But if we knew the internal structure of classes, then we could write generic functions for all use cases and get the desired features quickly and easily.

Fast Fourier Transform in C++ using KFR

12 September 2016

In this article I’ll show you how to use the Fast Fourier Transform (FFT) in digital signal processing, and how to apply forward and inverse FFTs to complex and real data using the KFR framework.

How C++14 and C++17 help to write faster (and better) code. Real world examples

29 August 2016
Writing high performance code is always a difficult task. Pure algorithms are not always a good fit for real-world architectures. Once having begun to speed up all these pure algorithms, we quickly find that some implementation is pretty fast on one architecture, but terribly slow on another while the second implementation outperforms the first one in some contexts losing speed in all the rest. Numerous big and small optimizations for each of the supported architectures can quickly bloat our code and waste our time.

Compile-time arguments and function wrappers

24 August 2016

Passing values in C++ as template arguments has limitations. For example, when a function template is wrapped in a functor class, there is no way to pass a value as a template argument.

Example: FIR filter in C++

14 August 2016
The following example shows how to apply an FIR filter to audio data using the KFR framework. #include <kfr/all.hpp> using namespace kfr; int main(int argc, char** argv) { // static array (like std::array) to hold the taps univector<double, 15> taps; // create the window function // the tap count is passed to window_hann // window_hann does not calculate the window immediately // it creates an expression that represents a Hann window expression_handle<double> hann = to_handle(window_hann<double>(taps.

Basic expression tutorial

2 August 2016
The expression is the central entity of the KFR framework. Input expressions can be read from and output expressions can be written to. A class can be an input and output expression at the same time. univector is an example of such a class. The data type of an input expression can be determined by calling value_type_of. However, not all expressions have their types specified. In such cases, value_type_of returns the special type generic.

Biquad filters in C++ using KFR

25 July 2016

Digital biquad filters and biquad design functions have been part of the KFR framework since its first version.

The biquad algorithm uses Transposed Direct Form II, which reduces quantization errors in floating-point calculations.