src/cshellsynth/envelope_generator.h File Reference

#include <jack/jack.h>
#include <stdbool.h>
#include <cshellsynth/atomic-types.h>
#include <cshellsynth/jclient.h>

Go to the source code of this file.

Data Structures

struct  cs_envg_t

Defines

#define cs_envg_destroy(cs_envg)   jclient_destroy((jclient_t *) (cs_envg))

Enumerations

enum  cs_envg_state {
  ATTACK, DECAY, SUSTAIN, RELEASE,
  FINISHED
}

Functions

int cs_envg_init (cs_envg_t *self, const char *client_name, jack_options_t flags, char *server_name)
void cs_envg_set_attack_t (cs_envg_t *self, float attack_t)
void cs_envg_set_attack_a (cs_envg_t *self, float attack_a)
void cs_envg_set_decay_t (cs_envg_t *self, float decay_t)
void cs_envg_set_sustain_a (cs_envg_t *self, float sustain_a)
void cs_envg_set_release_t (cs_envg_t *self, float release_t)
void cs_envg_set_release_a (cs_envg_t *self, float release_a)
void cs_envg_set_linear (cs_envg_t *self, int linear)

Detailed Description

Envelope Generator

Ruby version: EnvelopeGenerator

Creates an envelope corresponding to a control signal.

           _ attack_a
        _-- \
      --     \
    /          \________ sustain_a
   /                    \
 /                       \
/                          \
release_a                   release_a
|__________|___|       |___|
 attack_t   decay_t     release_t

The bad ascii art is trying to illustrate the default exponential version.

If you want the addition of "hold" time, run the output through a distortion filter. That's likely to give you a more releastic punch then adding in a hold parameter anyway.

Also, note that by setting the appropriate parameters you can invert the envelope or do many other nonstandard things useful in controlling filters. The predictable way that a linear envelope interacts with Lin2Exp (lin2exp.h) is important for certain effects.

The attack and decay cycle are always performed. A control signal to release during this time will cause the release to happen immediately after the decay. Conversely, a control signal to attack starts the attack cycle immediately.

As a last warning, I suspect the existence of bugs I have not yet been able to identify when attack_a and release_a are not the default values.

Todo:
parameterize a forced release.

Define Documentation

#define cs_envg_destroy ( cs_envg   )     jclient_destroy((jclient_t *) (cs_envg))

Destroy envelope generator

See jclient_destroy


Enumeration Type Documentation

Envelope Generator State


Function Documentation

int cs_envg_init ( cs_envg_t self,
const char *  client_name,
jack_options_t  flags,
char *  server_name 
)

Initialize envelope generator

See jclient_init

void cs_envg_set_attack_a ( cs_envg_t self,
float  attack_a 
)

Set attack amplitude

Ruby version: attack_a=

void cs_envg_set_attack_t ( cs_envg_t self,
float  attack_t 
)

Set attack time

Ruby version: attack_t=

void cs_envg_set_decay_t ( cs_envg_t self,
float  decay_t 
)

Set decay time

Ruby version: decay_t=

void cs_envg_set_linear ( cs_envg_t self,
int  linear 
)

Set whether the envelope is linear or exponential

Ruby version: linear=

Parameters:
linear 0 for exponential, anything else for linear
void cs_envg_set_release_a ( cs_envg_t self,
float  release_a 
)

Set release amplitude

Ruby version: release_a=

void cs_envg_set_release_t ( cs_envg_t self,
float  release_t 
)

Set release time

Ruby version: release_t=

void cs_envg_set_sustain_a ( cs_envg_t self,
float  sustain_a 
)

Set sustain amplitude

Ruby version: sustain_a=

 All Data Structures Files Functions Variables Typedefs Enumerations Defines
Generated on Thu Sep 2 23:47:09 2010 for cshellsynth by  doxygen 1.6.3