Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::dsp::CurveOptions Class Referencefinal

Curve options. More...

#include <src/dsp/curve.h>

Public Types

enum class  Algorithm {
  Exponent , SuperEllipse , Vital , Pulse ,
  Logarithmic
}
 The algorithm to use for curves. More...

Public Member Functions

 CurveOptions (double curviness, Algorithm algo)
double get_normalized_y (double x, bool start_higher) const
 Returns the Y value on a curve.

Data Fields

double curviness_ { 0.0 }
 Curviness between -1 and 1, where < 0 tils downwards, > 0 tilts upwards and 0 is a straight line.
Algorithm algo_ {}
 Curve algorithm to use.

Static Public Attributes

static constexpr double SUPERELLIPSE_CURVINESS_BOUND = 0.82
 Bounds for each algorithm.
static constexpr double EXPONENT_CURVINESS_BOUND = 0.95
static constexpr double VITAL_CURVINESS_BOUND = 1.00

Friends

bool operator== (const CurveOptions &a, const CurveOptions &b)

Detailed Description

Curve options.

Can find more at tracktion_AudioFadeCurve.h.

Definition at line 21 of file curve.h.

Member Enumeration Documentation

◆ Algorithm

The algorithm to use for curves.

See https://www.desmos.com/calculator/typjsyykvb

Enumerator
Exponent 

y = x^n 0 < n <= 1, where the whole thing is tilting up and 0 is full tilt and 1 is straight line (when starting at lower point).

SuperEllipse 

y = 1 - (1 - x^n)^(1/n) 0 < n <= 1, where the whole thing is tilting up and 0 is full tilt and 1 is straight line (when starting at lower point).

See https://stackoverflow.com/questions/17623152/how-map-tween-a-number-based-on-a-dynamic-curve

Vital 

(e^(nx) - 1) / (e^n - 1) -10 <= n <= 10 where positive tilts down and negative tilts up (when starting at lower point).

See https://www.desmos.com/calculator/2dnuiptiqc.

Taken from Vital synth.

Pulse 

Pulse (square).

Logarithmic 

a = log (n) b = 1 / (log (1 + (1 / n)))

smaller numbers tilt up

y1 = (log (x + n) - a) * b

smaller numbers tilt down

y2 = (a - log (x + n)) * b where 0 < n <= 10

See https://www.desmos.com/calculator/tdedahsdz8.

Taken from Ardour.

Definition at line 31 of file curve.h.

Member Function Documentation

◆ get_normalized_y()

double zrythm::dsp::CurveOptions::get_normalized_y ( double x,
bool start_higher ) const

Returns the Y value on a curve.

Parameters
xX-coordinate, normalized.
start_higherStart at higher point.

Field Documentation

◆ algo_

Algorithm zrythm::dsp::CurveOptions::algo_ {}

Curve algorithm to use.

Definition at line 116 of file curve.h.

◆ curviness_

double zrythm::dsp::CurveOptions::curviness_ { 0.0 }

Curviness between -1 and 1, where < 0 tils downwards, > 0 tilts upwards and 0 is a straight line.

Definition at line 113 of file curve.h.

◆ EXPONENT_CURVINESS_BOUND

double zrythm::dsp::CurveOptions::EXPONENT_CURVINESS_BOUND = 0.95
staticconstexpr

Definition at line 90 of file curve.h.

◆ SUPERELLIPSE_CURVINESS_BOUND

double zrythm::dsp::CurveOptions::SUPERELLIPSE_CURVINESS_BOUND = 0.82
staticconstexpr

Bounds for each algorithm.

Definition at line 89 of file curve.h.

◆ VITAL_CURVINESS_BOUND

double zrythm::dsp::CurveOptions::VITAL_CURVINESS_BOUND = 1.00
staticconstexpr

Definition at line 91 of file curve.h.


The documentation for this class was generated from the following file: