OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
filters.hpp File Reference

Detailed Description

Allocation-free scalar smoothing filters, meant to be used per-component on the audio or the execution thread.

Everything here is an aggregate: trivially copyable, cheap to reset by assignment, and cheap to keep one per component or per tracked object. No virtuals, and no transcendentals in the hot path - the low-pass coefficient is the usual first-order approximation, a single divide.

The time-varying filters take an explicit dt (in seconds) rather than a fixed sample rate: score ticks value processes at a variable block rate, so a rate captured once at prepare() time is wrong as soon as the buffer size changes.

Go to the source code of this file.

Classes

struct  ossia::one_pole_filter< T >
 First-order low-pass. The building block for everything below. More...
 
struct  ossia::one_euro_filter< T >
 One-euro filter: a low-pass whose cutoff rises with the speed of the signal. More...
 
struct  ossia::moving_average_filter< T, N >
 Simple moving average over the last N samples. More...
 
struct  ossia::median_filter< T, N >
 Running median over the last N samples. More...
 
struct  ossia::multi_filter< Filter, N >
 Applies one independent Filter per component of a vector-valued signal. More...
 

Namespaces

namespace  ossia
 

Functions

template<typename T >
OSSIA_INLINE T ossia::lowpass_alpha (T cutoff, T dt) noexcept
 Smoothing factor of a first-order low-pass, for a sample spaced dt seconds from the previous one.
 
template<typename T >
OSSIA_INLINE T ossia::lag_alpha (T tau, T dt) noexcept
 Smoothing factor of a first-order lag with a given time constant.
 
template<typename T >
OSSIA_INLINE T ossia::unwrap_angle (T a, T reference) noexcept
 Move a onto the branch closest to reference.