KFR

Other DSP functions

delay

template<size_t samples = 1, typename E1>
internal::expression_delay<samples, E1> delay(E1 &&e1, csize_t<samples> = csize_t<samples>())

Returns template expression that applies delay to the input (uses ring buffer internally)

Parameters:
  • e1 – an input expression
  • samples – delay in samples (must be a compile time value)
univector<double, 10> v = counter();
auto d = delay(v, csize<4>);

Source:

template <size_t samples = 1, typename E1>
CMT_INLINE internal::expression_delay<samples, E1> delay(E1&& e1, csize_t<samples> = csize_t<samples>())

mixdown

template<typename ...E>
internal::expression_function<fn::add, E...> mixdown(E&&... e)

Returns template expression that returns the sum of all the inputs

Source:

template <typename... E>
internal::expression_function<fn::add, E...> mixdown(E&&... e)

mixdown_stereo

template<typename Left, typename Right, typename Result = internal::expression_function<internal::stereo_matrix, internal::expression_pack<Left, Right>>>
Result mixdown_stereo(Left &&left, Right &&right, const f64x2x2 &matrix)

Returns template expression that returns the vector of length 2 containing mix of the left and right

channels

Source:

template <typename Left, typename Right, typename Result = internal::expression_function<
                                             internal::stereo_matrix, internal::expression_pack<Left, Right>>>
Result mixdown_stereo(Left&& left, Right&& right, const f64x2x2& matrix)

unitimpulse

template<typename T = int>
static auto unitimpulse()

Returns expression template that generates a unit impulse

Source:

template <typename T = int>
static auto unitimpulse()
{
    return lambda<T>([](cinput_t, size_t index, auto x) {
        if (index == 0)
            return onoff(x);
        else
            return zerovector(x);
    });
}

jaehne

template<typename T = fbase>
static auto jaehne(identity<T> magn, size_t size)

Returns expression template that generates a jaehne vector

Generates the sine with linearly increasing frequency from 0hz to nyquist frequency.

Source:

template <typename T = fbase>
static auto jaehne(identity<T> magn, size_t size)
{
    return magn * sin(jaehne_arg<T>(size));
}

swept

template<typename T = fbase>
static auto swept(identity<T> magn, size_t size)

Returns expression template that generates a jaehne vector

Generates the sine with logarithmically increasing frequency from 0hz to nyquist frequency.

Source:

template <typename T = fbase>
static auto swept(identity<T> magn, size_t size)
{
    return magn * sin(swept_arg<T>(size));
}