KFR: C++ DSP framework, FFT, FIR, biquad, sample rate conversion

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

KFR C++ DSP framework has been open-sourced and available on github.

KFR is cross-platform and consists of highly optimized SIMD-enabled algorithms.

For example, FFT is nearly twice as fast as FFTW and faster than Intel IPP in many sizes. (fft benchmark code is available on github)

Resampling algorithm uses high-order FIR filtering and produces very accurate results (audio quality tests are included)

Other features included in the version 0.9.0 are: biquad filtering, oscillators, Goertzel algorithm and many more.

DSP algorithms are built on the top of KFR-base - powerful SIMD math library (SSE2, SSE4, AVX, AVX2) with STL support and template expressions.

KFR is released under the GPL license (Commercial license is also available).

Comments and suggestions are welcome.

https://github.com/kfrlib/kfr
https://www.kfrlib.com/
Last edited by Chang-soo Kim on Mon Aug 15, 2016 10:18 am, edited 2 times in total.

Post

thanks for the info!
it really seems very good in FFT judging from the benchmarks!
a.

Post

New features added in the version 0.9.1:

1. Visual Studio 2015 support (using clang-cl driver)
2. Convolution (using FFT)
3. Fractional delay (linear interpolation)
4. Biquad benchmark (see results)

Post

Just a question; are the FFT bench marks for a single or multi threaded algo?

Post

All libraries was tested in single-threaded mode with disabled TurboBoost to archive stable results.
Benchmark code is hosted on GitHub https://github.com/kfrlib/fft-benchmark

Post

KFR framework has reached a stable release.

Added in version 1.0:

1. ARM NEON support (armv7, armv7s, aarch64)
Since this release, all algorithms are also available for the following arhitectures: NEON on armv7 and NEON on aarch64 (arm64). Scalar cpu-independent versions are also available
2. Stereo conversion (LR -> MS, MS -> LR)
3. DC offset removal
4. Fast Upsample/Downsample by powers of two
5. Lots of improvements and fixes (nearly 200 commits since the previous version)
6. Many new tests have been added, not only to check new functionality but also to more stringently check existing functionality

More about new version (including examples)
https://www.kfrlib.com/whatsnew

Post

It seems very interesting and I really like the programming patterns used throughout. As it is a large bunch I'll have to allocate some time at some point to properly check it out, but I'm keeping a keen eye on it.

How much time was spent developing the framework? Is it correct to assume you're the only programmer?

Post

Hi, Mayae

Yes, KFR uses some principles of functional programming (lazy evaluation, generators, function composition, etc).
However, this does not prevent it from using in OOP-style.

As of now several developers contribute to the project, including me.
But original concept, structure and patterns is by one developer (not me).

Initially, the framework was the part of a proprietary project, in a slightly different form.

Post

I had a play with this. I was intrigued by the IIR performance benchmarks. I didn't like that you are adding an artificial delay of N - 1 samples for a cascade of N biquads in order to achieve the performance - this isn't a fair comparison with other zero latency libraries. I think you should document that there is a delay so people can better decide if it's worth bothering with for IIRs.

Post

When IIR filter is applied to a buffer, delay can be easily compensated with no performance loss.
Benchmark was executed in both variants (with delay and with zero latency).
For buffers larger than 200 samples the performance is almost equal.

Biquad performance comparison (zero latency)
Biquad performance comparison (N-1 delay)

To compensate delay:
Process first N-1 samples skipping the output.
Process the remaining samples writing the output to the output buffer.
Save object state.
Feed input with N-1 zero samples writing output samples to the output buffer.
Restore saved object state to be able to repeat the cycle.

I agree, example of such delay compensation with detailed comments should be published too.

Post

Fair enough, I guess some more documentation would be great. I like your use of C++ expression templates by the way, the coding is very good. Also, a version that compiled with Microsoft's C++ compiler would be useful.

Post

Hi Chang,

I'm about to try your framework for implementing some Biquad filters and I wondered, are the Oscillators you provide band-limited?

Thanks

Post

Hi,

In the current implementation there are only non band limited oscillators in KFR.

Generally speaking, there are two common ways to deal with aliasing:
Generate signal at a higher sample rate and downsample it using a low pass FIR filter to decrease the aliasing.
Or use wavetable synthesis with precalculated waveforms and interpolate between them.

In one of the upcoming publications in the KFR blog, we'll show detailed example how to get sound that is free of aliasing.

Post

Browsed the documentation for awhile. The KFR appears an impressive programming effort. Good job!

Post

Chang-soo Kim wrote:
In one of the upcoming publications in the KFR blog, we'll show detailed example how to get sound that is free of aliasing.
Thanks very much. Sounds good.

Post Reply

Return to “DSP and Plugin Development”