Adsr

Adsr(attack=0.01, decay=0.05, sustain=0.71, release=0.10, dur=0, mul=1, add=0)

Attack - Decay - Sustain - Release envelope generator.

Calculates the classical ADSR envelope using linear segments. Duration can be set to 0 to give an infinite sustain. In this case, the stop() method calls the envelope release part.

The play() method starts the envelope and is not called at the object creation time.

Parent class : PyoObject

Parameters:

    attack : float, optional
        Duration of the attack phase in seconds. Defaults to 0.01.
    decay : float, optional
        Duration of the decay in seconds. Defaults to 0.05.
    sustain : float, optional
        Amplitude of the sustain phase. Defaults to 0.707.
    release : float, optional
        Duration of the release in seconds. Defaults to 0.1.
    dur : float, optional
        Total duration of the envelope. Defaults to 0, which means wait 
        for the stop() method to start the release phase.

Methods:

    play() : Start processing without sending samples to the output. 
        Triggers the envelope.
    stop() : Stop processing. Triggers the envelope's fadeout 
        if `dur` is set to 0.
    setAttack(x) : Replace the `attack` attribute.
    setDecay(x) : Replace the `decay` attribute.
    setSustain(x) : Replace the `sustain` attribute.
    setRelease(x) : Replace the `release` attribute.
    setDur(x) : Replace the `dur` attribute.

Attributes:

    attack : float. Duration of the attack phase in seconds.
    decay : float. Duration of the decay in seconds.
    sustain : float. Amplitude of the sustain phase.
    release : float. Duration of the release in seconds.
    dur : float. Total duration of the envelope.

Notes:

    The out() method is bypassed. Adsr's signal can not be sent to audio outs.
    
    Shape of a classical Adsr:

          -
         -  -
        -     -
       -        ------------------------
      -                                  -
     -                                     -
    -                                        -
      att - dec -        sustain       - rel

Examples:

    >>> s = Server().boot()
    >>> s.start()
    >>> f = Adsr(attack=.01, decay=.2, sustain=.5, release=.1, dur=5, mul=.5)
    >>> a = Noise(mul=f).out()
    >>> f.play()

Methods details:

    Adsr.play(dur=0, delay=0):

        Start processing without sending samples to output. 
        This method is called automatically at the object creation.
        
        Parameters:
        
        dur : float, optional
            Duration, in seconds, of the object's activation. The default is 0
            and means infinite duration.
        delay : float, optional
            Delay, in seconds, before the object's activation. Defaults to 0.

    Adsr.stop(self):

        Stop processing.

    Adsr.setAttack(x):

        Replace the `attack` attribute.
        
        Parameters:

        x : float
            new `attack` attribute.

    Adsr.setDecay(x):

        Replace the `decay` attribute.
        
        Parameters:

        x : float
            new `decay` attribute.

    Adsr.setSustain(x):

        Replace the `sustain` attribute.
        
        Parameters:

        x : float
            new `sustain` attribute.

    Adsr.setRelease(x):

        Replace the `sustain` attribute.
        
        Parameters:

        x : float
            new `sustain` attribute.

    Adsr.setDur(x):

        Replace the `dur` attribute.
        
        Parameters:

        x : float
            new `dur` attribute.