Yet Another Synthesizer Engine
 
Loading...
Searching...
No Matches
yase::Envelope Class Reference

#include <envelope.hh>

+ Inheritance diagram for yase::Envelope:
+ Collaboration diagram for yase::Envelope:

Detailed Description

An ADSR envelope.

Typically, the input signal is not used. The output is fed to, for example, the amplitude of a gain or the frequency of a filter. The attack phase is linear, the decay and release phases are exponential. The attack input determines the length of the attack in seconds. The release and decay inputs determine the release and decay rates according to

\(y = e^{-t/k}\)

where k is either the (decay or release) parameter.

Parameters
[in]attack
[in]decay
[in]sustain
[in]release
[in]signal
[out]signal

Public Member Functions

void init ()
 
void update ()
 
void trigger ()
 
void release ()
 
void set_adsr (double aa, double dd, double ss, double rr)
 
- Public Member Functions inherited from yase::Triggerable
void init ()
 
void update ()
 
virtual void trigger ()=0
 
virtual void release ()=0
 
- Public Member Functions inherited from yase::Module
virtual void init ()=0
 
virtual void update ()=0
 
int add_input (string name)
 
int add_output (string name)
 
int get_input_index (string name) const
 
string get_input_name (int index) const
 
string get_output_name (int index) const
 
int get_output_index (string name) const
 
void set_input (string name, double value)
 
void set_input (int index, double value)
 
double get_input (int index) const
 
double get_input (string name) const
 
double get_output (string name) const
 
double get_output (int index) const
 
void set_output (int index, double value)
 
void copy_inputs (const Module &source)
 
void copy_outputs (Module &destination) const
 
void configure (std::vector< std::tuple< string, double > > assignments)
 
int num_inputs () const
 
int num_outputs () const
 
void emit (Event e)
 
void set_ts (double s)
 
double get_ts ()
 

Member Function Documentation

◆ init()

void yase::Envelope::init ( )
virtual

This method should be overridden by derived classes. It will usually be called once, after all modules and connections objects have been added to a synthesizer, but before the synthesizer starts running.

Implements yase::Module.

◆ release()

void yase::Envelope::release ( )
virtual

Implements yase::Triggerable.

◆ set_adsr()

void yase::Envelope::set_adsr ( double  aa,
double  dd,
double  ss,
double  rr 
)

The equivalent of doing

set_input("attack", aa);
set_input("decay", dd);
set_input("sustain", ss);
set_input("release", rr);
void set_input(string name, double value)
Definition module.cc:86
Parameters
aaAttack duration
ddTime to 90% decayed
ssPercentage of maximum for the sustain
rrTo to 90% released

◆ trigger()

void yase::Envelope::trigger ( )
virtual

Implements yase::Triggerable.

◆ update()

void yase::Envelope::update ( )
virtual

This method should be overridden by derived classes. It will be called repeatedly by a synthesizer at a frequency determined by SAMPLE_RATE.

Implements yase::Module.


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