Thresh

Thresh(input, threshold=0.00, dir=0, mul=1, add=0)

Informs when a signal crosses a threshold.

Thresh sends a trigger when a signal crosses a threshold. The `dir` parameter can be used to set the crossing mode, down-up, up-down, or both.

Parent class : PyoObject

Parameters:

    input : PyoObject
        Audio signal sending triggers.
    threshold : float or PyoObject, optional
        Threshold value. Defaults to 0.
    dir : int {0, 1, 2}, optional
        There are three modes of using Thresh:
            dir = 0 : down-up
                sends a trigger when current value is higher than the
                threshold, while old value was equal to or lower than 
                the threshold.
            dir = 1 : up-down
                sends a trigger when current value is lower than the
                threshold, while old value was equal to or higher than 
                the threshold.
            dir = 2 : both direction
                sends a trigger in both the two previous cases.
        Defaults to 0.

Methods:

    setInput(x, fadetime) : Replace the `input` attribute.
    setThreshold(x) : Replace the `threshold` attribute.
    setDir(x) : Replace the `dir` attribute.

Attributes:

    input : PyoObject. Audio signal.
    threshold : float or PyoObject. Threshold value.
    dir : int. User mode.

Notes:

    The out() method is bypassed. Thresh's signal can not be sent 
    to audio outs.

Examples:

    >>> s = Server().boot()
    >>> s.start()
    >>> a = Phasor(1)
    >>> b = Thresh(a, threshold=[0.25, 0.5, 0.66], dir=0)
    >>> t = LinTable([(0,0), (50,1), (250,.3), (8191,0)])
    >>> env = TrigEnv(b, table=t, dur=.5, mul=.3)
    >>> sine = Sine(freq=[500,600,700], mul=env).out()

Methods details:

    Thresh.setInput(x, fadetime=0.05):

        Replace the `input` attribute.
        
        Parameters:

        x : PyoObject
            New signal to process.
        fadetime : float, optional
            Crossfade time between old and new input. Defaults to 0.05.

    Thresh.setThreshold(x):

        Replace the `threshold` attribute.
        
        Parameters:

        x : float or PyoObject
            new `threshold` attribute.

    Thresh.setDir(x):

        Replace the `dir` attribute.
        
        Parameters:

        x : int {0, 1, 2}
            new `dir` attribute.