Compare

Compare(input, comp, mode="<", mul=1, add=0)

Comparison object.

Compare evaluates a comparison between a PyoObject and a number or between two PyoObjects and outputs 1.0, as audio stream, if the comparison is true, otherwise outputs 0.0.

Parent class : PyoObject

Parameters:

    input : PyoObject
        Input signal.
    comp : float or PyoObject
        comparison signal.
    mode : string, optional
        Comparison operator as a string. Allowed operator are "<", "<=",
        ">", ">=", "==", "!=". Default to "<".

Methods:

    setInput(x, fadetime) : Replace the `input` attribute.
    setComp(x, fadetime) : Replace the `comp` attribute.
    setMode(x) : Replace the `mode` attribute.

Attributes:

    input : PyoObject. Input signal.
    comp : float or PyoObject. Comparison signal.
    mode : string. Comparison operator.

Examples:

    >>> s = Server().boot()
    >>> s.start()
    >>> a = SineLoop(freq=200, feedback=.1)
    >>> b = SineLoop(freq=150, feedback=.1)
    >>> ph = Phasor(freq=1)
    >>> ch = Compare(input=ph, comp=0.5, mode="<=")
    >>> out = Selector(inputs=[a,b], voice=Port(ch), mul=.5).out()

Methods details:

    Compare.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. Default to 0.05.

    Compare.setComp(x):

        Replace the `comp` attribute.
        
        Parameters:

        x : PyoObject
            New comparison signal.

    Compare.setMode(x):

        Replace the `mode` attribute. 
        
        Allowed operator are "<", "<=", ">", ">=", "==", "!=".
        
        Parameters:

        x : string
            New `mode` attribute.