Skip to content

Extra DSP functions

jaehne function

template <typename T = fbase>
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 code
template <typename T = fbase>
auto jaehne(identity<T> magn, size_t size)
{
    return magn * sin(jaehne_arg<T>(size));
}

https://github.com/kfrlib/kfr/blob//include/kfr/dsp/special.hpp#L65

mixdown function

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

Returns template expression that returns the sum of all the inputs

Source code
template <typename... E>
expression_function<fn::add, E...> mixdown(E&&... e)
{
    return expression_function<fn::add, E...>(fn::add(), std::forward<E>(e)...);
}

https://github.com/kfrlib/kfr/blob//include/kfr/dsp/mixdown.hpp#L39

mixdown_stereo function

template <typename Left, typename Right,
          typename Result = expression_function<
              stereo_matrix, 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 code
template <typename Left, typename Right,
          typename Result = expression_function<stereo_matrix, expression_pack<Left, Right>>>
Result mixdown_stereo(Left&& left, Right&& right, const f64x2x2& matrix)
{
    return Result(stereo_matrix{ matrix }, pack(std::forward<Left>(left), std::forward<Right>(right)));
}

https://github.com/kfrlib/kfr/blob//include/kfr/dsp/mixdown.hpp#L76

swept function

template <typename T = fbase>
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 code
template <typename T = fbase>
auto swept(identity<T> magn, size_t size)
{
    return magn * sin(swept_arg<T>(size));
}

https://github.com/kfrlib/kfr/blob//include/kfr/dsp/special.hpp#L83

unitimpulse function

template <typename T = int> auto unitimpulse()

Returns expression template that generates a unit impulse

Source code
template <typename T = int>
auto unitimpulse()
{
    return lambda<T>(
        [](shape<1> index, auto x)
        {
            vec_shape<T, decltype(x)::value> sh{};
            if (CMT_UNLIKELY(index[0] == 0))
                return onoff(sh);
            else
                return zerovector(sh);
        });
}

https://github.com/kfrlib/kfr/blob//include/kfr/dsp/special.hpp#L41


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/