Skip to content

daisysp::Adsr

More...

#include <adsr.h>

Public Functions

Name
Adsr()
~Adsr()
void Init(float sample_rate, int blockSize =1)
void Retrigger(bool hard)
float Process(bool gate)
void SetTime(int seg, float time)
void SetAttackTime(float timeInS, float shape =0.0f)
void SetDecayTime(float timeInS)
void SetReleaseTime(float timeInS)
void SetSustainLevel(float sus_level)
uint8_t GetCurrentSegment()
bool IsRunning() const

Detailed Description

class daisysp::Adsr;

adsr envelope module

Original author(s) : Paul Batchelor

Ported from Soundpipe by Ben Sergentanis, May 2020

Remake by Steffan DIedrichsen, May 2021

Public Functions Documentation

function Adsr

inline Adsr()

function ~Adsr

inline ~Adsr()

function Init

void Init(
    float sample_rate,
    int blockSize =1
)

Parameters:

  • sample_rate - The sample rate of the audio engine being run.

Initializes the Adsr module.


function Retrigger

void Retrigger(
    bool hard
)

Parameters:

  • hard resets the history to zero, results in a click.

\function Retrigger forces the envelope back to attack phase


function Process

float Process(
    bool gate
)

Parameters:

  • gate - trigger the envelope, hold it to sustain

Processes one sample through the filter and returns one sample.


function SetTime

void SetTime(
    int seg,
    float time
)

Sets time Set time per segment in seconds


function SetAttackTime

void SetAttackTime(
    float timeInS,
    float shape =0.0f
)

function SetDecayTime

void SetDecayTime(
    float timeInS
)

function SetReleaseTime

void SetReleaseTime(
    float timeInS
)

function SetSustainLevel

inline void SetSustainLevel(
    float sus_level
)

Parameters:

  • sus_level - sets sustain level, 0...1.0

Sustain level


function GetCurrentSegment

inline uint8_t GetCurrentSegment()

Return: the segment of the envelope that the phase is currently located in.

get the current envelope segment


function IsRunning

inline bool IsRunning() const

Return: true if the envelope is currently in any stage apart from idle.

Tells whether envelope is active

---

Updated on 2024-01-03 at 19:38:46 +0000