How to use the pyo.lib._core.PyoObject function in pyo

To help you get started, we’ve selected a few pyo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github belangeo / pyo / pyo / lib / _core.py View on Github external
def time(self):
        """float. Ramp time."""
        return self._time
    @time.setter
    def time(self, x):
        self.setTime(x)

    @property
    def function(self):
        """Python callable. Function to be called."""
        return self._function
    @function.setter
    def function(self, x):
        self.setFunction(x)

class Pow(PyoObject):
    """
    Performs a power function on audio signal.

    :Parent: :py:class:`PyoObject`

    :Args:

        base: float or PyoObject, optional
            Base composant. Defaults to 10.
        exponent: float or PyoObject, optional
            Exponent composant. Defaults to 1.

    >>> s = Server().boot()
    >>> s.start()
    >>> # Exponential amplitude envelope
    >>> a = LFO(freq=1, type=3, mul=0.5, add=0.5)
github belangeo / pyo / pyo / lib / _core.py View on Github external
def __init__(self, value, mul=1, add=0):
        pyoArgsAssert(self, "OOO", value, mul, add)
        PyoObject.__init__(self, mul, add)
        self._value = value
        value, mul, add, lmax = convertArgsToLists(value, mul, add)
        self._base_objs = [Sig_base(wrap(value, i), wrap(mul, i),
                                    wrap(add, i)) for i in range(lmax)]
        self._init_play()
github belangeo / pyo / pyo / lib / _core.py View on Github external
x, _ = convertArgsToLists(x)
        [obj.setValue(wrap(x, i)) for i, obj in enumerate(self._base_objs)]

    def ctrl(self, map_list=None, title=None, wxnoserver=False):
        self._map_list = [SLMap(0, 1, "lin", "value", self._value)]
        PyoObject.ctrl(self, map_list, title, wxnoserver)

    @property
    def value(self):
        """float or PyoObject. Numerical value to convert."""
        return self._value
    @value.setter
    def value(self, x):
        self.setValue(x)

class VarPort(PyoObject):
    """
    Convert numeric value to PyoObject signal with portamento.

    When `value` attribute is changed, a smoothed ramp is applied from the
    current value to the new value. If a callback is provided as `function`
    argument, it will be called at the end of the line.

    :Parent: :py:class:`PyoObject`

    :Args:

        value: float
            Numerical value to convert.
        time: float, optional
            Ramp time, in seconds, to reach the new value. Defaults to 0.025.
        init: float, optional
github belangeo / pyo / pyo / lib / _core.py View on Github external
>>> b = SineLoop(p*1.253, feedback=.05, mul=.06).mix(2).out()
    >>> c = SineLoop(p*1.497, feedback=.05, mul=.03).mix(2).out()

    """
    def __init__(self, objs_list):
        PyoObject.__init__(self)
        self._objs_list = objs_list
        tmp_list = []
        for x in objs_list:
            if isinstance(x, Dummy):
                tmp_list.extend(x.getBaseObjects())
            else:
                tmp_list.append(x)
        self._base_objs = tmp_list

class InputFader(PyoObject):
    """
    Audio streams crossfader.

    :Args:

        input: PyoObject
            Input signal.

    .. note::

        The setInput method, available to object with `input` attribute,
        uses an InputFader object internally to perform crossfade between
        the old and the new audio input assigned to the object.

    >>> s = Server().boot()
    >>> s.start()
github belangeo / pyo / pyo / lib / _core.py View on Github external
def min(self):
        """float or PyoObject. Minimum possible value."""
        return self._min
    @min.setter
    def min(self, x):
        self.setMin(x)

    @property
    def max(self):
        """float or PyoObject. Maximum possible value."""
        return self._max
    @max.setter
    def max(self, x):
        self.setMax(x)

class Compare(PyoObject):
    """
    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: :py:class:`PyoObject`

    :Args:

        input: PyoObject
            Input signal.
        comp: float or PyoObject
            comparison signal.
        mode: string, optional
github belangeo / pyo / pyo / lib / _core.py View on Github external
num = voices
        elif lmax > input_len:
            num = lmax
        else:
            num = input_len
        sub_lists = []
        for i in range(voices):
            sub_lists.append([])
        for i in range(num):
            obj = input_objs[i % input_len]
            sub_lists[i % voices].append(obj)
        self._base_objs = [Mix_base(l, wrap(mul, i),
                                    wrap(add, i)) for i, l in enumerate(sub_lists)]
        self._init_play()

class Dummy(PyoObject):
    """
    Dummy object used to perform arithmetics on PyoObject.

    The user should never instantiate an object of this class.

    :Parent: :py:class:`PyoObject`

    :Args:

        objs_list: list of audio Stream objects
            List of Stream objects return by the PyoObject hidden method
            getBaseObjects().

    .. note::

        Multiplication, addition, division and substraction don't changed
github belangeo / pyo / pyo / lib / _core.py View on Github external
def ctrl(self, map_list=None, title=None, wxnoserver=False):
        self._map_list = [SLMap(0, 1, "lin", "value", self._value)]
        PyoObject.ctrl(self, map_list, title, wxnoserver)
github belangeo / pyo / pyo / lib / _core.py View on Github external
def __mul__(self, x):
        x, lmax = convertArgsToLists(x)
        if self.__len__() >= lmax:
            _mul_dummy = Dummy([obj * wrap(x, i//self._op_duplicate) \
                                for i, obj in enumerate(self._base_objs)])
        else:
            if isinstance(x, PyoObject):
                _mul_dummy = x * self
            else:
                _mul_dummy = Dummy([wrap(self._base_objs, i) * obj \
                                    for i, obj in enumerate(x)])
        self._keep_trace.append(_mul_dummy)
        return _mul_dummy
github belangeo / pyo / pyo / lib / _core.py View on Github external
If `wxnoserver` is set to True, the interpreter will not wait for
        the server GUI before showing the controller window.

        """
        if map_list is None:
            map_list = self._map_list
        if map_list == []:
            clsname = self.__class__.__name__
            print("There are no controls for %s object." % clsname)
            return
        createCtrlWindow(self, map_list, title, wxnoserver)

######################################################################
### Internal classes -> Used by pyo
######################################################################
class Mix(PyoObject):
    """
    Mix audio streams to arbitrary number of streams.

    Mix the object's audio streams as `input` argument into `voices`
    streams.

    :Parent: :py:class:`PyoObject`

    :Args:

        input: PyoObject or list of PyoObjects
            Input signal(s) to mix the streams.
        voices: int, optional
            Number of streams of the Mix object. If more than 1, input
            object's streams are alternated and added into Mix object's
            streams. Defaults to 1.
github belangeo / pyo / pyo / lib / _core.py View on Github external
"""
        pyoArgsAssert(self, "oN", x, fadetime)
        self._input = x
        x, _ = convertArgsToLists(x)
        [obj.setInput(wrap(x, i),
                      fadetime) for i, obj in enumerate(self._base_objs)]

    @property
    def input(self):
        """PyoObject. Input signal."""
        return self._input
    @input.setter
    def input(self, x):
        self.setInput(x)

class Sig(PyoObject):
    """
    Convert numeric value to PyoObject signal.

    :Parent: :py:class:`PyoObject`

    :Args:

        value: float or PyoObject
            Numerical value to convert.

    >>> import random
    >>> s = Server().boot()
    >>> s.start()
    >>> fr = Sig(value=400)
    >>> p = Port(fr, risetime=0.001, falltime=0.001)
    >>> a = SineLoop(freq=p, feedback=0.08, mul=.3).out()