KFR 7 has been released
KFR 7 is out with a new audio module for reading and writing WAV, AIFF, FLAC, MP3 and ALAC files, universal binaries for macOS, RISC-V support, a modernized C++20 codebase and a number of breaking changes that are worth checking before you upgrade.
Audio module
KFR 7 introduces the audio module. The audio_data class gives one interface for both interleaved and planar audio. It can either own its memory or wrap user-supplied pointers without copying (zero-copy).
Files are handled by audio_encoder and audio_decoder, which support:
- Wave, AIFF, FLAC and MP3 (via
minimp3) - Apple ALAC and CAF containers
- RF64/BW64 containers. Wave files switch to RF64 automatically once they exceed 4 GB
- Format detection from the file header or the file extension
- Media Foundation decoding on Windows
For most cases encode_audio_file and decode_audio_file are all you need. The older audio_reader and audio_writer are deprecated.
Platforms
- macOS universal binaries available
- RISC-V support, including prebuilt binaries and a toolchain for
riscv64-linux-gnu
Math and expressions
ellipticdesigns elliptic filters from ripple parameters, following SciPy semanticsfiltfiltperforms zero-phase forward-backward IIR filteringscoped_flush_denormalsenables flush-to-zero on x86 and ARM for the duration of a scopestrided_channellets expressions read and write strided data- The
reverseexpression is now writable
Build system
CMake 3.16 is now the minimum version. The configuration was refactored into separate targets with clear public and private dependencies, and C++20 is handled through the cxx_std_20 feature. KFR_USE_BOOST_MATH is on by default for elliptic filters, and KFR_USE_BOOST lets you use an existing Boost installation instead.
Upgrading from KFR 6
KFR 7 contains breaking changes. Most of them are renames, so a search and replace covers the bulk of the work:
CMT_andTESTO_macros are nowKFR_- The
cometanamespace is merged intokfr.cometa.hppbecomesmeta.hpp, andkfr/cometa/*becomeskfr/meta/* kfr/testo/*.hppbecomeskfr/test/*.hppintrinsicsnamespace is renamed tointrSpeakerbecomesspeaker_typeandSpeakerArrangementbecomesspeaker_arrangementconvert_endianessbecomesconvert_endianness- Several classes and functions no longer take a template parameter and default to
double, for examplezpk,besselandbutterworth KFR_ACCEPT_EXPRESSIONSis removed. Use theexpression_argumentandexpression_argumentsconcepts insteadidentityis removed. Usestd::type_identity_t- 8-bit sample support is removed
CMT_NOEXCEPTis removed. Usenoexceptfrom_lambdais required when constructing avecfrom a lambda generator
See the changelog for the complete list.
KFR 7.0.1
The first patch release adds variance and stddev functions. The audio, IO and DSP modules can now be disabled at build time with KFR_ENABLE_AUDIO, KFR_ENABLE_IO and KFR_ENABLE_DSP, all on by default. It also includes C++23 compatibility fixes and a fix for extend(vec) with compound vectors. The documentation moved to mkdocs with cxxdox 2.
See the documentation for the updated guides and examples.