Since the early days we've built up a growing collection DSP utilities in the form of the OwlProgram library classes, or OpenWareLibrary as we should perhaps call it.
The API is here:
It includes basic signal processing, FFTs, et c. In the beginning, the library was focused on cross-platform C++ wrappers for optimised DSP functions found in the CMSIS DSP library. But in time it has grown to provide many oscillators, filters, envelopes, windows and other useful things.
But in spite of having many great components, it was always lacking a consistent structure. I've tried to address this with a new PR: Refactor DSP library classes.
- Oscillators and Noise generators inherit SignalGenerator abstract base class
- Filters inherit SignalProcessor abstract base class
- Envelopes inherit both SignalGenerator and SignalProcessor (can be used as either)
- Objects are (most conveniently) allocated with a static
create(...) function, and deallocated with
destroy() should be called from the Patch constructor and destructor, respectively
Most API changes will elicit a
deprecated warning, pointing you to the new, preferred method, without breaking any code or changing previous behaviour. But there are some breaking changes:
- BiquadFilter normalised frequency now follows f/SR norm, instead of 1/Nyquist
- Oscillator constructors no longer take SR argument, SR must be passed in with
Oscillator::setFrequency(float) assumes argument is a normalised frequency
All classes with methods that take a frequency now implement two versions, e.g.:
void setFrequency(float freq, float sr); // set frequency given sample rate 'sr'
void setFrequency(float nfreq); // set normalised frequency, i.e. freq/SR
This means that the sampling rate doesn't have to be held in every object instance, instead the correct rate can be passed in the setter function by the caller. It also provides the more efficient alternative of setting a normalised frequency
nfreq, which is simply the frequency divided by the sample rate. This is typically a value between 0 and 0.5, representing the range 0 Hz to Nyquist frequency.
The docs for the refactored code is here on the dev server.
(I've not figured out how to get doxygen to generate a deprecation list for methods and classes marked with C++14
[[deprecated]] tags, anyone knows?)
The next task will be to refactor the mess that is
basicmaths.h. Probably the fast math functions will be separated out into an
owl namespace, and most of the macros removed. Introducing a namespace will either mean all patches must add a
using namespace owl; directive, or we do it in Patch.h by default . Discussion welcome.
Other changes I'd like to add include multi-channel (e.g. stereo) SignalProcessor alternatives, maybe also for SignalGenerator.
Any other requests?