Pattern

Pattern(function, time=1)

Periodically calls a Python function.

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

Parent class : PyoObject

Parameters:

    function : Python function
    time : float or PyoObject, optional
        Time, in seconds, between each call. Default to 1.

Methods:

    setFunction(x) : Replace the `function` attribute.
    setTime(x) : Replace the `time` attribute.

Attributes:

    function : Python function. Function to be called.
    time : Time, in seconds, between each call.

Notes:

    The out() method is bypassed. Pattern doesn't return signal.
    
    Pattern has no `mul` and `add` attributes.

Examples:

    >>> s = Server().boot()
    >>> s.start()
    >>> t = HarmTable([1,0,.33,0,.2,0,.143,0,.111])
    >>> a = Osc(table=t, freq=250, mul=.5).out()
    >>> def pat():
    ...     a.freq = random.randint(200, 400)
    ...    
    >>> p = Pattern(pat, .125)
    >>> p.play()

Methods details:

    Pattern.setFunction(x):

        Replace the `function` attribute.

        Parameters:

        x : Python function
            new `function` attribute.

    Pattern.setTime(x):

        Replace the `time` attribute.
        
        Parameters:
        
        x : float or PyoObject
            New `time` attribute.