Linear Ramp Generator

Overview

Linear Ramp

The linear upward ramp generator, lin_upward_ramp_gen generates a linearly increasing amplitude from 0.0 to 1.0 specified by the duration (width) and samples per second (sps parameters. This is essentially a basic straight ramp from 0.0 to 1.0.

lin_downward_ramp_gen is the inverse of the linear upward ramp generator. This is essentially a basic straight ramp from 1.0 to 0.0.

hold_line_gen is an infinitely wide straight horizontal line at 1.0.

The Q DSP library utilizes the linear ramp generators for generating complex envelopes.

Include

#include <q/synth/linear_gen.hpp>

Declaration

struct lin_upward_ramp_gen
{
            lin_upward_ramp_gen(duration width, float sps);

   float    operator()();
   void     config(duration width, float sps);
   void     reset();
};

struct lin_downward_ramp_gen : lin_upward_ramp_gen
{
            lin_downward_ramp_gen(duration width, float sps);

   float    operator()();
};

struct hold_line_gen
{
            hold_line_gen(duration width, float sps);

   float    operator()();
   void     config(duration width, float sps);
   void     reset();
};

Expressions

lin_upward_ramp_gen, lin_downward_ramp_gen and hold_line_gen are a models of Ramp and implements all valid expressions of Ramp.