[SCM] python-pyo/master: go away
tiago at users.alioth.debian.org
tiago at users.alioth.debian.org
Wed Feb 6 15:36:50 UTC 2013
The following commit has been merged in the master branch:
commit dbef475b22bfa27d68a4c7f2dbf0ba39c89d1163
Author: Tiago Bortoletto Vaz <tiago at debian.org>
Date: Wed Jan 30 00:43:15 2013 -0500
go away
diff --git a/build/lib.linux-x86_64-2.7/_pyo.so b/build/lib.linux-x86_64-2.7/_pyo.so
deleted file mode 100755
index 433304e..0000000
Binary files a/build/lib.linux-x86_64-2.7/_pyo.so and /dev/null differ
diff --git a/build/lib.linux-x86_64-2.7/pyolib/__init__.py b/build/lib.linux-x86_64-2.7/pyolib/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/build/lib.linux-x86_64-2.7/pyolib/_core.py b/build/lib.linux-x86_64-2.7/pyolib/_core.py
deleted file mode 100644
index b3d3c3e..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/_core.py
+++ /dev/null
@@ -1,1704 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from types import ListType, SliceType, FloatType, StringType, UnicodeType
-import random, os, sys, inspect, tempfile
-from subprocess import call
-from distutils.sysconfig import get_python_lib
-
-PYO_VERSION = '0.6.3'
-
-import __builtin__
-if hasattr(__builtin__, 'pyo_use_double'):
- import pyo64 as current_pyo
- from _pyo64 import *
-else:
- import pyo as current_pyo
- from _pyo import *
-
-from _maps import *
-from _widgets import createCtrlWindow, createViewTableWindow, createViewMatrixWindow
-
-######################################################################
-### Utilities
-######################################################################
-SNDS_PATH = os.path.join(get_python_lib(), "pyolib", "snds")
-XNOISE_DICT = {'uniform': 0, 'linear_min': 1, 'linear_max': 2, 'triangle': 3,
- 'expon_min': 4, 'expon_max': 5, 'biexpon': 6, 'cauchy': 7,
- 'weibull': 8, 'gaussian': 9, 'poisson': 10, 'walker': 11,
- 'loopseg': 12}
-
-def convertStringToSysEncoding(str):
- """
- Convert a string to the current platform file system encoding.
-
- Parameter:
-
- str: string
- String to convert.
-
- """
- if type(str) != UnicodeType:
- str = str.decode("utf-8")
- str = str.encode(sys.getfilesystemencoding())
- return str
-
-def convertArgsToLists(*args):
- """
- Convert all arguments to list if not already a list or a PyoObject.
- Return new args and maximum list length.
-
- """
- first = True
- for i in args:
- if isinstance(i, PyoObject): pass
- elif isinstance(i, PyoTableObject): pass
- elif isinstance(i, PyoMatrixObject): pass
- elif type(i) != ListType: i = [i]
-
- if first: tup = (i,)
- else: tup = tup + (i,)
-
- first = False
-
- lengths = [len(i) for i in tup]
- max_length = max(lengths)
- tup = tup + (max_length, )
- return tup
-
-def wrap(arg, i):
- """
- Return value at position `i` from `arg` with wrap around `arg` length.
-
- """
- x = arg[i % len(arg)]
- if isinstance(x, PyoObject):
- return x[0]
- elif isinstance(x, PyoTableObject):
- return x[0]
- elif isinstance(x, PyoMatrixObject):
- return x[0]
- else:
- return x
-
-if sys.version_info[:2] <= (2, 5):
- def example(cls, dur=5, toprint=True, double=False):
- """
- Execute the example given in the documentation of the object as an argument.
-
- example(cls, dur=5)
-
- Parameters:
-
- cls : PyoObject class
- Class reference of the desired object example.
- dur : float, optional
- Duration of the example.
- toprint : boolean, optional
- If True, the example script will be printed to the console.
- Defaults to True.
- double : boolean, optional
- If True, force the example to run in double precision (64-bit)
- Defaults to False.
-
- Examples:
-
- >>> example(Sine)
-
- """
- doc = cls.__doc__.split("Examples:")
- if len(doc) < 2:
- print "There is no manual example for %s object." % cls.__name__
- return
- if "Server" in doc[1]:
- with_server = True
- else:
- with_server = False
- lines = doc[1].splitlines()
- ex_lines = [line.lstrip(" ") for line in lines if ">>>" in line or "..." in line]
- if hasattr(__builtin__, 'pyo_use_double') or double:
- ex = "import time\nfrom pyo64 import *\n"
- else:
- ex = "import time\nfrom pyo import *\n"
- for line in ex_lines:
- if ">>>" in line: line = line.lstrip(">>> ")
- if "..." in line: line = " " + line.lstrip("... ")
- ex += line + "\n"
- if with_server:
- ex += "time.sleep(%f)\ns.stop()\ntime.sleep(0.25)\ns.shutdown()\n" % dur
- f = open('/tmp/pyo_example.py', 'w')
- if toprint:
- f.write('print """\n%s\n"""\n' % ex)
- f.write(ex)
- f.close()
- p = call(["python", '/tmp/pyo_example.py'])
-else:
- def example(cls, dur=5, toprint=True, double=False):
- """
- Execute the example given in the documentation of the object as an argument.
-
- example(cls, dur=5)
-
- Parameters:
-
- cls : PyoObject class
- Class reference of the desired object example.
- dur : float, optional
- Duration of the example.
- toprint : boolean, optional
- If True, the example script will be printed to the console.
- Defaults to True.
- double : boolean, optional
- If True, force the example to run in double precision (64-bit)
- Defaults to False.
-
- Examples:
-
- >>> example(Sine)
-
- """
- doc = cls.__doc__.split("Examples:")
- if len(doc) < 2:
- print "There is no manual example for %s object." % cls.__name__
- return
- if "Server" in doc[1]:
- with_server = True
- else:
- with_server = False
- lines = doc[1].splitlines()
- ex_lines = [line.lstrip(" ") for line in lines if ">>>" in line or "..." in line]
- if hasattr(__builtin__, 'pyo_use_double') or double:
- ex = "import time\nfrom pyo64 import *\n"
- else:
- ex = "import time\nfrom pyo import *\n"
- for line in ex_lines:
- if ">>>" in line: line = line.lstrip(">>> ")
- if "..." in line: line = " " + line.lstrip("... ")
- ex += line + "\n"
- if with_server:
- ex += "time.sleep(%f)\ns.stop()\ntime.sleep(0.25)\ns.shutdown()\n" % dur
- f = tempfile.NamedTemporaryFile(delete=False)
- if toprint:
- f.write('print """\n%s\n"""\n' % ex)
- f.write(ex)
- f.close()
- p = call(["python", f.name])
-
-def removeExtraDecimals(x):
- if type(x) == FloatType:
- return "=%.2f" % x
- elif type(x) == StringType:
- return '="%s"' % x
- else:
- return "=" + str(x)
-
-def class_args(cls):
- """
- Returns the init line of a class reference.
-
- class_args(cls)
-
- This function takes a class reference (not an instance of that class)
- as input and returns the init line of that class with the default values.
-
- Parameters:
-
- cls : PyoObject class
- Class reference of the desired object's init line.
-
- Examples:
-
- >>> print class_args(Sine)
- >>> 'Sine(freq=1000, phase=0, mul=1, add=0)'
-
- """
- name = cls.__name__
- try:
- # Try for a class __init__ function
- arg, varargs, varkw, defaults = inspect.getargspec(getattr(cls, "__init__"))
- arg = inspect.formatargspec(arg, varargs, varkw, defaults, formatvalue=removeExtraDecimals)
- arg = arg.replace("self, ", "")
- return name + arg
- except TypeError:
- try:
- # Try for a function
- lines = cls.__doc__.splitlines()
- for line in lines:
- if "%s(" % name in line:
- return line
- except:
- print "class_args was unable to retrieve the init line of the object as an argument."
- return ""
-
-def getVersion():
- """
- Returns the version number of the current pyo installation.
-
- getVersion()
-
- This function returns the version number of the current pyo
- installation as a 3-ints tuple (major, minor, rev).
-
- The returned tuple for version '0.4.1' will look like :
-
- (0, 4, 1)
-
- Examples:
-
- >>> print getVersion()
- >>> (0, 5, 1)
-
- """
- major, minor, rev = PYO_VERSION.split('.')
- return (int(major), int(minor), int(rev))
-
-######################################################################
-### PyoObject -> base class for pyo sound objects
-######################################################################
-class PyoObject(object):
- """
- Base class for all pyo objects that manipulate vectors of samples.
-
- The user should never instantiate an object of this class.
-
- Methods:
-
- play(dur, delay) : Start processing without sending samples to output.
- This method is called automatically at the object creation.
- stop() : Stop processing.
- out(chnl, inc, dur, delay) : Start processing and send samples to audio
- output beginning at `chnl`.
- mix(voices) : Mix object's audio streams into `voices` streams and
- return the Mix object.
- range(min, max) : Adjust `mul` and `add` attributes according to a given range.
- setMul(x) : Replace the `mul` attribute.
- setAdd(x) : Replace the `add` attribute.
- setDiv(x) : Replace and inverse the `mul` attribute.
- setSub(x) : Replace and inverse the `add` attribute.
- set(attr, value, port) : Replace any attribute with portamento.
- ctrl(map_list, title) : Opens a sliders window to control parameters.
- get(all) : Return the first sample of the current buffer as a float.
- dump() : Print current status of the object's attributes.
- getBaseObjects() : Return a list of audio Stream objects managed by the instance.
- isPlaying(all) : Returns True if the object is playing, otherwise, returns False.
- isOutputting(all) : Returns True if the object is sending samples to dac,
- otherwise, returns False.
-
- Attributes:
-
- mul : float or PyoObject
- Multiplication factor.
- add : float or PyoObject
- Addition factor.
-
- Notes:
-
- - Other operations:
-
- len(obj) : Return the number of audio streams in an object.
- obj[x] : Return stream `x` of the object. `x` is a number
- from 0 to len(obj) - 1.
- del obj : Perform a clean delete of the object.
-
- - Arithmetics:
-
- Multiplication, addition, division and substraction can be applied
- between pyo objects or between pyo objects and numbers. Doing so
- returns a Dummy object with the result of the operation.
- `b = a * 0.5` creates a Dummy object `b` with `mul` attribute set
- to 0.5 and leave `a` unchanged.
-
- Inplace multiplication, addition, division and substraction can be
- applied between pyo objects or between pyo objects and numbers.
- These operations will replace the `mul` or `add` factor of the object.
- `a *= 0.5` replaces the `mul` attribute of `a`.
-
- """
- def __init__(self):
- if not serverCreated():
- print "\nPYO Error: You must create and boot a Server before creating any audio object.\n"
- exit()
- else:
- if not serverBooted():
- print "\nPYO Error: The Server must be booted before creating any audio object.\n"
- exit()
- self._target_dict = {}
- self._signal_dict = {}
- self._keep_trace = []
- self._mul = 1.0
- self._add = 0.0
- self._op_duplicate = 1
-
- def __add__(self, x):
- x, lmax = convertArgsToLists(x)
- if self.__len__() >= lmax:
- _add_dummy = Dummy([obj + wrap(x,i/self._op_duplicate) for i, obj in enumerate(self._base_objs)])
- else:
- if isinstance(x, PyoObject):
- _add_dummy = x + self
- else:
- _add_dummy = Dummy([wrap(self._base_objs,i) + obj for i, obj in enumerate(x)])
- self._keep_trace.append(_add_dummy)
- return _add_dummy
-
- def __radd__(self, x):
- x, lmax = convertArgsToLists(x)
- if self.__len__() >= lmax:
- _add_dummy = Dummy([obj + wrap(x,i/self._op_duplicate) for i, obj in enumerate(self._base_objs)])
- else:
- _add_dummy = Dummy([wrap(self._base_objs,i) + obj for i, obj in enumerate(x)])
- self._keep_trace.append(_add_dummy)
- return _add_dummy
-
- def __iadd__(self, x):
- self.setAdd(x)
- return self
-
- def __sub__(self, x):
- x, lmax = convertArgsToLists(x)
- if self.__len__() >= lmax:
- _add_dummy = Dummy([obj - wrap(x,i/self._op_duplicate) for i, obj in enumerate(self._base_objs)])
- else:
- if isinstance(x, PyoObject):
- _add_dummy = Dummy([wrap(self._base_objs,i) - wrap(x,i) for i in range(lmax)])
- else:
- _add_dummy = Dummy([wrap(self._base_objs,i) - obj for i, obj in enumerate(x)])
- self._keep_trace.append(_add_dummy)
- return _add_dummy
-
- def __rsub__(self, x):
- x, lmax = convertArgsToLists(x)
- if self.__len__() >= lmax:
- tmp = []
- for i, obj in enumerate(self._base_objs):
- sub_upsamp = Sig(wrap(x, i/self._op_duplicate))
- self._keep_trace.append(sub_upsamp)
- tmp.append(sub_upsamp - obj)
- _add_dummy = Dummy(tmp)
- else:
- tmp = []
- for i, obj in enumerate(x):
- sub_upsamp = Sig(obj)
- self._keep_trace.append(sub_upsamp)
- tmp.append(sub_upsamp - wrap(self._base_objs,i))
- _add_dummy = Dummy(tmp)
- self._keep_trace.append(_add_dummy)
- return _add_dummy
-
- def __isub__(self, x):
- self.setSub(x)
- return self
-
- 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
-
- def __rmul__(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:
- _mul_dummy = Dummy([wrap(self._base_objs,i) * obj for i, obj in enumerate(x)])
- self._keep_trace.append(_mul_dummy)
- return _mul_dummy
-
- def __imul__(self, x):
- self.setMul(x)
- return self
-
- def __div__(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 = Dummy([wrap(self._base_objs,i) / wrap(x,i) for i in range(lmax)])
- 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
-
- def __rdiv__(self, x):
- x, lmax = convertArgsToLists(x)
- if self.__len__() >= lmax:
- tmp = []
- for i, obj in enumerate(self._base_objs):
- div_upsamp = Sig(wrap(x, i/self._op_duplicate))
- self._keep_trace.append(div_upsamp)
- tmp.append(div_upsamp / obj)
- _mul_dummy = Dummy(tmp)
- else:
- tmp = []
- for i, obj in enumerate(x):
- div_upsamp = Sig(obj)
- self._keep_trace.append(div_upsamp)
- tmp.append(div_upsamp / wrap(self._base_objs,i))
- _mul_dummy = Dummy(tmp)
- self._keep_trace.append(_mul_dummy)
- return _mul_dummy
-
- def __idiv__(self, x):
- self.setDiv(x)
- return self
-
- def __getitem__(self, i):
- if i == 'trig':
- return self._trig_objs
- if type(i) == SliceType or i < len(self._base_objs):
- return self._base_objs[i]
- else:
- if type(i) == StringType:
- print "Object %s has no stream named '%s'!" % (self.__class__, i)
- else:
- print "'i' too large in slicing object %s!" % self.__class__.__name__
-
- def __len__(self):
- return len(self._base_objs)
-
- def __repr__(self):
- return '< Instance of %s class >' % self.__class__.__name__
-
- def isPlaying(self, all=False):
- """
- Returns True if the object is playing, otherwise, returns False.
-
- Parameters:
-
- all : boolean, optional
- If True, the object returns a list with the state of all
- streams managed by the object. If False, it return a
- boolean corresponding to the state of the first stream.
- Defaults to False.
-
- """
- if all:
- return [obj._getStream().isPlaying() for obj in self._base_objs]
- else:
- return self._base_objs[0]._getStream().isPlaying()
-
- def isOutputting(self, all=False):
- """
- Returns True if the object is sending samples to dac, otherwise, returns False.
-
- Parameters:
-
- all : boolean, optional
- If True, the object returns a list with the state of all
- streams managed by the object. If False, it return a
- boolean corresponding to the state of the first stream.
- Defaults to False.
-
- """
- if all:
- return [obj._getStream().isOutputting() for obj in self._base_objs]
- else:
- return self._base_objs[0]._getStream().isOutputting()
-
- def dump(self):
- """
- Print the number of streams and the current status of the
- object's attributes.
-
- """
- attrs = dir(self)
- pp = '< Instance of %s class >' % self.__class__.__name__
- pp += '\n-----------------------------'
- pp += '\nNumber of audio streams: %d' % len(self)
- pp += '\n--- Attributes ---'
- for attr in attrs:
- pp += '\n' + attr + ': ' + str(getattr(self, attr))
- pp += '\n-----------------------------'
- return pp
-
- def get(self, all=False):
- """
- Return the first sample of the current buffer as a float.
-
- Can be used to convert audio stream to usable Python data.
-
- Object that implements string identifier for specific audio
- streams must use the corresponding string to specify which stream
- to get value. See get() method definition in these object's man pages.
-
- Parameters:
-
- all : boolean, optional
- If True, the first value of each object's stream
- will be returned as a list. Otherwise, only the value
- of the first object's stream will be returned as a float.
- Defaults to False.
-
- """
- if not all:
- return self._base_objs[0]._getStream().getValue()
- else:
- return [obj._getStream().getValue() for obj in self._base_objs]
-
- def getBaseObjects(self):
- """
- Return a list of audio Stream objects managed by the instance.
-
- """
- return self._base_objs
-
- def play(self, dur=0, delay=0):
- """
- Start processing without sending samples to output.
- This method is called automatically at the object creation.
-
- This method returns "self" allowing it to be applied 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.
-
- """
- dur, delay, lmax = convertArgsToLists(dur, delay)
- if hasattr(self, "_trig_objs"):
- self._trig_objs.play(dur, delay)
- if hasattr(self, "_base_players"):
- [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._base_players)]
- [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._base_objs)]
- return self
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- """
- Start processing and send samples to audio output beginning at `chnl`.
-
- This method returns "self" allowing it to be applied at the object
- creation.
-
- Parameters:
-
- chnl : int, optional
- Physical output assigned to the first audio stream of the object.
- Defaults to 0.
-
- If `chnl` is an integer equal or greater than 0, successive
- streams increment the output number by `inc` and wrap around
- the global number of channels.
-
- If `chnl` is a negative integer: streams begin at 0, increment
- the output number by `inc` and wrap around the global number of
- channels. Then, the list of streams is scrambled.
-
- If `chnl` is a list: successive values in the list will be
- assigned to successive streams.
- inc : int, optional
- Output increment value.
- 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.
-
- """
- dur, delay, lmax = convertArgsToLists(dur, delay)
- if hasattr(self, "_trig_objs"):
- self._trig_objs.play(dur, delay)
- if hasattr(self, "_base_players"):
- [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._base_players)]
- if type(chnl) == ListType:
- [obj.out(wrap(chnl,i), wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._base_objs)]
- else:
- if chnl < 0:
- [obj.out(i*inc, wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(random.sample(self._base_objs, len(self._base_objs)))]
- else:
- [obj.out(chnl+i*inc, wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._base_objs)]
- return self
-
- def stop(self):
- """
- Stop processing.
-
- This method returns "self" allowing it to be applied at the object
- creation.
-
- """
- if hasattr(self, "_trig_objs"):
- self._trig_objs.stop()
- if hasattr(self, "_base_players"):
- [obj.stop() for obj in self._base_players]
- [obj.stop() for obj in self._base_objs]
- return self
-
- def mix(self, voices=1):
- """
- Mix the object's audio streams into `voices` streams and return
- a Mix object.
-
- Parameters:
-
- voices : int, optional
- Number of audio streams of the Mix object created by this method.
- If more than 1, object's streams are alternated and added into
- Mix object's streams. Defaults to 1.
-
- """
- return Mix(self, voices)
-
- def range(self, min, max):
- """
- Adjust `mul` and `add` attributes according to a given range.
- This function assumes a signal between -1 and 1. Arguments may be
- list of floats for multi-streams objects.
-
- This method returns "self" allowing it to be applied at the object
- creation:
-
- >>> lfo = Sine(freq=1).range(500, 1000)
-
- Parameters:
-
- min : float
- Minimum value of the output signal.
- max : float
- Maximum value of the output signal.
-
- """
- min, max, lmax = convertArgsToLists(min, max)
- if lmax > 1:
- mul = [(wrap(max,i) - wrap(min,i)) * 0.5 for i in range(lmax)]
- add = [(wrap(max,i) + wrap(min,i)) * 0.5 for i in range(lmax)]
- else:
- mul = (max[0] - min[0]) * 0.5
- add = (max[0] + min[0]) * 0.5
- self.setMul(mul)
- self.setAdd(add)
- return self
-
- def setMul(self, x):
- """
- Replace the `mul` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `mul` attribute.
-
- """
- self._mul = x
- x, lmax = convertArgsToLists(x)
- [obj.setMul(wrap(x,i/self._op_duplicate)) for i, obj in enumerate(self._base_objs)]
-
- def setAdd(self, x):
- """
- Replace the `add` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `add` attribute.
-
- """
- self._add = x
- x, lmax = convertArgsToLists(x)
- [obj.setAdd(wrap(x,i/self._op_duplicate)) for i, obj in enumerate(self._base_objs)]
-
- def setSub(self, x):
- """
- Replace and inverse the `mul` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New inversed `mul` attribute.
-
- """
- self._add = x
- x, lmax = convertArgsToLists(x)
- [obj.setSub(wrap(x,i/self._op_duplicate)) for i, obj in enumerate(self._base_objs)]
-
- def setDiv(self, x):
- """
- Replace and inverse the `add` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New inversed `add` attribute.
-
- """
- self._mul = x
- x, lmax = convertArgsToLists(x)
- [obj.setDiv(wrap(x,i/self._op_duplicate)) for i, obj in enumerate(self._base_objs)]
-
- def set(self, attr, value, port=0.025):
- """
- Replace any attribute with portamento.
-
- This method is intended to be applied on attributes that are not
- already assigned to PyoObjects. It will work only with floats or
- list of floats.
-
- Parameters:
-
- attr : string
- Name of the attribute as a string.
- value : float
- New value.
- port : float, optional
- Time, in seconds, to reach the new value
-
- """
- self._target_dict[attr] = value
- init = getattr(self, attr)
- if self._signal_dict.has_key(attr):
- if isinstance(self._signal_dict[attr], VarPort):
- if self._signal_dict[attr].isPlaying():
- init = self._signal_dict[attr].get(True)
- self._signal_dict[attr].stop()
- self._signal_dict[attr] = VarPort(value, port, init, self._reset_from_set, attr)
- setattr(self, attr, self._signal_dict[attr])
-
- def _reset_from_set(self, attr=None):
- if isinstance(getattr(self, attr), VarPort):
- setattr(self, attr, self._target_dict[attr])
- self._signal_dict[attr].stop()
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- """
- Opens a sliders window to control the parameters of the object.
- Only parameters that can be set to a PyoObject are allowed
- to be mapped on a slider.
-
- If a list of values are given to a parameter, a multisliders
- will be used to control each stream independently.
-
- Parameters:
-
- map_list : list of SLMap objects, optional
- Users defined set of parameters scaling. There is default
- scaling for each object that accept `ctrl` method.
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- if map_list == None:
- map_list = self._map_list
- if map_list == []:
- print("There is no controls for %s object." % self.__class__.__name__)
- return
- createCtrlWindow(self, map_list, title, wxnoserver)
-
- @property
- def mul(self):
- """float or PyoObject. Multiplication factor."""
- return self._mul
- @mul.setter
- def mul(self, x): self.setMul(x)
-
- @property
- def add(self):
- """float or PyoObject. Addition factor."""
- return self._add
- @add.setter
- def add(self, x): self.setAdd(x)
-
-######################################################################
-### PyoTableObject -> base class for pyo table objects
-######################################################################
-class PyoTableObject(object):
- """
- Base class for all pyo table objects.
-
- A table object is a buffer memory to store precomputed samples.
-
- The user should never instantiate an object of this class.
-
- Methods:
-
- getSize() : Return table size in samples.
- view() : Opens a window showing the contents of the table.
- dump() : Print current status of the object's attributes.
- save(path, format, sampletype) : Writes the content of the table in an audio file.
- write(path, oneline) : Writes the content of the table in a text file.
- read(path) : Sets the content of the table from a text file.
- normalize() : Normalize table samples between -1 and 1.
- removeDC() : Remove DC offset from the table's data.
- reverse() : Reverse the table's data.
- copy() : Returns a deep copy of the object.
- put(value, pos) : Puts a value at specified position in the table.
- get(pos) : Returns the value at specified position in the table.
- getBaseObjects() : Return a list of table Stream objects managed by the instance.
- getTable(all) : Returns the content of the table as list of floats.
-
- Notes:
-
- Operations allowed on all table objects :
-
- len(obj) : Return the number of table streams in an object.
- obj[x] : Return table stream `x` of the object. `x` is a number
- from 0 to len(obj) - 1.
-
- """
- def __init__(self):
- if not serverCreated():
- print "\nPYO Error: You must create and boot a Server before creating any audio object.\n"
- exit()
- else:
- if not serverBooted():
- print "\nPYO Error: The Server must be booted before creating any audio object.\n"
- exit()
-
- def __getitem__(self, i):
- if i < len(self._base_objs):
- return self._base_objs[i]
- else:
- print "'i' too large in slicing table %s!" % self.__class__.__name__
-
- def __len__(self):
- return len(self._base_objs)
-
- def __repr__(self):
- return '< Instance of %s class >' % self.__class__.__name__
-
- def dump(self):
- """
- Print the number of streams and the current status of the
- object's attributes.
-
- """
- attrs = dir(self)
- pp = '< Instance of %s class >' % self.__class__.__name__
- pp += '\n-----------------------------'
- pp += '\nNumber of table streams: %d' % len(self)
- pp += '\n--- Attributes ---'
- for attr in attrs:
- pp += '\n' + attr + ': ' + str(getattr(self, attr))
- pp += '\n-----------------------------'
- return pp
-
- def save(self, path, format=0, sampletype=0):
- """
- Writes the content of the table in an audio file.
-
- The sampling rate of the file is the sampling rate of the server
- and the number of channels is the number of table streams of the
- object.
-
- Parameters:
-
- path : string
- Full path (including extension) of the new file.
- format : int, optional
- Format type of the new file. Defaults to 0. Supported formats are:
- 0 : WAVE - Microsoft WAV format (little endian) {.wav, .wave}
- 1 : AIFF - Apple/SGI AIFF format (big endian) {.aif, .aiff}
- sampletype : int, optional
- Bit depth encoding of the audio file. Defaults to 0. Supported types are:
- 0 : 16 bit int
- 1 : 24 bit int
- 2 : 32 bit int
- 3 : 32 bit float
- 4 : 64 bit float
-
- """
- savefileFromTable(self, path, format, sampletype)
-
- def write(self, path, oneline=True):
- """
- Writes the content of the table in a text file.
-
- This function can be used to store the table data as a
- list of floats into a text file.
-
- Parameters:
-
- path : string
- Full path of the generated file.
- oneline : boolean, optional
- If True, list of samples will inserted on one line.
- If False, list of samples will be truncated to 8 floats
- per line. Defaults to True.
-
- """
- f = open(path, "w")
- if oneline:
- f.write(str([obj.getTable() for obj in self._base_objs]))
- else:
- text = "["
- for obj in self._base_objs:
- text += "["
- for i, val in enumerate(obj.getTable()):
- if (i % 8) == 0:
- text += "\n"
- text += str(val) + ", "
- text += "]"
- text += "]"
- f.write(text)
- f.close()
-
- def read(self, path):
- """
- Reads the content of a text file and replaces the table data
- with the values in the file.
-
- Format is a list of lists of floats. For example, A two
- tablestreams object must be given a content like this:
-
- [[0.0,1.0,0.5,...], [1.0,0.99,0.98,0.97,...]]
-
- Each object's tablestream will be resized according to the
- length of the lists.
-
- """
- f = open(path, "r")
- f_list = eval(f.read())
- f_len = len(f_list)
- f.close()
- [obj.setData(f_list[i%f_len]) for i, obj in enumerate(self._base_objs)]
-
- def getBaseObjects(self):
- """
- Return a list of table Stream objects managed by the instance.
-
- """
- return self._base_objs
-
- def getSize(self):
- """
- Return table size in samples.
-
- """
- return self._size
-
- def put(self, value, pos=0):
- """
- Puts a value at specified position in the table.
-
- If the object has more than 1 tablestream, the default is to
- record the value in each table. User can call obj[x].put()
- to record in a specific table.
-
- Parameters:
-
- value : float
- Value, as floating-point, to record in the table.
- pos : int, optional
- Position where to record value. Defaults to 0.
-
- """
- [obj.put(value, pos) for obj in self._base_objs]
-
- def get(self, pos):
- """
- Returns the value, as float, at specified position in the table.
-
- If the object has more than 1 tablestream, the default is to
- return a list with the value of each tablestream. User can call
- obj[x].get() to get the value of a specific table.
-
- Parameters:
-
- pos : int, optional
- Position where to get value. Defaults to 0.
-
- """
- values = [obj.get(pos) for obj in self._base_objs]
- if len(values) == 1: return values[0]
- else: return values
-
- def getTable(self, all=False):
- """
- Returns the content of the table as list of floats.
-
- Parameters:
-
- all : boolean, optional
- If True, all sub tables are retrieved and returned as a list
- of list of floats. Otherwise, a single list containing the
- content of the first subtable (or the only one) is returned.
- Defaults to False.
-
- """
- if all:
- return [obj.getTable() for obj in self._base_objs]
- else:
- return self._base_objs[0].getTable()
-
- def normalize(self):
- """
- Normalize table samples between -1 and 1.
-
- """
- [obj.normalize() for obj in self._base_objs]
- return self
-
- def removeDC(self):
- """
- Filter out DC offset from the table's data.
-
- """
- [obj.removeDC() for obj in self._base_objs]
- return self
-
- def reverse(self):
- """
- Reverse the table's data.
-
- """
- [obj.reverse() for obj in self._base_objs]
- return self
-
- def copy(self):
- """
- Returns a deep copy of the object.
-
- """
- args = [getattr(self, att) for att in self.__dir__()]
- if self.__class__.__name__ == "SndTable":
- _size = self.getSize()
- if type(_size) != ListType:
- _size = [_size]
- _chnls = len(self._base_objs)
- args[0] = None
- args.append(_chnls)
- newtable = getattr(current_pyo, self.__class__.__name__)(*args)
- [obj.setSize(_size[i%len(_size)]) for i, obj in enumerate(newtable.getBaseObjects())]
- [obj.copy(self[i]) for i, obj in enumerate(newtable.getBaseObjects())]
- else:
- newtable = getattr(current_pyo, self.__class__.__name__)(*args)
- [obj.copy(self[i]) for i, obj in enumerate(newtable.getBaseObjects())]
- return newtable
-
- def view(self, title="Table waveform", wxnoserver=False):
- """
- Opens a window showing the contents of the table.
-
- Parameters:
-
- title : string, optional
- Window title. Defaults to "Table waveform".
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the table window.
- Defaults to False.
-
- """
- samples = self._base_objs[0].getViewTable()
- createViewTableWindow(samples, title, wxnoserver, self.__class__.__name__)
-
-######################################################################
-### PyoMatrixObject -> base class for pyo matrix objects
-######################################################################
-class PyoMatrixObject(object):
- """
- Base class for all pyo matrix objects.
-
- A matrix object is a 2 dimensions buffer memory to store
- precomputed samples.
-
- The user should never instantiate an object of this class.
-
- Methods:
-
- getSize() : Return matrix size in samples (x, y).
- view() : Opens a window showing the contents of the matrix.
- dump() : Print current status of the object's attributes.
- write(path) : Writes the content of the matrix in a text file.
- read(path) : Sets the content of the matrix from a text file.
- normalize() : Normalize matrix samples between -1 and 1.
- blur() : Apply a simple gaussian blur on the matrix.
- boost(min, max, boost) : Boost the contrast of values in the matrix.
- put(value, x, y) : Puts a value at specified position in the matrix.
- get(x, y) : Returns the value at specified position in the matrix.
- getBaseObjects() : Returns a list of matrix stream objects managed by the instance.
-
- Notes:
-
- Operations allowed on all matrix objects :
-
- len(obj) : Return the number of table streams in an object.
- obj[x] : Return table stream `x` of the object. `x` is a number
- from 0 to len(obj) - 1.
-
- """
- def __init__(self):
- if not serverCreated():
- print "\nPYO Error: You must create and boot a Server before creating any audio object.\n"
- exit()
- else:
- if not serverBooted():
- print "\nPYO Error: The Server must be booted before creating any audio object.\n"
- exit()
-
- def __getitem__(self, i):
- if i < len(self._base_objs):
- return self._base_objs[i]
- else:
- print "'i' too large in slicing matrix %s!" % self.__class__.__name__
-
- def __len__(self):
- return len(self._base_objs)
-
- def __repr__(self):
- return '< Instance of %s class >' % self.__class__.__name__
-
- def dump(self):
- """
- Print the number of streams and the current status of the
- object's attributes.
-
- """
- attrs = dir(self)
- pp = '< Instance of %s class >' % self.__class__.__name__
- pp += '\n-----------------------------'
- pp += '\nNumber of matrix streams: %d' % len(self)
- pp += '\n--- Attributes ---'
- for attr in attrs:
- pp += '\n' + attr + ': ' + str(getattr(self, attr))
- pp += '\n-----------------------------'
- return pp
-
- def write(self, path):
- """
- Writes the content of the matrix into a text file.
-
- This function can be used to store the matrix data as a
- list of list of floats into a text file.
-
- """
- f = open(path, "w")
- f.write(str([obj.getData() for obj in self._base_objs]))
- f.close()
-
- def read(self, path):
- """
- Reads the content of a text file and replaces the matrix data
- with the values in the file.
-
- Format is a list of lists of floats. For example, A two
- matrixstreams object must be given a content like this:
-
- [[[0.0,1.0,0.5,...], [1.0,0.99,0.98,0.97,...]],
- [[0.0,1.0,0.5,...], [1.0,0.99,0.98,0.97,...]]]
-
- Each object's matrixstream will be resized according to the
- length of the lists, but the number of matrixstreams must be
- the same.
-
- """
- f = open(path, "r")
- f_list = eval(f.read())
- f_len = len(f_list)
- f.close()
- [obj.setData(f_list[i%f_len]) for i, obj in enumerate(self._base_objs)]
-
- def getBaseObjects(self):
- """
- Returns a list of matrix stream objects managed by the instance.
-
- """
- return self._base_objs
-
- def getSize(self):
- """
- Returns matrix size in samples. Size is a tuple (x, y).
-
- """
- return self._size
-
- def normalize(self):
- """
- Normalize matrix samples between -1 and 1.
-
- """
- [obj.normalize() for obj in self._base_objs]
- return self
-
- def blur(self):
- """
- Apply a simple gaussian blur on the matrix.
-
- """
- [obj.blur() for obj in self._base_objs]
-
- def boost(self, min=-1.0, max=1.0, boost=0.01):
- """
- Boost the constrast of values in the matrix.
-
- Parameters:
-
- min : float, optional
- Minimum value. Defaults to -1.0.
- max : float, optional
- Maximum value. Defaults to 1.0.
- boost : float, optional
- Amount of boost applied on each value. Defaults to 0.01.
-
- """
- [obj.boost(min, max, boost) for obj in self._base_objs]
-
- def put(self, value, x=0, y=0):
- """
- Puts a value at specified position in the matrix.
-
- If the object has more than 1 matrixstream, the default is to
- record the value in each matrix. User can call obj[x].put()
- to record in a specific matrix.
-
- Parameters:
-
- value : float
- Value, as floating-point, to record in the matrix.
- x : int, optional
- X position where to record value. Defaults to 0.
- y : int, optional
- Y position where to record value. Defaults to 0.
-
- """
- [obj.put(value, x, y) for obj in self._base_objs]
-
- def get(self, x, y):
- """
- Returns the value, as float, at specified position in the matrix.
-
- If the object has more than 1 matrixstream, the default is to
- return a list with the value of each matrixstream. User can call
- obj[x].get() to get the value of a specific matrix.
-
- Parameters:
-
- x : int, optional
- X position where to get value. Defaults to 0.
- y : int, optional
- Y position where to get value. Defaults to 0.
-
- """
- values = [obj.get(x, y) for obj in self._base_objs]
- if len(values) == 1: return values[0]
- else: return values
-
- def view(self, title="Matrix viewer", wxnoserver=False):
- """
- Opens a window showing the contents of the matrix.
-
- Parameters:
-
- title : string, optional
- Window title. Defaults to "Matrix viewer".
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the matrix window.
- Defaults to False.
-
- """
- samples = self._base_objs[0].getViewData()
- createViewMatrixWindow(samples, self.getSize(), 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.
-
- Parentclass: PyoObject
-
- Parameters:
-
- 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.
-
- Notes:
-
- The mix method of PyoObject creates and returns a new Mix object
- with mixed streams of the object that called the method. User
- don't have to instantiate this class directly. These two calls
- are identical:
-
- >>> b = a.mix()
- >>> b = Mix(a)
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Sine([random.uniform(400,600) for i in range(50)], mul=.02)
- >>> b = Mix(a, voices=2).out()
- >>> print len(a)
- 50
- >>> print len(b)
- 1
-
- """
- def __init__(self, input, voices=1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- mul, add, lmax = convertArgsToLists(mul, add)
- if type(input) == ListType:
- input_objs = []
- input_objs = [obj for pyoObj in input for obj in pyoObj.getBaseObjects()]
- else:
- input_objs = input.getBaseObjects()
- input_len = len(input_objs)
- if voices < 1:
- voices = 1
- num = 1
- elif voices > input_len and voices > lmax:
- 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)]
-
- def __dir__(self):
- return ['mul', 'add']
-
-class Dummy(PyoObject):
- """
- Dummy object used to perform arithmetics on PyoObject.
-
- The user should never instantiate an object of this class.
-
- Parentclass: PyoObject
-
- Parameters:
-
- objs_list : list of audio Stream objects
- List of Stream objects return by the PyoObject hidden method
- getBaseObjects().
-
- Notes:
-
- Multiplication, addition, division and substraction don't changed
- the PyoObject on which the operation is performed. A dummy object
- is created, which is just a copy of the audio Streams of the object,
- and the operation is applied on the Dummy, leaving the original
- object unchanged. This lets the user performs multiple different
- arithmetic operations on an object without conficts. Here, `b` is
- a Dummy object with `a` as its input with a `mul` attribute of 0.5.
- attribute:
-
- >>> a = Sine()
- >>> b = a * .5
- >>> print a
- <pyolib.input.Sine object at 0x11fd610>
- >>> print b
- <pyolib._core.Dummy object at 0x11fd710>
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> m = Metro(time=0.25).play()
- >>> p = TrigChoice(m, choice=[midiToHz(n) for n in [60,62,65,67,69]])
- >>> a = SineLoop(p, feedback=.05, mul=.1).mix(2).out()
- >>> 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
- self._mul = 1
- self._add = 0
- 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
-
- def __dir__(self):
- return ['mul', 'add']
-
-class InputFader(PyoObject):
- """
- Audio streams crossfader.
-
- Parameters:
-
- input : PyoObject
- Input signal.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal.
-
- Notes:
-
- 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.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SineLoop([449,450], feedback=0.05, mul=.2)
- >>> b = SineLoop([650,651], feedback=0.05, mul=.2)
- >>> c = InputFader(a).out()
- >>> # to created a crossfade, assign a new audio input:
- >>> c.setInput(b, fadetime=5)
-
- """
- def __init__(self, input):
- PyoObject.__init__(self)
- self._input = input
- input, lmax = convertArgsToLists(input)
- self._base_objs = [InputFader_base(wrap(input,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- x, lmax = 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.
-
- Parentclass: PyoObject
-
- Parameters:
-
- value : float or PyoObject
- Numerical value to convert.
-
- Methods:
-
- setValue(x) : Changes the value of the signal stream.
-
- Attributes:
-
- value : float or PyoObject. Numerical value to convert.
-
- Examples:
-
- >>> 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()
- >>> b = SineLoop(freq=p*1.005, feedback=0.08, mul=.3).out(1)
- >>> def pick_new_freq():
- ... fr.value = random.randrange(300,601,50)
- >>> pat = Pattern(function=pick_new_freq, time=0.5).play()
-
- """
- def __init__(self, value, mul=1, add=0):
- PyoObject.__init__(self)
- self._value = value
- self._mul = mul
- self._add = add
- 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)]
-
- def __dir__(self):
- return ['value', 'mul', 'add']
-
- def setValue(self, x):
- """
- Changes the value of the signal stream.
-
- Parameters:
-
- x : float or PyoObject
- Numerical value to convert.
-
- """
- self._value = x
- x, lmax = 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.
-
- Parentclass: PyoObject
-
- Parameters:
-
- 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
- Initial value of the internal memory. Defaults to 0.
- function : Python callable, optional
- If provided, it will be called at the end of the line.
- Defaults to None.
- arg : any Python object, optional
- Optional argument sent to the function called at the end of the line.
- Defaults to None.
-
- Methods:
-
- setValue(x) : Changes the value of the signal stream.
- setTime(x) : Changes the ramp time.
-
- Attributes:
-
- value : float. Numerical value to convert.
- time : float. Ramp time.
-
- Notes:
-
- The out() method is bypassed. VarPort's signal can not be sent to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> def callback(arg):
- ... print "end of line"
- ... print arg
- ...
- >>> fr = VarPort(value=500, time=2, init=250, function=callback, arg="YEP!")
- >>> a = SineLoop(freq=[fr,fr*1.01], feedback=0.05, mul=.2).out()
-
- """
- def __init__(self, value, time=0.025, init=0.0, function=None, arg=None, mul=1, add=0):
- PyoObject.__init__(self)
- self._value = value
- self._time = time
- self._mul = mul
- self._add = add
- value, time, init, function, arg, mul ,add, lmax = convertArgsToLists(value, time, init, function, arg, mul, add)
- self._base_objs = [VarPort_base(wrap(value,i), wrap(time,i), wrap(init,i), wrap(function,i), wrap(arg,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['value', 'time', 'mul', 'add']
-
- def setValue(self, x):
- """
- Changes the value of the signal stream.
-
- Parameters:
-
- x : float
- Numerical value to convert.
-
- """
- self._value = x
- x, lmax = convertArgsToLists(x)
- [obj.setValue(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setTime(self, x):
- """
- Changes the ramp time of the object.
-
- Parameters:
-
- x : float
- New ramp time.
-
- """
- self._time = x
- x, lmax = convertArgsToLists(x)
- [obj.setTime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def value(self):
- """float. Numerical value to convert."""
- return self._value
- @value.setter
- def value(self, x): self.setValue(x)
-
- @property
- def time(self):
- """float. Ramp time."""
- return self._time
- @time.setter
- def time(self, x): self.setTime(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/_maps.py b/build/lib.linux-x86_64-2.7/pyolib/_maps.py
deleted file mode 100644
index f808ffa..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/_maps.py
+++ /dev/null
@@ -1,384 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from math import pow, log10
-
-######################################################################
-### Map -> rescale values from sliders
-######################################################################
-class Map:
- """
- Converts value between 0 and 1 on various scales.
-
- Base class for Map objects.
-
- Parameters:
-
- min : int or float
- Lowest value of the range.
- max : int or float
- Highest value of the range.
- scale : string {'lin', 'log'}
- Method used to scale the input value on the specified range.
-
- Methods:
-
- get(x) : Returns scaled value for `x` between 0 and 1.
- set(x) : Returns the normalized value (0 -> 1) for `x` in the real range.
- setMin(x) : Replaces the 'min' attribute.
- setMax(x) : Replaces the 'max' attribute.
- setScale(x) : Replaces the 'scale' attribute.
-
- Attributes:
-
- min : Lowest value of the range.
- max : Highest value of the range.
- scale : Method used to scale the input value.
-
- Examples:
-
- >>> m = Map(20., 20000., 'log')
- >>> print m.get(.5)
- 632.455532034
- >>> print m.set(12000)
- 0.926050416795
-
- """
- def __init__(self, min, max, scale):
- self._min, self._max, self._scale = float(min), float(max), scale
-
- def get(self, x):
- """
- Takes `x` between 0 and 1 and returns scaled value.
-
- """
- if x < 0: x = 0.0
- elif x > 1: x = 1.0
-
- if self._scale == 'log':
- return pow(10, x * log10(self._max/self._min) + log10(self._min))
- else:
- return (self._max - self._min) * x + self._min
-
- def set(self, x):
- """
- Takes `x` in the real range and returns value unscaled
- (between 0 and 1).
-
- """
-
- if self._scale == 'log':
- return log10(x/self._min) / log10(self._max/self._min)
- else:
- return (x - self._min) / (self._max - self._min)
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float
- New `min` attribute.
-
- """
- self._min = x
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float
- New `max` attribute.
-
- """
- self._max = x
-
- def setScale(self, x):
- """
- Replace the `scale` attribute.
-
- Parameters:
-
- x : string
- New `scale` attribute.
-
- """
- self._scale = x
-
- @property
- def min(self): return self._min
- @min.setter
- def min(self, x): self.setMin(x)
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
- @property
- def scale(self): return self._scale
- @scale.setter
- def scale(self, x): self.setScale(x)
-
-class SLMap(Map):
- """
- Base Map class used to manage control sliders.
-
- Derived from Map class, a few parameters are added for sliders
- initialization.
-
- Parentclass: Map
-
- Parameters:
-
- min : int or float
- Smallest value of the range.
- max : int or float
- Highest value of the range.
- scale : string {'lin', 'log'}
- Method used to scale the input value on the specified range.
- name : string
- Name of the attributes the slider is affected to.
- init : int or float
- Initial value. Specified in the real range, not between 0 and 1. Use
- the `set` method to retreive the normalized corresponding value.
- res : string {'int', 'float'}, optional
- Sets the resolution of the slider. Defaults to 'float'.
- ramp : float, optional
- Ramp time, in seconds, used to smooth the signal sent from slider
- to object's attribute. Defaults to 0.025.
-
- Methods:
-
- get(x) : Returns the scaled value for `x` between 0 and 1.
- set(x) : Returns the normalized value (0 -> 1) for `x` in the real range.
-
- Attributes:
-
- min : Lowest value of the range.
- max : Highest value of the range.
- scale : Method used to scale the input value.
- name : Name of the parameter to control.
- init : Initial value of the slider.
- res : Slider resolution {int or float}.
- ramp : Ramp time in seconds.
-
- Examples:
-
- >>> s = Server().boot()
- >>> ifs = [350,360,375,388]
- >>> maps = [SLMap(20., 2000., 'log', 'freq', ifs), SLMap(0, 0.25, 'lin', 'feedback', 0), SLMapMul(.1)]
- >>> a = SineLoop(freq=ifs, mul=.1).out()
- >>> a.ctrl(maps)
-
- """
- def __init__(self, min, max, scale, name, init, res='float', ramp=0.025):
- Map.__init__(self, min, max, scale)
- self._name, self._init, self._res, self._ramp = name, init, res, ramp
-
- @property
- def name(self): return self._name
- @property
- def init(self): return self._init
- @property
- def res(self): return self._res
- @property
- def ramp(self): return self._ramp
-
-class SLMapFreq(SLMap):
- """
- SLMap with normalized values for a 'freq' slider.
-
- Parentclass: SLMap
-
- Parameters:
-
- init : int or float, optional
- Initial value. Specified in the real range, not between 0 and 1.
- Defaults to 1000.
-
- SLMapFreq values are:
-
- min = 20.0
- max = 20000.0
- scale = 'log'
- name = 'freq'
- res = 'float'
- ramp = 0.025
-
- Methods:
-
- get(x) : Returns scaled value for `x` between 0 and 1.
- set(x) : Returns the normalized value (0 -> 1) for `x` in the real range.
-
- """
- def __init__(self, init=1000):
- SLMap.__init__(self, 20., 20000., 'log', 'freq', init, 'float', 0.025)
-
-class SLMapMul(SLMap):
- """
- SLMap with normalized values for a 'mul' slider.
-
- Parentclass: SLMap
-
- Parameters:
-
- init : int or float, optional
- Initial value. Specified in the real range, not between 0 and 1.
- Defaults to 1.
-
- SLMapMul values are:
-
- min = 0.0
- max = 2.0
- scale = 'lin'
- name = 'mul'
- res = 'float'
- ramp = 0.025
-
- Methods:
-
- get(x) : Returns scaled value for `x` between 0 and 1.
- set(x) : Returns the normalized value (0 -> 1) for `x` in the real range.
-
- """
- def __init__(self, init=1.):
- SLMap.__init__(self, 0., 2., 'lin', 'mul', init, 'float', 0.025)
-
-class SLMapPhase(SLMap):
- """
- SLMap with normalized values for a 'phase' slider.
-
- Parentclass: SLMap
-
- Parameters:
-
- init : int or float, optional
- Initial value. Specified in the real range, not between 0 and 1.
- Defaults to 0.
-
- SLMapPhase values are:
-
- min = 0.0
- max = 1.0
- scale = 'lin'
- name = 'phase'
- res = 'float'
- ramp = 0.025
-
- Methods:
-
- get(x) : Returns scaled value for `x` between 0 and 1.
- set(x) : Returns the normalized value (0 -> 1) for `x` in the real range.
-
- """
- def __init__(self, init=0.):
- SLMap.__init__(self, 0., 1., 'lin', 'phase', init, 'float', 0.025)
-
-class SLMapPan(SLMap):
- """
- SLMap with normalized values for a 'pan' slider.
-
- Parentclass: SLMap
-
- Parameters:
-
- init : int or float, optional
- Initial value. Specified in the real range, not between 0 and 1.
- Defaults to 0.
-
- SLMapPhase values are:
-
- min = 0.0
- max = 1.0
- scale = 'lin'
- name = 'pan'
- res = 'float'
- ramp = 0.025
-
- Methods:
-
- get(x) : Returns scaled value for `x` between 0 and 1.
- set(x) : Returns the normalized value (0 -> 1) for `x` in the real range.
-
- """
- def __init__(self, init=0.):
- SLMap.__init__(self, 0., 1., 'lin', 'pan', init, 'float', 0.025)
-
-class SLMapQ(SLMap):
- """
- SLMap with normalized values for a 'q' slider.
-
- Parentclass: SLMap
-
- Parameters:
-
- init : int or float, optional
- Initial value. Specified in the real range, not between 0 and 1.
- Defaults to 1.
-
- SLMapQ values are:
-
- min = 0.1
- max = 100.0
- scale = 'log'
- name = 'q'
- res = 'float'
- ramp = 0.025
-
- Methods:
-
- get(x) : Returns scaled value for `x` between 0 and 1.
- set(x) : Returns the normalized value (0 -> 1) for `x` in the real range.
-
- """
- def __init__(self, init=1.):
- SLMap.__init__(self, 0.1, 100., 'log', 'q', init, 'float', 0.025)
-
-class SLMapDur(SLMap):
- """
- SLMap with normalized values for a 'dur' slider.
-
- Parentclass: SLMap
-
- Parameters:
-
- init : int or float, optional
- Initial value. Specified in the real range, not between 0 and 1.
- Defaults to 1.
-
- SLMapDur values are:
-
- min = 0.
- max = 60.0
- scale = 'lin'
- name = 'dur'
- res = 'float'
- ramp = 0.025
-
- Methods:
-
- get(x) : Returns scaled value for `x` between 0 and 1.
- set(x) : Returns the normalized value (0 -> 1) for `x` in the real range.
-
- """
- def __init__(self, init=1.):
- SLMap.__init__(self, 0., 60., 'lin', 'dur', init, 'float', 0.025)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/_tkwidgets.py b/build/lib.linux-x86_64-2.7/pyolib/_tkwidgets.py
deleted file mode 100644
index 8057194..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/_tkwidgets.py
+++ /dev/null
@@ -1,409 +0,0 @@
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from types import ListType, FloatType, IntType
-import math, sys, os
-from Tkinter import *
-
-try:
- from PIL import Image, ImageDraw, ImageTk
-except:
- pass
-
-# constants for platform displays with Tk
-if sys.platform == 'linux2':
- Y_OFFSET = 0
- VM_OFFSET = 2
-elif sys.platform == 'win32':
- Y_OFFSET = 3
- VM_OFFSET = 1
-else:
- Y_OFFSET = 4
- VM_OFFSET = 0
-
-######################################################################
-### Multisliders
-######################################################################
-class MultiSlider(Frame):
- def __init__(self, master, init, key, command):
- Frame.__init__(self, master, bd=0, relief=FLAT)
- self._values = init
- self._nchnls = len(init)
- self._key = key
- self._command = command
- self._lines = []
- self._height = 16
- self.canvas = Canvas(self, height=self._height*self._nchnls+1,
- width=225, relief=FLAT, bd=0, bg="#BCBCAA")
- w = self.canvas.winfo_width()
- for i in range(self._nchnls):
- x = int(self._values[i] * w)
- y = self._height * i + Y_OFFSET
- self._lines.append(self.canvas.create_rectangle(0, y, x,
- y+self._height-1, width=0, fill="#121212"))
- self.canvas.bind("<Button-1>", self.clicked)
- self.canvas.bind("<Motion>", self.move)
- self.canvas.bind("<Configure>", self.size)
- self.canvas.grid(sticky=E+W)
- self.columnconfigure(0, weight=1)
- self.grid()
-
- def size(self, event):
- w = self.canvas.winfo_width()
- for i in range(len(self._lines)):
- y = self._height * i + Y_OFFSET
- x = self._values[i] * w
- self.canvas.coords(self._lines[i], 0, y, x, y+self._height-1)
-
- def clicked(self, event):
- self.update(event)
-
- def move(self, event):
- if event.state == 0x0100:
- slide = (event.y - Y_OFFSET) / self._height
- if 0 <= slide < len(self._lines):
- self.update(event)
-
- def update(self, event):
- w = self.canvas.winfo_width()
- slide = (event.y - Y_OFFSET) / self._height
- val = event.x / float(w)
- self._values[slide] = val
- y = self._height * slide + Y_OFFSET
- self.canvas.coords(self._lines[slide], 0, y, event.x, y+self._height-1)
- self._command(self._key, self._values)
-
-######################################################################
-### Control window for PyoObject
-######################################################################
-class Command:
- def __init__(self, func, key):
- self.func = func
- self.key = key
-
- def __call__(self, value):
- self.func(self.key, value)
-
-class PyoObjectControl(Frame):
- def __init__(self, master=None, obj=None, map_list=None):
- Frame.__init__(self, master, bd=1, relief=GROOVE)
- from controls import SigTo
- self.bind('<Destroy>', self._destroy)
- self._obj = obj
- self._map_list = map_list
- self._sliders = []
- self._excluded = []
- self._values = {}
- self._displays = {}
- self._maps = {}
- self._sigs = {}
- for i, m in enumerate(self._map_list):
- key, init = m.name, m.init
- # filters PyoObjects
- if type(init) not in [ListType, FloatType, IntType]:
- self._excluded.append(key)
- else:
- self._maps[key] = m
- # label (param name)
- label = Label(self, height=1, width=10, highlightthickness=0, text=key)
- label.grid(row=i, column=0)
- # create and pack slider
- if type(init) != ListType:
- self._sliders.append(Scale(self, command=Command(self.setval, key),
- orient=HORIZONTAL, relief=GROOVE, from_=0., to=1., showvalue=False,
- resolution=.0001, bd=1, length=225, troughcolor="#BCBCAA", width=12))
- self._sliders[-1].set(m.set(init))
- disp_height = 1
- else:
- self._sliders.append(MultiSlider(self, [m.set(x) for x in init], key, self.setval))
- disp_height = len(init)
- self._sliders[-1].grid(row=i, column=1, sticky=E+W)
- # display of numeric values
- textvar = StringVar(self)
- display = Label(self, height=disp_height, width=10, highlightthickness=0, textvariable=textvar)
- display.grid(row=i, column=2)
- self._displays[key] = textvar
- if type(init) != ListType:
- self._displays[key].set("%.4f" % init)
- else:
- self._displays[key].set("\n".join(["%.4f" % i for i in init]))
- # set obj attribute to PyoObject SigTo
- self._sigs[key] = SigTo(init, .025, init)
- refStream = self._obj.getBaseObjects()[0]._getStream()
- server = self._obj.getBaseObjects()[0].getServer()
- for k in range(len(self._sigs[key].getBaseObjects())):
- curStream = self._sigs[key].getBaseObjects()[k]._getStream()
- server.changeStreamPosition(refStream, curStream)
- setattr(self._obj, key, self._sigs[key])
- # padding
- top = self.winfo_toplevel()
- top.rowconfigure(0, weight=1)
- top.columnconfigure(0, weight=1)
- self.columnconfigure(1, weight=1)
- self.grid(ipadx=5, ipady=5, sticky=E+W)
-
- def _destroy(self, event):
- for m in self._map_list:
- key = m.name
- if key not in self._excluded:
- setattr(self._obj, key, self._values[key])
- del self._sigs[key]
-
- def setval(self, key, x):
- if type(x) != ListType:
- value = self._maps[key].get(float(x))
- self._displays[key].set("%.4f" % value)
- else:
- value = [self._maps[key].get(float(y)) for y in x]
- self._displays[key].set("\n".join(["%.4f" % i for i in value]))
-
- self._values[key] = value
- setattr(self._sigs[key], "value", value)
-
-######################################################################
-### View window for PyoTableObject
-######################################################################
-class ViewTable_withPIL(Frame):
- def __init__(self, master=None, samples=None):
- Frame.__init__(self, master, bd=1, relief=GROOVE)
- self.width = 500
- self.height = 200
- self.half_height = self.height / 2
- self.canvas = Canvas(self, height=self.height, width=self.width, relief=SUNKEN, bd=1, bg="#EFEFEF")
- print Image
- im = Image.new("L", (self.width, self.height), 255)
- draw = ImageDraw.Draw(im)
- draw.line(samples, fill=0, width=1)
- self.img = ImageTk.PhotoImage(im)
- self.canvas.create_image(self.width/2,self.height/2,image=self.img)
- self.canvas.create_line(0, self.half_height+2, self.width, self.half_height+2, fill='grey', dash=(4,2))
- self.canvas.grid()
- self.grid(ipadx=10, ipady=10)
-
-class ViewTable_withoutPIL(Frame):
- def __init__(self, master=None, samples=None):
- Frame.__init__(self, master, bd=1, relief=GROOVE)
- self.width = 500
- self.height = 200
- self.half_height = self.height / 2
- self.canvas = Canvas(self, height=self.height, width=self.width, relief=SUNKEN, bd=1, bg="#EFEFEF")
- self.canvas.create_line(0, self.half_height+Y_OFFSET, self.width, self.half_height+Y_OFFSET, fill='grey', dash=(4,2))
- self.canvas.create_line(*samples)
- self.canvas.grid()
- self.grid(ipadx=10, ipady=10)
-
-######################################################################
-## View window for PyoMatrixObject
-#####################################################################
-class ViewMatrix_withPIL(Frame):
- def __init__(self, master=None, samples=None, size=None):
- Frame.__init__(self, master, bd=1, relief=GROOVE)
- self.canvas = Canvas(self, width=size[0], height=size[1], relief=SUNKEN, bd=1, bg="#EFEFEF")
- im = Image.new("L", size, None)
- im.putdata(samples)
- self.img = ImageTk.PhotoImage(im)
- self.canvas.create_image(size[0]/2+Y_OFFSET,size[1]/2+Y_OFFSET,image=self.img)
- self.canvas.grid()
- self.grid(ipadx=0, ipady=0)
-
-class ViewMatrix_withoutPIL(Frame):
- def __init__(self, master=None, samples=None, size=None):
- Frame.__init__(self, master, bd=1, relief=GROOVE)
- self.width = size[0]
- self.height = size[1]
- self.canvas = Canvas(self, width=self.width, height=self.height, relief=SUNKEN, bd=1, bg="#EFEFEF")
- for i in range(self.width*self.height):
- x = i % self.width
- y = i / self.width
- x1 = x+Y_OFFSET
- y1 = y+Y_OFFSET
- x2 = x+Y_OFFSET+1
- y2 = y+Y_OFFSET+1
- amp = int(samples[i])
- amp = hex(amp).replace('0x', '')
- if len(amp) == 1:
- amp = "0%s" % amp
- amp = "#%s%s%s" % (amp, amp, amp)
- self.canvas.create_line(x1, y1, x2, y2, fill=amp)
- self.canvas.grid()
- self.grid(ipadx=0, ipady=0)
-
-######################################################################
-### Server Object User Interface (Tk)
-######################################################################
-class ServerGUI(Frame):
- def __init__(self, master=None, nchnls=2, startf=None, stopf=None, recstartf=None,
- recstopf=None, ampf=None, started=0, locals=None, shutdown=None, meter=True, timer=True, amp=1.):
- Frame.__init__(self, master, padx=10, pady=10, bd=2, relief=GROOVE)
- self.shutdown = shutdown
- self.locals = locals
- self.meter = meter
- self.timer = timer
- self.nchnls = nchnls
- self.startf = startf
- self.stopf = stopf
- self.recstartf = recstartf
- self.recstopf = recstopf
- self.ampf = ampf
- self.amp = amp
- self._started = False
- self._recstarted = False
- self.B1, self.B2 = 193 - VM_OFFSET, 244 - VM_OFFSET
- self._history = []
- self._histo_count = 0
- self.grid(ipadx=5)
- self.rowconfigure(0, pad=20)
- self.rowconfigure(1, pad=10)
- self.rowconfigure(2, pad=10)
- self.createWidgets()
- if started == 1:
- self.start(True)
-
-
- def createWidgets(self):
- row = 0
- self.startStringVar = StringVar(self)
- self.startStringVar.set('Start')
- self.startButton = Button(self, textvariable=self.startStringVar, command=self.start)
- self.startButton.grid(ipadx=5)
-
- self.recStringVar = StringVar(self)
- self.recStringVar.set('Rec Start')
- self.recButton = Button(self, textvariable=self.recStringVar, command=self.record)
- self.recButton.grid(ipadx=5, row=row, column=1)
-
- self.quitButton = Button(self, text='Quit', command=self.on_quit)
- self.quitButton.grid(ipadx=5, row=row, column=2)
- row += 1
-
- self.ampScale = Scale(self, command=self.setAmp, digits=4, label='Amplitude (dB)',
- orient=HORIZONTAL, relief=GROOVE, from_=-60.0, to=18.0,
- resolution=.01, bd=1, length=250, troughcolor="#BCBCAA", width=10)
- self.ampScale.set(20.0 * math.log10(self.amp))
- self.ampScale.grid(ipadx=5, ipady=5, row=row, column=0, columnspan=3)
- row += 1
-
- if self.meter:
- self.vumeter = Canvas(self, height=5*self.nchnls+1, width=250, relief=FLAT, bd=0, bg="#323232")
- self.green = []
- self.yellow = []
- self.red = []
- for i in range(self.nchnls):
- y = 5 * (i + 1) + 1 - VM_OFFSET
- self.green.append(self.vumeter.create_line(0, y, 1, y, width=4, fill='green', dash=(9,1), dashoff=6+VM_OFFSET))
- self.yellow.append(self.vumeter.create_line(self.B1, y, self.B1, y, width=4, fill='yellow', dash=(9,1), dashoff=9))
- self.red.append(self.vumeter.create_line(self.B2, y, self.B2, y, width=4, fill='red', dash=(9,1), dashoff=0))
- self.vumeter.grid(ipadx=5, row=row, column=0, columnspan=3)
- row += 1
-
- if self.timer:
- self.timer_label = Label(self, text='Elapsed time (h:m:s:ms)')
- self.timer_label.grid(ipadx=0, row=row, column=0, columnspan=3)
- row += 1
- self.timer_strvar = StringVar(self, " 00 : 00 : 00 : 000")
- self.timetext = Label(self, textvariable=self.timer_strvar)
- self.timetext.grid(ipadx=5, row=row, column=0, columnspan=3)
- row += 1
-
- if self.locals != None:
- self.interp_label = Label(self, text='Interpreter')
- self.interp_label.grid(ipadx=0, row=row, column=0, columnspan=3)
- row += 1
- self.text = Text(self, height=1, width=33, bd=1, relief=RIDGE, highlightthickness=0,
- spacing1=2, spacing3=2)
- self.text.grid(ipadx=5, row=row, column=0, columnspan=3)
- self.text.bind("<Return>", self.getText)
- self.text.bind("<Up>", self.getPrev)
- self.text.bind("<Down>", self.getNext)
-
-
- def on_quit(self):
- self.shutdown()
- self.quit()
-
- def getPrev(self, event):
- self.text.delete("1.0", END)
- self._histo_count -= 1
- if self._histo_count < 0:
- self._histo_count = 0
- self.text.insert("1.0", self._history[self._histo_count])
- return "break"
-
- def setTime(self, *args):
- self.timer_strvar.set(" %02d : %02d : %02d : %03d" % (args[0], args[1], args[2], args[3]))
-
- def getNext(self, event):
- self.text.delete("1.0", END)
- self._histo_count += 1
- if self._histo_count >= len(self._history):
- self._histo_count = len(self._history)
- else:
- self.text.insert("1.0", self._history[self._histo_count])
- return "break"
-
- def getText(self, event):
- source = self.text.get("1.0", END)
- self.text.delete("1.0", END)
- exec source in self.locals
- self._history.append(source)
- self._histo_count = len(self._history)
- return "break"
-
- def start(self, justSet=False):
- if self._started == False:
- if not justSet:
- self.startf()
- self._started = True
- self.startStringVar.set('Stop')
- self.quitButton.configure(state = DISABLED)
- else:
- self.stopf()
- self._started = False
- self.startStringVar.set('Start')
- self.quitButton.configure(state = NORMAL)
-
- def record(self):
- if self._recstarted == False:
- self.recstartf()
- self._recstarted = True
- self.recStringVar.set('Rec Stop')
- else:
- self.recstopf()
- self._recstarted = False
- self.recStringVar.set('Rec Start')
-
- def setAmp(self, value):
- self.ampf(math.pow(10.0, float(value) * 0.05))
-
- def setRms(self, *args):
- for i in range(self.nchnls):
- y = 5 * (i + 1) + 1 - VM_OFFSET
- db = math.log10(args[i]+0.00001) * 0.2 + 1.
- amp = int(db*250)
- if amp <= self.B1:
- self.vumeter.coords(self.green[i], 0, y, amp, y)
- self.vumeter.coords(self.yellow[i], self.B1, y, self.B1, y)
- self.vumeter.coords(self.red[i], self.B2, y, self.B2, y)
- elif amp <= self.B2:
- self.vumeter.coords(self.green[i], 0, y, self.B1, y)
- self.vumeter.coords(self.yellow[i], self.B1, y, amp, y)
- self.vumeter.coords(self.red[i], self.B2, y, self.B2, y)
- else:
- self.vumeter.coords(self.green[i], 0, y, self.B1, y)
- self.vumeter.coords(self.yellow[i], self.B1, y, self.B2, y)
- self.vumeter.coords(self.red[i], self.B2, y, amp, y)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/_widgets.py b/build/lib.linux-x86_64-2.7/pyolib/_widgets.py
deleted file mode 100644
index 5f5d413..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/_widgets.py
+++ /dev/null
@@ -1,327 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public Licensehack for OSX display
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from types import ListType, FloatType, IntType
-import math, sys, os, random
-
-try:
- from PIL import Image, ImageDraw, ImageTk
- WITH_PIL = True
-except:
- WITH_PIL = False
-
-try:
- import wxversion
- if (wxversion.checkInstalled("2.8")):
- wxversion.ensureMinimal("2.8")
- import wx
- from _wxwidgets import *
- PYO_USE_WX = True
-except:
- PYO_USE_WX = False
-
-if not PYO_USE_WX:
- try:
- from Tkinter import *
- from _tkwidgets import *
- except:
- if sys.platform == "linux2":
- response = raw_input("""python-tk package is missing! It is needed to use pyo graphical interfaces.
-Do you want to install it? (yes/no): """)
- if response == 'yes':
- os.system('sudo apt-get install python-tk')
- else:
- print "Tkinter is missing! It is needed to use pyo graphical interfaces. Please install it!"
- sys.exit()
-
-X, Y, CURRENT_X, MAX_X, NEXT_Y = 800, 700, 30, 30, 30
-WINDOWS = []
-CTRLWINDOWS = []
-GRAPHWINDOWS = []
-TABLEWINDOWS = []
-SNDTABLEWINDOWS = []
-MATRIXWINDOWS = []
-
-def createRootWindow():
- if not PYO_USE_WX:
- if len(WINDOWS) == 0:
- root = Tk()
- root.withdraw()
- return None
- else:
- return None
- else:
- if wx.GetApp() == None:
- win = wx.PySimpleApp()
- return win
- else:
- return None
-
-def tkCloseWindow(win):
- win.destroy()
- if win in WINDOWS: WINDOWS.remove(win)
-
-def tkCloseWindowFromKeyboard(event):
- win = event.widget
- if not isinstance(win, ServerGUI):
- win.destroy()
- if win in WINDOWS: WINDOWS.remove(win)
-
-def tkCreateToplevelWindow():
- win = Toplevel()
- WINDOWS.append(win)
- win.protocol('WM_DELETE_WINDOW', lambda win=win: tkCloseWindow(win))
- win.bind("<Escape>", tkCloseWindowFromKeyboard)
- return win
-
-def wxCreateDelayedCtrlWindows():
- global CURRENT_X, MAX_X, NEXT_Y
- for win in CTRLWINDOWS:
- f = PyoObjectControl(None, win[0], win[1])
- if win[2] == None: title = win[0].__class__.__name__
- else: title = win[2]
- f.SetTitle(title)
- x, y = f.GetSize()
- if y + NEXT_Y < Y:
- px, py, NEXT_Y = CURRENT_X, NEXT_Y, NEXT_Y + y
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- elif x + MAX_X < X:
- px, py, NEXT_Y, CURRENT_X = MAX_X, 50, 50 + y, MAX_X
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- else:
- f.SetPosition((random.randint(250,500), random.randint(200,400)))
- f.Show()
-
-def wxCreateDelayedGraphWindows():
- global CURRENT_X, MAX_X, NEXT_Y
- for win in GRAPHWINDOWS:
- f = TableGrapher(None, win[0], win[1], win[2], win[3])
- if win[4] == None: title = win[0].__class__.__name__
- else: title = win[4]
- f.SetTitle(title)
- x, y = f.GetSize()
- if y + NEXT_Y < Y:
- px, py, NEXT_Y = CURRENT_X, NEXT_Y, NEXT_Y + y
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- elif x + MAX_X < X:
- px, py, NEXT_Y, CURRENT_X = MAX_X, 50, 50 + y, MAX_X
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- else:
- f.SetPosition((random.randint(250,500), random.randint(200,400)))
- f.Show()
-
-def wxCreateDelayedTableWindows():
- global CURRENT_X, MAX_X, NEXT_Y
- for win in TABLEWINDOWS:
- if WITH_PIL: f = ViewTable_withPIL(None, win[0], win[1])
- else: f = ViewTable_withoutPIL(None, win[0], win[1])
- f.SetTitle(win[2])
- x, y = f.GetSize()
- if y + NEXT_Y < Y:
- px, py, NEXT_Y = CURRENT_X, NEXT_Y, NEXT_Y + y
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- elif x + MAX_X < X:
- px, py, NEXT_Y, CURRENT_X = MAX_X, 50, 50 + y, MAX_X
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- else:
- f.SetPosition((random.randint(250,500), random.randint(200,400)))
- f.Show()
-
-def wxCreateDelayedSndTableWindows():
- global CURRENT_X, MAX_X, NEXT_Y
- for win in SNDTABLEWINDOWS:
- if WITH_PIL: f = SndViewTable_withPIL(None, win[0], win[1], win[3])
- else: f = SndViewTable_withoutPIL(None, win[0], win[1], win[3])
- f.SetTitle(win[2])
- x, y = f.GetSize()
- if y + NEXT_Y < Y:
- px, py, NEXT_Y = CURRENT_X, NEXT_Y, NEXT_Y + y
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- elif x + MAX_X < X:
- px, py, NEXT_Y, CURRENT_X = MAX_X, 50, 50 + y, MAX_X
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- else:
- f.SetPosition((random.randint(250,500), random.randint(200,400)))
- f.Show()
-
-def wxCreateDelayedMatrixWindows():
- global CURRENT_X, MAX_X, NEXT_Y
- for win in MATRIXWINDOWS:
- if WITH_PIL: f = ViewMatrix_withPIL(None, win[0], win[1])
- else: f = ViewMatrix_withoutPIL(None, win[0], win[1])
- f.SetTitle(win[2])
- x, y = f.GetSize()
- if y + NEXT_Y < Y:
- px, py, NEXT_Y = CURRENT_X, NEXT_Y, NEXT_Y + y
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- elif x + MAX_X < X:
- px, py, NEXT_Y, CURRENT_X = MAX_X, 50, 50 + y, MAX_X
- if x + CURRENT_X > MAX_X: MAX_X = x + CURRENT_X
- f.SetPosition((px, py))
- else:
- f.SetPosition((random.randint(250,500), random.randint(200,400)))
- f.Show()
-
-def createCtrlWindow(obj, map_list, title, wxnoserver=False):
- if not PYO_USE_WX:
- createRootWindow()
- win = tkCreateToplevelWindow()
- f = PyoObjectControl(win, obj, map_list)
- win.resizable(True, False)
- if title == None: title = obj.__class__.__name__
- win.title(title)
- else:
- if wxnoserver or wx.GetApp() != None:
- if wx.GetApp() == None:
- root = createRootWindow()
- else:
- root = None
- f = PyoObjectControl(None, obj, map_list)
- if title == None: title = obj.__class__.__name__
- f.SetTitle(title)
- f.Show()
- if root != None:
- root.MainLoop()
- else:
- CTRLWINDOWS.append([obj, map_list, title])
-
-def createGraphWindow(obj, mode, xlen, yrange, title, wxnoserver=False):
- if not PYO_USE_WX:
- print "WxPython must be installed to use the 'graph' method."
- if 0:
- createRootWindow()
- win = tkCreateToplevelWindow()
- f = PyoObjectControl(win, obj, map_list)
- win.resizable(True, False)
- if title == None: title = obj.__class__.__name__
- win.title(title)
- else:
- if wxnoserver or wx.GetApp() != None:
- if wx.GetApp() == None:
- root = createRootWindow()
- else:
- root = None
- f = TableGrapher(None, obj, mode, xlen, yrange)
- if title == None: title = obj.__class__.__name__
- f.SetTitle(title)
- f.Show()
- if root != None:
- root.MainLoop()
- else:
- GRAPHWINDOWS.append([obj, mode, xlen, yrange, title])
-
-def createViewTableWindow(samples, title="Table waveform", wxnoserver=False, tableclass=None):
- if not PYO_USE_WX:
- createRootWindow()
- win = tkCreateToplevelWindow()
- if WITH_PIL: f = ViewTable_withPIL(win, samples)
- else: f = ViewTable_withoutPIL(win, samples)
- win.resizable(False, False)
- win.title(title)
- else:
- if wxnoserver or wx.GetApp() != None:
- if wx.GetApp() == None:
- root = createRootWindow()
- else:
- root = None
- if WITH_PIL: f = ViewTable_withPIL(None, samples, tableclass)
- else: f = ViewTable_withoutPIL(None, samples, tableclass)
- f.Show()
- f.SetTitle(title)
- else:
- TABLEWINDOWS.append([samples, tableclass, title])
-
-def createSndViewTableWindow(obj, title="Table waveform", wxnoserver=False, tableclass=None, mouse_callback=None):
- if not PYO_USE_WX:
- createRootWindow()
- win = tkCreateToplevelWindow()
- if WITH_PIL: f = ViewTable_withPIL(win, obj._base_objs[0].getViewTable())
- else: f = ViewTable_withoutPIL(win, obj._base_objs[0].getViewTable())
- win.resizable(False, False)
- win.title(title)
- else:
- if wxnoserver or wx.GetApp() != None:
- if wx.GetApp() == None:
- root = createRootWindow()
- else:
- root = None
- if WITH_PIL: f = SndViewTable_withPIL(None, obj, tableclass, mouse_callback)
- else: f = SndViewTable_withoutPIL(None, obj, tableclass, mouse_callback)
- f.Show()
- f.SetTitle(title)
- else:
- SNDTABLEWINDOWS.append([obj, tableclass, title, mouse_callback])
-
-def createViewMatrixWindow(samples, size, title="Matrix viewer", wxnoserver=False):
- if not WITH_PIL: print """The Python Imaging Library is not installed.
-It helps a lot to speed up matrix drawing!"""
- if not PYO_USE_WX:
- createRootWindow()
- win = tkCreateToplevelWindow()
- if WITH_PIL: f = ViewMatrix_withPIL(win, samples, size)
- else: f = ViewMatrix_withoutPIL(win, samples, size)
- win.resizable(False, False)
- win.title(title)
- else:
- if wxnoserver or wx.GetApp() != None:
- if wx.GetApp() == None:
- root = createRootWindow()
- else:
- root = None
- if WITH_PIL: f = ViewMatrix_withPIL(None, samples, size)
- else: f = ViewMatrix_withoutPIL(None, samples, size)
- f.Show()
- f.SetTitle(title)
- else:
- MATRIXWINDOWS.append([samples,size,title])
-
-def createServerGUI(nchnls, start, stop, recstart, recstop, setAmp, started, locals, shutdown, meter, timer, amp):
- global X, Y, MAX_X, NEXT_Y
- if not PYO_USE_WX:
- createRootWindow()
- win = tkCreateToplevelWindow()
- f = ServerGUI(win, nchnls, start, stop, recstart, recstop, setAmp, started, locals, shutdown, meter, timer, amp)
- f.master.title("pyo server")
- f.focus_set()
- else:
- win = createRootWindow()
- f = ServerGUI(None, nchnls, start, stop, recstart, recstop, setAmp, started, locals, shutdown, meter, timer, amp)
- f.SetTitle("pyo server")
- f.SetPosition((30, 30))
- f.Show()
- X,Y = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)-50, wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)-50
- MAX_X, NEXT_Y = f.GetSize()[0]+30, f.GetSize()[1]+30
- wx.CallAfter(wxCreateDelayedCtrlWindows)
- wx.CallAfter(wxCreateDelayedGraphWindows)
- wx.CallAfter(wxCreateDelayedTableWindows)
- wx.CallAfter(wxCreateDelayedSndTableWindows)
- wx.CallAfter(wxCreateDelayedMatrixWindows)
- wx.CallAfter(f.Raise)
- return f, win
-
\ No newline at end of file
diff --git a/build/lib.linux-x86_64-2.7/pyolib/_wxwidgets.py b/build/lib.linux-x86_64-2.7/pyolib/_wxwidgets.py
deleted file mode 100644
index 748593f..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/_wxwidgets.py
+++ /dev/null
@@ -1,1698 +0,0 @@
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-import wx, os, sys, math, time
-from types import ListType, FloatType, IntType
-from wx.lib.embeddedimage import PyEmbeddedImage
-
-try:
- from PIL import Image, ImageDraw, ImageTk
-except:
- pass
-
-BACKGROUND_COLOUR = "#EBEBEB"
-
-vu_metre = PyEmbeddedImage(
- "iVBORw0KGgoAAAANSUhEUgAAAMgAAAAFCAIAAACPTDSjAAAAAXNSR0IArs4c6QAAACF0RVh0"
- "U29mdHdhcmUAR3JhcGhpY0NvbnZlcnRlciAoSW50ZWwpd4f6GQAAAMJJREFUeJxiYBgFo4BG"
- "wHWbO1bEKc6JS4pXiddxtTNWKTFLMYspVlilpFyk9WsNsUopR6toF+lglVJP0wDKYpUCmiYX"
- "II9VyqTTFOgSrFI28+0E9YSwSgE9hcfXLNwsZEgBDcQVVkBnAB2DKxi7qg13LHHERIEeMvWF"
- "ulilYoIUM2JUsUoVp2vGKyjsdbDHRH0G+u4SElilZpkYW4uIYJXaaGNtwMDwHxsaTVijCWs0"
- "YY0mrNGENZqwRhMWAAAA//8DAHGDnlocOW36AAAAAElFTkSuQmCC")
-
-vu_metre_dark = PyEmbeddedImage(
- "iVBORw0KGgoAAAANSUhEUgAAAMgAAAAFCAYAAAAALqP0AAAAAXNSR0IArs4c6QAAAAlwSFlz"
- "AAALEgAACxIB0t1+/AAADst0RVh0Q29tbWVudABwclZXIGNodW5rbGVuIDMwMiBpZ25vcmVk"
- "Og1BU0NJSTogeJzt0U1WwjAuwPHpLohUKS5tibG3yM4ude11ei4u4OtdvIE4ky76cOVz+/9l"
- "LuYjaS68f759yKu8nMys6zTPc8rm9Exq1C6nLicuS7UwcS5ljHGMMopEyyQu0S5FJGUuLi4u"
- "Li5Xdb2pd/cuu1pj899y+6ixrTV+lufcktvvLl7p1ut+8C7r9efnUut2Kb/PhOshu5vK9I5l"
- "LtrQtiG0wdmmq3IuT7ffLp1vOt9rLnvfaVjprfSNdo69jvy+P5fPjZbDfunZuSYNSEVYOiA3"
- "ODlDRUREMTRENTZDMjMwMTBDMEYxRTkwNzg4NTQyOTBENkQ4OUIxQjdDOENFMDM3NUVENzU3"
- "QTE5MEZFMEVCNURCQzgxMzg5MzAyRkE3MEU1NzNGQkZGNjUxQUU2MjM2OTE3QkM3RkJFN0RD"
- "OEFCQkM5Q0NDQUNFQjM0Q0Y3M0NBRTZGNDRDNkFENDE4QTcxODI3MTE0QkI1MzA3MTFDNjU4"
- "QzcxOEMzMjhBNDRDQjI0MUFEMTE1NDUyNDY1MDAwMDAwMDAwMA1ta0JGIGNodW5rbGVuIDcy"
- "IGlnbm9yZWQ6DUFTQ0lJOiD63sr+Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u"
- "Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4NSEVYOiBGQURFQ0FGRTAwMDAw"
- "MDA0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDANbWtUUyBjaHVua2xlbiA4ODg2IGlnbm9yZWQ6DUFT"
- "Q0lJOiB4nO1dWXPbSJLG9ozbLd/unph92C5FbGzsU2twLnwuRVHSWC6HpHy9OHjB1rSPLllW"
- "t5fB/76ZWVUgUCiAOChSni6rW0WiUC6+zPwqqyouOnnWup51ensuM2ve+8cpJKHfLobj+cvj"
- "vXBmzl+x5MVRO5zZtjk/PC6EM2/e2++Hs4Y97/XPLyC7dS4uhPRv3j0+vp61uvBrb3fweWZs"
- "LiNjbLwxusbU+C6fLoz386PTLsi5LjkuIccyfobcLuN3uOP9vNc+LmGVuw1IRVg6IDc4OUNF"
- "RDVENTk3M0RCNDg5MkM2RjY4Q0RCMkRERkVFOUU5ODdERDgxNzQ1NkM2Q0VDNTM2QjcwMTM3"
- "QzE0NDU1MUQyNTgwNzg3QTQ3Q0JEMzg3OEMxRDZCNDhGMUU1OTU2Qjc5N0MxRkZCRTk5NTk1"
- "NTIwNTAyODgwMzgyODUyOUUyRUFCNUI0NUEyNTAwN0JFQ0NGQzJBQUIyQTBCM0E3OUQ2QkE5"
- "RTc1N0E3QjE3MzM2QkRFRkJDNzI5MjRBMURGMDg4NkUzDW1rQlMgY2h1bmtsZW4gMTkwIGln"
- "bm9yZWQ6DUFTQ0lJOiB4nF1Oyy6CMC7szd/wLi6DwFHKq2GrLmoub2hswlWTJmaz/27Lw4Nz"
- "mcnMzmZknS4sLj6iTy5wjS71M11FpjEu91QupdGPLmryVqPj9jLag7S0Lb2AoC6DcOgupnV5"
- "t/GlLkdwlG9kLi5sYC72ZC+2ZT7Jdi452C7PXZPXzshBLi6y/C7dqZg2zfS38NzZ2Z5HlS7D"
- "g1R7LjH2SC77UYlsxEgnOopp0YOOnqvexY9w1WEuJ0SZOi6kLl+6Ll+mDUhFWDogNzg5QzVE"
- "NEVDQjBFODIzMDEwRUNDRERGRjAxMzAwODNDMDUxQ0FBQjYxQUIwNjZBMDQ2RjY4NkNDMjU1"
- "OTMyNjY2QjNGRjZFQ0JDMzgzNzM5OUM5Q0NDRTY2NjQ5RDFBMkMxQTNFQTI0RjFENzA4RDFF"
- "RjUzMzVENDVBNjMxMDhGNzU0MDlBNUQxOEYwMjZBRjI1NkEzRTNGNjMyREE4M0I0QjQyREJE"
- "ODBBMDA3ODM3MEU4MERBNjc1NzlCN0YxQTUwMTQ3NzANbWtCVCBjaHVua2xlbiAxMTQ1IGln"
- "bm9yZWQ6DUFTQ0lJOiD6zsr+Ln84xS4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u"
- "Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4ueJztmolt6zAuLl1ILkkhKSSN"
- "pJAukkZSiD82+GM8bEjZsWT4mi4udJDisctDIrXfK6WUUkoppZRSSv3X9/f3/uvra0qF34Oy"
- "LpdM+y7pX1NVn91uN+Xz83P/+vr6c37LdacuVdYtVb5/eXk52GPr9K+t9P/7+/svSnWseg1I"
- "RVg6IEZBQ0VDQUZFMDA3RjM4QzUwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwNzg5Q0VE"
- "OUE4OTZERUIzMDEwMDU1RDQ4MUE0OTIxMjkyNDhEQTQ5MDE0OTI0NjUyDW1rQlQgY2h1bmts"
- "ZW4gMzM5IGlnbm9yZWQ6DUFTQ0lJOiD6zsr+Ln9ViS4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u"
- "Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4ueJzt1uFpg2Au"
- "hlEucS4ucS4ucS4ucS4usbyBLremIf+KLueBQ5tP++tNbM5TkiRJkiRJkiRJkiRJkiRJkiRJ"
- "LtFxLue+70/nOcu1d/e/uk/3b13Xcy7Hc5qmx8/sLv0s99S9dS7LsjxexzAuf76HdO+yY5V9"
- "s2F2rc37PQ1IRVg6IEZBQ0VDQUZFMDA3RjU1ODkwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwNzg5Q0VERDZFMTY5ODM2MDE0ODY1MTA3NzExMTA3NzExMDE3NzExMDA3NzExMTA3DW1r"
- "QlQgY2h1bmtsZW4gMzc5OSBpZ25vcmVkOg1BU0NJSTog+s7K/i5/n3guLi4uLi4uLi4uLi4u"
- "Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u"
- "Lnic7Z2NkS4pLoUuiC5xIC7EiTguLuJELshe6eo+17tnSUDPz/5Yr2pqZ7tpLi4u0IOel5fB"
- "YDAuLi6DwWAwLi4ug8HgP/z69evl58+ff3ziOveq5+JzpawuZfj3wf9R6fmK/jN8//795dOn"
- "T3984jr3Mnz58uXfzy6+ffsNSEVYOiBGQUNFQ0FGRTAwN0Y5Rjc4MDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDc4OUNFRDlEOEQ5MTFDMjkwQzg1MUQ4ODEzNzEyMDBFQzQ4OTM4MTAw"
- "N0UyNDQxQw1ta0JUIGNodW5rbGVuIDI3NDEgaWdub3JlZDoNQVNDSUk6IPrOyv4uf69+Li4u"
- "Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u"
- "Li4uLi4uLi4uLi54nO2djZHbOC5GU0guSSEpJI2kkC6SRlJIbpCbd/PuLkjJWa8u23gzntXq"
- "h6QuLqIukPr5cy6GYS6GYS6GYS6GYXhJvn///tvvx48u/y67J1WOe5fh2fnw4cNvv69fv/6q"
- "99q+Z/1XOaouw/uBvM/i9vCW/rm7to7Vbyd/DUhFWDogRkFDRUNBRkUwMDdGQUY3RTAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA3ODlDRUQ5RDhEOTFEQjM4MEM0NjUzNDgxQTQ5MjEy"
- "OTI0OERBNDkwMTQ5MjQ2NTINbWtCVCBjaHVua2xlbiAxMDc3NSBpZ25vcmVkOg1BU0NJSTog"
- "+s7K/i5/1PAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u"
- "Li4uLi4uLi4uLi4uLi4uLi4uLi4uLnic7X0ruOwo1vaSSCwuicQikUgkLi6JxCIjkVgkLi6J"
- "jYyMjI0smX9R+5zunp7p+dT/1Ihac+k+VXvXLrAu77suVObnfTaeLtqzkS3G10Zgh6PDLnBd"
- "xS5rLt+FfsPzYi7ggS4uLrYuLtCeJMF33ZPZsYTB8c18c/zxQ28NSEVYOiBGQUNFQ0FGRTAw"
- "N0ZENEYwMDAwMDAwMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw"
- "MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDc4OUNFRDdEMkJCOEVDMjhENkY2"
- "OTI0ODJDMTI4OUM0MjI5MTQ4MjQxNjE5ODlDNIWzHPoAAAAhdEVYdFNvZnR3YXJlAEdyYXBo"
- "aWNDb252ZXJ0ZXIgKEludGVsKXeH+hkAAADWSURBVHic7JO7CsJAEEVH95UHpFBEhBUTJIpB"
- "I0GFFDYRBNHSxr/Zn/B/R9c+Ewvt5sLtDswwwwHgcDh06muAVE3Y62TipA+HM80MxgLKoyGZ"
- "kRWw3GmSsbmEealIJi2Ue3Mk4+dMUukopqj1Z2+KqRqDybBPMv4239xRqt8wflbXP/zOfveu"
- "n9VVgLcmam1mJew3hmQWmXJFrklmu9K41to94hjbegoCzKQEirmEIVohSOYeRWiVhud0hm1l"
- "QVgQFoQFYUFYEBaEBWFB/iLICwAA//8DAHqeTXUOgGpTAAAAAElFTkSuQmCC")
-
-def interpFloat(t, v1, v2):
- "interpolator for a single value; interprets t in [0-1] between v1 and v2"
- return (v2-v1)*t + v1
-
-def tFromValue(value, v1, v2):
- "returns a t (in range 0-1) given a value in the range v1 to v2"
- return float(value-v1)/(v2-v1)
-
-def clamp(v, minv, maxv):
- "clamps a value within a range"
- if v<minv: v=minv
- if v> maxv: v=maxv
- return v
-
-def toLog(t, v1, v2):
- return math.log10(t/v1) / math.log10(v2/v1)
-
-def toExp(t, v1, v2):
- return math.pow(10, t * (math.log10(v2) - math.log10(v1)) + math.log10(v1))
-
-POWOFTWO = {2:1, 4:2, 8:3, 16:4, 32:5, 64:6, 128:7, 256:8, 512:9, 1024:10, 2048:11, 4096:12, 8192:13, 16384:14, 32768:15, 65536:16}
-def powOfTwo(x):
- return 2**x
-
-def powOfTwoToInt(x):
- return POWOFTWO[x]
-
-def GetRoundBitmap( w, h, r ):
- maskColor = wx.Color(0,0,0)
- shownColor = wx.Color(5,5,5)
- b = wx.EmptyBitmap(w,h)
- dc = wx.MemoryDC(b)
- dc.SetBrush(wx.Brush(maskColor))
- dc.DrawRectangle(0,0,w,h)
- dc.SetBrush(wx.Brush(shownColor))
- dc.SetPen(wx.Pen(shownColor))
- dc.DrawRoundedRectangle(0,0,w,h,r)
- dc.SelectObject(wx.NullBitmap)
- b.SetMaskColour(maskColor)
- return b
-
-def GetRoundShape( w, h, r ):
- return wx.RegionFromBitmap( GetRoundBitmap(w,h,r) )
-
-class ControlSlider(wx.Panel):
- def __init__(self, parent, minvalue, maxvalue, init=None, pos=(0,0), size=(200,16), log=False, outFunction=None, integer=False, powoftwo=False, backColour=None):
- wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY, pos=pos, size=size, style=wx.NO_BORDER | wx.WANTS_CHARS | wx.EXPAND)
- self.parent = parent
- if backColour:
- self.backgroundColour = backColour
- else:
- self.backgroundColour = BACKGROUND_COLOUR
- self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
- self.SetBackgroundColour(self.backgroundColour)
- self.SetMinSize(self.GetSize())
- self.knobSize = 40
- self.knobHalfSize = 20
- self.sliderHeight = size[1] - 5
- self.outFunction = outFunction
- self.integer = integer
- self.log = log
- self.powoftwo = powoftwo
- if self.powoftwo:
- self.integer = True
- self.log = False
- self.SetRange(minvalue, maxvalue)
- self.borderWidth = 1
- self.selected = False
- self._enable = True
- self.propagate = True
- self.midictl = None
- self.new = ''
- if init != None:
- self.SetValue(init)
- self.init = init
- else:
- self.SetValue(minvalue)
- self.init = minvalue
- self.clampPos()
- self.Bind(wx.EVT_LEFT_DOWN, self.MouseDown)
- self.Bind(wx.EVT_LEFT_UP, self.MouseUp)
- self.Bind(wx.EVT_LEFT_DCLICK, self.DoubleClick)
- self.Bind(wx.EVT_MOTION, self.MouseMotion)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- self.Bind(wx.EVT_SIZE, self.OnResize)
- self.Bind(wx.EVT_KEY_DOWN, self.keyDown)
- self.Bind(wx.EVT_KILL_FOCUS, self.LooseFocus)
- self.createSliderBitmap()
- self.createKnobBitmap()
-
- def setMidiCtl(self, x, propagate=True):
- self.propagate = propagate
- self.midictl = x
- self.Refresh()
-
- def getMidiCtl(self):
- return self.midictl
-
- def getMinValue(self):
- return self.minvalue
-
- def getMaxValue(self):
- return self.maxvalue
-
- def Enable(self):
- self._enable = True
- self.Refresh()
-
- def Disable(self):
- self._enable = False
- self.Refresh()
-
- def setSliderHeight(self, height):
- self.sliderHeight = height
- self.createSliderBitmap()
- self.createKnobBitmap()
- self.Refresh()
-
- def createSliderBitmap(self):
- w, h = self.GetSize()
- b = wx.EmptyBitmap(w,h)
- dc = wx.MemoryDC(b)
- dc.SetPen(wx.Pen(self.backgroundColour, width=1))
- dc.SetBrush(wx.Brush(self.backgroundColour))
- dc.DrawRectangle(0,0,w,h)
- dc.SetBrush(wx.Brush("#999999"))
- dc.SetPen(wx.Pen(self.backgroundColour, width=1))
- h2 = self.sliderHeight / 4
- dc.DrawRoundedRectangle(0,h2,w,self.sliderHeight,2)
- dc.SelectObject(wx.NullBitmap)
- b.SetMaskColour("#999999")
- self.sliderMask = b
-
- def createKnobBitmap(self):
- w, h = self.knobSize, self.GetSize()[1]
- b = wx.EmptyBitmap(w,h)
- dc = wx.MemoryDC(b)
- rec = wx.Rect(0, 0, w, h)
- dc.SetPen(wx.Pen(self.backgroundColour, width=1))
- dc.SetBrush(wx.Brush(self.backgroundColour))
- dc.DrawRectangleRect(rec)
- h2 = self.sliderHeight / 4
- rec = wx.Rect(0, h2, w, self.sliderHeight)
- dc.GradientFillLinear(rec, "#414753", "#99A7CC", wx.BOTTOM)
- dc.SetBrush(wx.Brush("#999999"))
- dc.DrawRoundedRectangle(0,0,w,h,2)
- dc.SelectObject(wx.NullBitmap)
- b.SetMaskColour("#999999")
- self.knobMask = b
-
- def getInit(self):
- return self.init
-
- def SetRange(self, minvalue, maxvalue):
- self.minvalue = minvalue
- self.maxvalue = maxvalue
-
- def getRange(self):
- return [self.minvalue, self.maxvalue]
-
- def scale(self):
- inter = tFromValue(self.pos, self.knobHalfSize, self.GetSize()[0]-self.knobHalfSize)
- if not self.integer:
- return interpFloat(inter, self.minvalue, self.maxvalue)
- elif self.powoftwo:
- return powOfTwo(int(interpFloat(inter, self.minvalue, self.maxvalue)))
- else:
- return int(interpFloat(inter, self.minvalue, self.maxvalue))
-
- def SetValue(self, value, propagate=True):
- self.propagate = propagate
- if self.HasCapture():
- self.ReleaseMouse()
- if self.powoftwo:
- value = powOfTwoToInt(value)
- value = clamp(value, self.minvalue, self.maxvalue)
- if self.log:
- t = toLog(value, self.minvalue, self.maxvalue)
- self.value = interpFloat(t, self.minvalue, self.maxvalue)
- else:
- t = tFromValue(value, self.minvalue, self.maxvalue)
- self.value = interpFloat(t, self.minvalue, self.maxvalue)
- if self.integer:
- self.value = int(self.value)
- if self.powoftwo:
- self.value = powOfTwo(self.value)
- self.clampPos()
- self.selected = False
- self.Refresh()
-
- def GetValue(self):
- if self.log:
- t = tFromValue(self.value, self.minvalue, self.maxvalue)
- val = toExp(t, self.minvalue, self.maxvalue)
- else:
- val = self.value
- if self.integer:
- val = int(val)
- return val
-
- def LooseFocus(self, event):
- self.selected = False
- self.Refresh()
-
- def keyDown(self, event):
- if self.selected:
- char = ''
- if event.GetKeyCode() in range(324, 334):
- char = str(event.GetKeyCode() - 324)
- elif event.GetKeyCode() == 390:
- char = '-'
- elif event.GetKeyCode() == 391:
- char = '.'
- elif event.GetKeyCode() == wx.WXK_BACK:
- if self.new != '':
- self.new = self.new[0:-1]
- elif event.GetKeyCode() < 256:
- char = chr(event.GetKeyCode())
- if char in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '-']:
- self.new += char
- elif event.GetKeyCode() in [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]:
- self.SetValue(eval(self.new))
- self.new = ''
- self.selected = False
- self.Refresh()
- event.Skip()
-
- def MouseDown(self, evt):
- if evt.ShiftDown():
- self.DoubleClick(evt)
- return
- if self._enable:
- size = self.GetSize()
- self.pos = clamp(evt.GetPosition()[0], self.knobHalfSize, size[0]-self.knobHalfSize)
- self.value = self.scale()
- self.CaptureMouse()
- self.selected = False
- self.Refresh()
- evt.Skip()
-
- def MouseUp(self, evt):
- if self.HasCapture():
- self.ReleaseMouse()
-
- def DoubleClick(self, event):
- if self._enable:
- w, h = self.GetSize()
- pos = event.GetPosition()
- if wx.Rect(self.pos-self.knobHalfSize, 0, self.knobSize, h).Contains(pos):
- self.selected = True
- self.Refresh()
- event.Skip()
-
- def MouseMotion(self, evt):
- if self._enable:
- size = self.GetSize()
- if self.HasCapture():
- self.pos = clamp(evt.GetPosition()[0], self.knobHalfSize, size[0]-self.knobHalfSize)
- self.value = self.scale()
- self.selected = False
- self.Refresh()
-
- def OnResize(self, evt):
- self.createSliderBitmap()
- self.clampPos()
- self.Refresh()
-
- def clampPos(self):
- size = self.GetSize()
- if self.powoftwo:
- val = powOfTwoToInt(self.value)
- else:
- val = self.value
- self.pos = tFromValue(val, self.minvalue, self.maxvalue) * (size[0] - self.knobSize) + self.knobHalfSize
- self.pos = clamp(self.pos, self.knobHalfSize, size[0]-self.knobHalfSize)
-
- def setBackgroundColour(self, colour):
- self.backgroundColour = colour
- self.SetBackgroundColour(self.backgroundColour)
- self.createSliderBitmap()
- self.createKnobBitmap()
- self.Refresh()
-
- def OnPaint(self, evt):
- w,h = self.GetSize()
- dc = wx.AutoBufferedPaintDC(self)
-
- dc.SetBrush(wx.Brush(self.backgroundColour, wx.SOLID))
- dc.Clear()
-
- # Draw background
- dc.SetPen(wx.Pen(self.backgroundColour, width=self.borderWidth, style=wx.SOLID))
- dc.DrawRectangle(0, 0, w, h)
-
- # Draw inner part
- if self._enable: sliderColour = "#99A7CC"
- else: sliderColour = "#BBBBBB"
- h2 = self.sliderHeight / 4
- rec = wx.Rect(0, h2, w, self.sliderHeight)
- dc.GradientFillLinear(rec, "#646986", sliderColour, wx.BOTTOM)
- dc.DrawBitmap(self.sliderMask, 0, 0, True)
-
- if self.midictl != None:
- if sys.platform in ['win32', 'linux2']:
- dc.SetFont(wx.Font(6, wx.ROMAN, wx.NORMAL, wx.NORMAL))
- else:
- dc.SetFont(wx.Font(9, wx.ROMAN, wx.NORMAL, wx.NORMAL))
- dc.SetTextForeground('#FFFFFF')
- dc.DrawLabel(str(self.midictl), wx.Rect(2,0,h,h), wx.ALIGN_CENTER)
- dc.DrawLabel(str(self.midictl), wx.Rect(w-h,0,h,h), wx.ALIGN_CENTER)
-
- # Draw knob
- if self._enable: knobColour = '#888888'
- else: knobColour = "#DDDDDD"
- rec = wx.Rect(self.pos-self.knobHalfSize, 0, self.knobSize, h)
- dc.GradientFillLinear(rec, "#424864", knobColour, wx.RIGHT)
- dc.DrawBitmap(self.knobMask, rec[0], rec[1], True)
-
- if self.selected:
- rec2 = wx.Rect(self.pos-self.knobHalfSize, 0, self.knobSize, h)
- dc.SetBrush(wx.Brush('#333333', wx.SOLID))
- dc.SetPen(wx.Pen('#333333', width=self.borderWidth, style=wx.SOLID))
- dc.DrawRoundedRectangleRect(rec2, 3)
-
- if sys.platform in ['win32', 'linux2']:
- dc.SetFont(wx.Font(7, wx.ROMAN, wx.NORMAL, wx.NORMAL))
- else:
- dc.SetFont(wx.Font(10, wx.ROMAN, wx.NORMAL, wx.NORMAL))
-
- # Draw text
- if self.selected and self.new:
- val = self.new
- else:
- if self.integer:
- val = '%d' % self.GetValue()
- elif abs(self.GetValue()) >= 10000:
- val = '%.1f' % self.GetValue()
- elif abs(self.GetValue()) >= 1000:
- val = '%.2f' % self.GetValue()
- elif abs(self.GetValue()) >= 100:
- val = '%.3f' % self.GetValue()
- elif abs(self.GetValue()) < 100:
- val = '%.4f' % self.GetValue()
- if sys.platform == 'linux2':
- width = len(val) * (dc.GetCharWidth() - 3)
- else:
- width = len(val) * dc.GetCharWidth()
- dc.SetTextForeground('#FFFFFF')
- dc.DrawLabel(val, rec, wx.ALIGN_CENTER)
-
- # Send value
- if self.outFunction and self.propagate:
- self.outFunction(self.GetValue())
- self.propagate = True
-
- evt.Skip()
-
-class MultiSlider(wx.Panel):
- def __init__(self, parent, init, key, command, slmap):
- wx.Panel.__init__(self, parent, size=(250,250))
- self.backgroundColour = BACKGROUND_COLOUR
- self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
- self.SetBackgroundColour(self.backgroundColour)
- self.Bind(wx.EVT_SIZE, self.OnResize)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- self.Bind(wx.EVT_LEFT_DOWN, self.MouseDown)
- self.Bind(wx.EVT_LEFT_UP, self.MouseUp)
- self.Bind(wx.EVT_MOTION, self.MouseMotion)
- self._slmap = slmap
- self._values = [slmap.set(x) for x in init]
- self._nchnls = len(init)
- self._labels = init
- self._key = key
- self._command = command
- self._height = 16
- if sys.platform in ['win32', 'linux2']:
- self._font = wx.Font(7, wx.ROMAN, wx.NORMAL, wx.NORMAL)
- else:
- self._font = wx.Font(10, wx.ROMAN, wx.NORMAL, wx.NORMAL)
-
- self.SetSize((250, self._nchnls*16))
- self.SetMinSize((250,self._nchnls*16))
-
- def OnResize(self, event):
- self.Layout()
- self.Refresh()
-
- def OnPaint(self, event):
- w,h = self.GetSize()
- dc = wx.AutoBufferedPaintDC(self)
- dc.SetBrush(wx.Brush(self.backgroundColour))
- dc.Clear()
- dc.DrawRectangle(0,0,w,h)
- dc.SetBrush(wx.Brush("#000000"))
- dc.SetFont(self._font)
- dc.SetTextForeground('#999999')
- for i in range(self._nchnls):
- x = int(self._values[i] * w)
- y = self._height * i
- dc.DrawRectangle(0, y+1, x, self._height-2)
- rec = wx.Rect(w/2-15, y, 30, self._height)
- dc.DrawLabel("%s" % self._labels[i], rec, wx.ALIGN_CENTER)
-
- def MouseDown(self, evt):
- w,h = self.GetSize()
- pos = evt.GetPosition()
- slide = pos[1] / self._height
- if 0 <= slide < self._nchnls:
- self._values[slide] = pos[0] / float(w)
- self._labels = [self._slmap.get(x) for x in self._values]
- self._command(self._key, self._labels)
- self.CaptureMouse()
- self.Refresh()
- evt.Skip()
-
- def MouseUp(self, evt):
- if self.HasCapture():
- self.ReleaseMouse()
-
- def MouseMotion(self, evt):
- w,h = self.GetSize()
- pos = evt.GetPosition()
- if evt.Dragging() and evt.LeftIsDown():
- slide = pos[1] / self._height
- if 0 <= slide < self._nchnls:
- self._values[slide] = pos[0] / float(w)
- self._labels = [self._slmap.get(x) for x in self._values]
- self._command(self._key, self._labels)
- self.Refresh()
-
-class VuMeter(wx.Panel):
- def __init__(self, parent, size=(200,11), numSliders=2):
- wx.Panel.__init__(self, parent, -1, size=size)
- self.parent = parent
- self.SetBackgroundColour("#000000")
- self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
- self.old_nchnls = numSliders
- self.numSliders = numSliders
- self.SetMinSize((200,5*self.numSliders+1))
- self.SetSize((200, 5*self.numSliders+1))
- self.bitmap = vu_metre.GetBitmap()
- self.backBitmap = vu_metre_dark.GetBitmap()
- self.amplitude = [0] * self.numSliders
-
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- self.Bind(wx.EVT_CLOSE, self.OnClose)
-
- def setNumSliders(self, numSliders):
- oldChnls = self.old_nchnls
- self.numSliders = numSliders
- self.amplitude = [0] * self.numSliders
- gap = (self.numSliders - oldChnls) * 5
- parentSize = self.parent.GetSize()
- if sys.platform == 'linux2':
- self.SetSize((200, 5*self.numSliders+1))
- self.SetMinSize((200, 5*self.numSliders+1))
- self.parent.SetSize((parentSize[0], parentSize[1]+gap))
- self.parent.SetMinSize((parentSize[0], parentSize[1]+gap))
- else:
- self.SetSize((200, 5*self.numSliders+1))
- self.SetMinSize((200, 5*self.numSliders+1))
- self.parent.SetSize((parentSize[0], parentSize[1]+gap))
- self.parent.SetMinSize((parentSize[0], parentSize[1]+gap))
- self.Refresh()
- self.parent.Layout()
-
- def setRms(self, *args):
- if args[0] < 0:
- return
- if not args:
- self.amplitude = [0 for i in range(self.numSliders)]
- else:
- self.amplitude = args
- wx.CallAfter(self.Refresh)
-
- def OnPaint(self, event):
- w,h = self.GetSize()
- dc = wx.AutoBufferedPaintDC(self)
- dc.SetBrush(wx.Brush("#000000"))
- dc.Clear()
- dc.DrawRectangle(0,0,w,h)
- for i in range(self.numSliders):
- db = math.log10(self.amplitude[i]+0.00001) * 0.2 + 1.
- width = int(db*w)
- dc.DrawBitmap(self.backBitmap, 0, i*5)
- dc.SetClippingRegion(0, i*5, width, 5)
- dc.DrawBitmap(self.bitmap, 0, i*5)
- dc.DestroyClippingRegion()
- event.Skip()
-
- def OnClose(self, evt):
- self.Destroy()
-
-######################################################################
-### Control window for PyoObject
-######################################################################
-class Command:
- def __init__(self, func, key):
- self.func = func
- self.key = key
-
- def __call__(self, value):
- self.func(self.key, value)
-
-class PyoObjectControl(wx.Frame):
- def __init__(self, parent=None, obj=None, map_list=None):
- wx.Frame.__init__(self, parent)
- from controls import SigTo
- self.menubar = wx.MenuBar()
- self.fileMenu = wx.Menu()
- self.fileMenu.Append(-1, 'Close\tCtrl+W', kind=wx.ITEM_NORMAL)
- self.fileMenu.Bind(wx.EVT_MENU, self._destroy)
- self.menubar.Append(self.fileMenu, "&File")
- self.SetMenuBar(self.menubar)
- self.Bind(wx.EVT_CLOSE, self._destroy)
- self._obj = obj
- self._map_list = map_list
- self._sliders = []
- self._excluded = []
- self._values = {}
- self._displays = {}
- self._maps = {}
- self._sigs = {}
-
- panel = wx.Panel(self)
- panel.SetBackgroundColour(BACKGROUND_COLOUR)
- mainBox = wx.BoxSizer(wx.VERTICAL)
- self.box = wx.FlexGridSizer(10,2,5,5)
-
- for i, m in enumerate(self._map_list):
- key, init, mini, maxi, scl, res = m.name, m.init, m.min, m.max, m.scale, m.res
- # filters PyoObjects
- if type(init) not in [ListType, FloatType, IntType]:
- self._excluded.append(key)
- else:
- self._maps[key] = m
- # label (param name)
- label = wx.StaticText(panel, -1, key)
- # create and pack slider
- if type(init) != ListType:
- if scl == 'log': scl = True
- else: scl = False
- if res == 'int': res = True
- else: res = False
- self._sliders.append(ControlSlider(panel, mini, maxi, init, log=scl, size=(225,16),
- outFunction=Command(self.setval, key), integer=res))
- self.box.AddMany([(label, 0, wx.LEFT, 5), (self._sliders[-1], 1, wx.EXPAND | wx.LEFT, 5)])
- else:
- self._sliders.append(MultiSlider(panel, init, key, self.setval, m))
- self.box.AddMany([(label, 0, wx.LEFT, 5), (self._sliders[-1], 1, wx.EXPAND | wx.LEFT, 5)])
- # set obj attribute to PyoObject SigTo
- self._values[key] = init
- self._sigs[key] = SigTo(init, .025, init)
- refStream = self._obj.getBaseObjects()[0]._getStream()
- server = self._obj.getBaseObjects()[0].getServer()
- for k in range(len(self._sigs[key].getBaseObjects())):
- curStream = self._sigs[key].getBaseObjects()[k]._getStream()
- server.changeStreamPosition(refStream, curStream)
- setattr(self._obj, key, self._sigs[key])
- self.box.AddGrowableCol(1, 1)
- mainBox.Add(self.box, 1, wx.EXPAND | wx.TOP | wx.BOTTOM | wx.RIGHT, 10)
-
- if sys.platform == "linux2":
- Y_OFF = 15
- elif sys.platform == "win32":
- Y_OFF = 55
- else:
- Y_OFF = 20
- panel.SetSizerAndFit(mainBox)
- x,y = panel.GetSize()
- self.SetSize((-1, y+Y_OFF))
- self.SetMinSize((-1, y+Y_OFF))
- self.SetMaxSize((-1, y+Y_OFF))
-
- def _destroy(self, event):
- for m in self._map_list:
- key = m.name
- if key not in self._excluded:
- setattr(self._obj, key, self._values[key])
- del self._sigs[key]
- self.Destroy()
-
- def setval(self, key, x):
- self._values[key] = x
- setattr(self._sigs[key], "value", x)
-
-######################################################################
-### View window for PyoTableObject
-######################################################################
-class ViewTable_withPIL(wx.Frame):
- def __init__(self, parent, samples=None, tableclass=None):
- wx.Frame.__init__(self, parent)
- self.menubar = wx.MenuBar()
- self.fileMenu = wx.Menu()
- self.fileMenu.Append(-1, 'Close\tCtrl+W', kind=wx.ITEM_NORMAL)
- self.fileMenu.Bind(wx.EVT_MENU, self._destroy)
- self.menubar.Append(self.fileMenu, "&File")
- self.SetMenuBar(self.menubar)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- self.width = 500
- self.height = 200
- self.half_height = self.height / 2
- if sys.platform == "linux2":
- Y_OFF = 25
- elif sys.platform == "win32":
- Y_OFF = 55
- else:
- Y_OFF = 30
- self.SetSize((self.width+10, self.height+Y_OFF))
- self.SetMinSize((self.width+10, self.height+Y_OFF))
- self.SetMaxSize((self.width+10, self.height+Y_OFF))
- im = Image.new("L", (self.width, self.height), 255)
- draw = ImageDraw.Draw(im)
- draw.line(samples, fill=0, width=1)
- image = wx.EmptyImage(self.width, self.height)
- image.SetData(im.convert("RGB").tostring())
- self.img = wx.BitmapFromImage(image)
-
- def _destroy(self, evt):
- self.Destroy()
-
- def OnPaint(self, evt):
- dc = wx.PaintDC(self)
- dc.DrawBitmap(self.img, 0, 0)
- dc.SetPen(wx.Pen('#BBBBBB', width=1, style=wx.SOLID))
- dc.DrawLine(0, self.half_height+1, self.width, self.half_height+1)
-
-class ViewTable_withoutPIL(wx.Frame):
- def __init__(self, parent, samples=None, tableclass=None):
- wx.Frame.__init__(self, parent)
- self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
- self.menubar = wx.MenuBar()
- self.fileMenu = wx.Menu()
- self.fileMenu.Append(-1, 'Close\tCtrl+W', kind=wx.ITEM_NORMAL)
- self.fileMenu.Bind(wx.EVT_MENU, self._destroy)
- self.menubar.Append(self.fileMenu, "&File")
- self.SetMenuBar(self.menubar)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- self.width = 500
- self.height = 200
- self.half_height = self.height / 2
- if sys.platform == "linux2":
- Y_OFF = 35
- else:
- Y_OFF = 40
- self.SetSize((self.width+10, self.height+Y_OFF))
- self.SetMinSize((self.width+10, self.height+Y_OFF))
- self.SetMaxSize((self.width+10, self.height+Y_OFF))
- self.tableclass = tableclass
- if sys.platform == 'win32':
- if tableclass == 'SndTable':
- self.samples = [(samples[i], samples[i+1], samples[i+2], samples[i+3]) for i in range(0, len(samples), 4)]
- else:
- self.samples = [(samples[i], samples[i+1]) for i in range(0, len(samples), 2)]
- else:
- self.samples = [(samples[i], samples[i+1], samples[i+2], samples[i+3]) for i in range(0, len(samples), 4)]
-
- def _destroy(self, evt):
- self.Destroy()
-
- def OnPaint(self, evt):
- w,h = self.GetSize()
- dc = wx.AutoBufferedPaintDC(self)
- dc.SetBrush(wx.Brush("#FFFFFF"))
- dc.Clear()
- dc.DrawRectangle(0,0,w,h)
- if sys.platform == 'win32':
- if self.tableclass == 'SndTable':
- dc.DrawLineList(self.samples)
- else:
- dc.DrawPointList(self.samples)
- else:
- dc.DrawLineList(self.samples)
- dc.SetPen(wx.Pen('#BBBBBB', width=1, style=wx.SOLID))
- dc.DrawLine(0, self.half_height+1, self.width, self.half_height+1)
-
-class SndViewTable(wx.Frame):
- def __init__(self, parent, obj=None, tableclass=None, mouse_callback=None):
- wx.Frame.__init__(self, parent, size=(500,250))
- self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
- self.menubar = wx.MenuBar()
- self.fileMenu = wx.Menu()
- self.fileMenu.Append(-1, 'Close\tCtrl+W', kind=wx.ITEM_NORMAL)
- self.fileMenu.Bind(wx.EVT_MENU, self._destroy)
- self.menubar.Append(self.fileMenu, "&File")
- self.SetMenuBar(self.menubar)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- self.Bind(wx.EVT_SIZE, self.OnSize)
- self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
- self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
- self.Bind(wx.EVT_MOTION, self.OnMotion)
- self.obj = obj
- self.chnls = len(self.obj)
- self.mouse_callback = mouse_callback
-
- def _destroy(self, evt):
- self.Destroy()
-
- def OnSize(self, evt):
- self.setImage()
- self.Refresh()
-
- def clipPos(self, pos):
- if pos[0] < 0.0: x = 0.0
- elif pos[0] > 1.0: x = 1.0
- else: x = pos[0]
- if pos[1] < 0.0: y = 0.0
- elif pos[1] > 1.0: y = 1.0
- else: y = pos[1]
- return (x, y)
-
- def OnMouseDown(self, evt):
- size = self.GetSize()
- pos = evt.GetPosition()
- if pos[1] <= 0:
- pos = (float(pos[0])/size[0], 1.0)
- else:
- pos = (float(pos[0])/size[0], 1.-(float(pos[1])/size[1]))
- pos = self.clipPos(pos)
- if self.mouse_callback != None:
- self.mouse_callback(pos)
- self.CaptureMouse()
-
- def OnMotion(self, evt):
- if self.HasCapture():
- size = self.GetSize()
- pos = evt.GetPosition()
- if pos[1] <= 0:
- pos = (float(pos[0])/size[0], 1.0)
- else:
- pos = (float(pos[0])/size[0], 1.-(float(pos[1])/size[1]))
- pos = self.clipPos(pos)
- if self.mouse_callback != None:
- self.mouse_callback(pos)
-
- def OnMouseUp(self, evt):
- if self.HasCapture():
- self.ReleaseMouse()
-
-class SndViewTable_withPIL(SndViewTable):
- def __init__(self, parent, obj=None, tableclass=None, mouse_callback=None):
- SndViewTable.__init__(self, parent, obj, tableclass, mouse_callback)
- self.setImage()
-
- def setImage(self):
- w, h = self.GetSize()
- self.img = []
- imgHeight = h/self.chnls
- for i in range(self.chnls):
- im = Image.new("L", (w, imgHeight), 255)
- draw = ImageDraw.Draw(im)
- samples = self.obj._base_objs[i].getViewTable((w, imgHeight))
- draw.line(samples, fill=0, width=1)
- image = wx.EmptyImage(w, imgHeight)
- image.SetData(im.convert("RGB").tostring())
- self.img.append(wx.BitmapFromImage(image))
-
- def OnPaint(self, evt):
- w, h = self.GetSize()
- dc = wx.AutoBufferedPaintDC(self)
- dc.SetPen(wx.Pen('#444444', width=1, style=wx.SHORT_DASH))
- off = h/self.chnls/2
- for i, img in enumerate(self.img):
- y = h/self.chnls*i
- dc.DrawBitmap(img, 0, y)
- dc.DrawLine(0, y+off, w, y+off)
-
-class SndViewTable_withoutPIL(SndViewTable):
- def __init__(self, parent, obj=None, tableclass=None, mouse_callback=None):
- SndViewTable.__init__(self, parent, obj, tableclass, mouse_callback)
- self.tableclass = tableclass
- self.setImage()
-
- def setImage(self):
- w, h = self.GetSize()
- self.img = []
- imgHeight = h/self.chnls
- for j in range(self.chnls):
- off = h/self.chnls*j
- samples = self.obj._base_objs[j].getViewTable((w, imgHeight))
- if sys.platform == 'win32':
- if tableclass == 'SndTable':
- samples = [(samples[i], samples[i+1]+off, samples[i+2], samples[i+3]+off) for i in range(0, len(samples), 4)]
- else:
- samples = [(samples[i], samples[i+1]+off) for i in range(0, len(samples), 2)]
- else:
- samples = [(samples[i], samples[i+1]+off, samples[i+2], samples[i+3]+off) for i in range(0, len(samples), 4)]
- self.img.append(samples)
-
- def OnPaint(self, evt):
- w,h = self.GetSize()
- dc = wx.AutoBufferedPaintDC(self)
- dc.SetBrush(wx.Brush("#FFFFFF"))
- dc.Clear()
- dc.DrawRectangle(0,0,w,h)
- off = h/self.chnls/2
- for i, samples in enumerate(self.img):
- dc.SetPen(wx.Pen('#000000', width=1, style=wx.SOLID))
- y = h/self.chnls*i
- if sys.platform == 'win32':
- if self.tableclass == 'SndTable':
- dc.DrawLineList(samples)
- else:
- dc.DrawPointList(samples)
- else:
- dc.DrawLineList(samples)
- dc.SetPen(wx.Pen('#444444', width=1, style=wx.SHORT_DASH))
- dc.DrawLine(0, y+off, w, y+off)
-
-######################################################################
-## View window for PyoMatrixObject
-#####################################################################
-class ViewMatrix_withPIL(wx.Frame):
- def __init__(self, parent, samples=None, size=None):
- wx.Frame.__init__(self, parent)
- self.menubar = wx.MenuBar()
- self.fileMenu = wx.Menu()
- self.fileMenu.Append(-1, 'Close\tCtrl+W', kind=wx.ITEM_NORMAL)
- self.fileMenu.Bind(wx.EVT_MENU, self._destroy)
- self.menubar.Append(self.fileMenu, "&File")
- self.SetMenuBar(self.menubar)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- if sys.platform == "linux2":
- Y_OFF = 0
- elif sys.platform == "win32":
- Y_OFF = 45
- else:
- Y_OFF = 22
- self.SetSize((size[0], size[1]+Y_OFF))
- self.SetMinSize((size[0], size[1]+Y_OFF))
- self.SetMaxSize((size[0], size[1]+Y_OFF))
- im = Image.new("L", size, None)
- im.putdata(samples)
- image = wx.EmptyImage(size[0], size[1])
- image.SetData(im.convert("RGB").tostring())
- self.img = wx.BitmapFromImage(image)
-
- def _destroy(self, evt):
- self.Destroy()
-
- def OnPaint(self, evt):
- dc = wx.PaintDC(self)
- dc.DrawBitmap(self.img, 0, 0)
-
-class ViewMatrix_withoutPIL(wx.Frame):
- def __init__(self, parent, samples=None, size=None):
- wx.Frame.__init__(self, parent)
- self.menubar = wx.MenuBar()
- self.fileMenu = wx.Menu()
- self.fileMenu.Append(-1, 'Close\tCtrl+W', kind=wx.ITEM_NORMAL)
- self.fileMenu.Bind(wx.EVT_MENU, self._destroy)
- self.menubar.Append(self.fileMenu, "&File")
- self.SetMenuBar(self.menubar)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- if sys.platform == "linux2":
- Y_OFF = 0
- else:
- Y_OFF = 22
- self.SetSize((size[0], size[1]+Y_OFF))
- self.SetMinSize((size[0], size[1]+Y_OFF))
- self.SetMaxSize((size[0], size[1]+Y_OFF))
- self.width = size[0]
- self.height = size[1]
- self.samples = samples
-
- def _destroy(self, evt):
- self.Destroy()
-
- def OnPaint(self, evt):
- dc = wx.PaintDC(self)
- for i in range(self.width*self.height):
- x = i % self.width
- y = i / self.width
- amp = int(self.samples[i])
- amp = hex(amp).replace('0x', '')
- if len(amp) == 1:
- amp = "0%s" % amp
- amp = "#%s%s%s" % (amp, amp, amp)
- dc.SetPen(wx.Pen(amp, width=1, style=wx.SOLID))
- dc.DrawPoint(x, y)
-
-######################################################################
-## Grapher window for PyoTableObject control
-######################################################################
-OFF = 15
-OFF2 = OFF*2
-RAD = 3
-RAD2 = RAD*2
-AREA = RAD+2
-AREA2 = AREA*2
-class Grapher(wx.Panel):
- def __init__(self, parent, xlen=8192, yrange=(0.0, 1.0), init=[(0.0,0.0),(1.0,1.0)], mode=0,
- exp=10.0, inverse=True, tension=0.0, bias=0.0, outFunction=None):
- wx.Panel.__init__(self, parent, size=(500,250), style=wx.SUNKEN_BORDER)
- self.backgroundColour = BACKGROUND_COLOUR
- self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
- self.SetBackgroundColour(self.backgroundColour)
- self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- self.Bind(wx.EVT_LEFT_DOWN, self.MouseDown)
- self.Bind(wx.EVT_LEFT_UP, self.MouseUp)
- self.Bind(wx.EVT_MOTION, self.MouseMotion)
- self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
- self.Bind(wx.EVT_SIZE, self.OnResize)
-
- self.mode = mode
- self.exp = exp
- self.inverse = inverse
- self.tension = tension
- self.bias = bias
- self.pos = (OFF+RAD,OFF+RAD)
- self.selected = None
- self.xlen = xlen
- self.yrange = yrange
- self.init = [tup for tup in init]
- self.points = init
- self.outFunction = outFunction
-
- self.SetFocus()
-
- def setInitPoints(self, pts):
- self.init = [(p[0],p[1]) for p in pts]
- self.points = [(p[0],p[1]) for p in pts]
- self.selected = None
- self.Refresh()
-
- def pointToPixels(self, pt):
- w,h = self.GetSize()
- w,h = w-OFF2-RAD2, h-OFF2-RAD2
- x = int(round(pt[0] * w)) + OFF + RAD
- y = int(round(pt[1] * h)) + OFF + RAD
- return x, y
-
- def pixelsToPoint(self, pos):
- w,h = self.GetSize()
- w,h = w-OFF2-RAD2, h-OFF2-RAD2
- x = (pos[0] - OFF - RAD) / float(w)
- y = (pos[1] - OFF - RAD) / float(h)
- return x, y
-
- def pointToValues(self, pt):
- x = pt[0] * self.xlen
- if type(self.xlen) == IntType:
- x = int(x)
- y = pt[1] * (self.yrange[1]-self.yrange[0]) + self.yrange[0]
- return x, y
-
- def borderClip(self, pos):
- w,h = self.GetSize()
- if pos[0] < (OFF+RAD): pos[0] = (OFF+RAD)
- elif pos[0] > (w-OFF-RAD): pos[0] = w-OFF-RAD
- if pos[1] < (OFF+RAD): pos[1] = (OFF+RAD)
- elif pos[1] > (h-OFF-RAD): pos[1] = h-OFF-RAD
- return pos
-
- def pointClip(self, pos):
- w,h = self.GetSize()
- if self.selected == 0:
- leftclip = OFF+RAD
- else:
- x,y = self.pointToPixels(self.points[self.selected-1])
- leftclip = x
- if self.selected == (len(self.points) - 1):
- rightclip = w-OFF-RAD
- else:
- x,y = self.pointToPixels(self.points[self.selected+1])
- rightclip = x
-
- if pos[0] < leftclip: pos[0] = leftclip
- elif pos[0] > rightclip: pos[0] = rightclip
- if pos[1] < (OFF+RAD): pos[1] = (OFF+RAD)
- elif pos[1] > (h-OFF-RAD): pos[1] = h-OFF-RAD
- return pos
-
- def reset(self):
- self.points = self.init
- self.Refresh()
-
- def getPoints(self):
- return [tup for tup in self.points]
-
- def getValues(self):
- values = []
- for pt in self.points:
- x,y = self.pointToValues(pt)
- values.append((x,y))
- return values
-
- def sendValues(self):
- if self.outFunction != None:
- values = self.getValues()
- self.outFunction(values)
-
- def OnResize(self, evt):
- self.Refresh()
- evt.Skip()
-
- def OnLeave(self, evt):
- self.pos = (OFF+RAD,OFF+RAD)
- self.Refresh()
-
- def OnKeyDown(self, evt):
- if self.selected != None and evt.GetKeyCode() in [wx.WXK_BACK, wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE]:
- del self.points[self.selected]
- self.sendValues()
- self.selected = None
- self.Refresh()
- elif evt.GetKeyCode() in [wx.WXK_UP, wx.WXK_NUMPAD_UP]:
- self.points = [(pt[0], pt[1]+0.002) for pt in self.points]
- self.sendValues()
- self.Refresh()
- elif evt.GetKeyCode() in [wx.WXK_DOWN, wx.WXK_NUMPAD_DOWN]:
- self.points = [(pt[0], pt[1]-0.002) for pt in self.points]
- self.sendValues()
- self.Refresh()
-
- def MouseDown(self, evt):
- self.CaptureMouse()
- w,h = self.GetSize()
- self.pos = self.borderClip(evt.GetPosition())
- self.pos[1] = h - self.pos[1]
- for i, p in enumerate(self.points):
- x, y = self.pointToPixels(p)
- if wx.Rect(x-AREA, y-AREA, AREA2, AREA2).Contains(self.pos):
- # Grab a point
- self.selected = i
- self.Refresh()
- return
- # Add a point
- pt = self.pixelsToPoint(self.pos)
- for i, p in enumerate(self.points):
- if p >= pt:
- self.points.insert(i, pt)
- break
- self.selected = self.points.index(pt)
- self.Refresh()
-
- def MouseUp(self, evt):
- if self.HasCapture():
- self.ReleaseMouse()
- self.sendValues()
-
- def MouseMotion(self, evt):
- w,h = self.GetSize()
- self.pos = self.borderClip(evt.GetPosition())
- self.pos[1] = h - self.pos[1]
- if self.HasCapture():
- if self.selected != None:
- self.pos = self.pointClip(self.pos)
- x, y = self.pixelsToPoint(self.pos)
- if self.mode == 4 and y <= 0:
- y = 0.000001
- self.points[self.selected] = (x, y)
- self.Refresh()
-
- def getLogPoints(self, pt1, pt2):
- tmp = []
- if pt1[1] <= 0.0:
- pt1 = (pt1[0], 0.000001)
- if pt2[1] <= 0.0:
- pt2 = (pt2[0], 0.000001)
- if pt1[1] > pt2[1]:
- low = pt2[1]
- high = pt1[1]
- else:
- low = pt1[1]
- high = pt2[1]
-
- steps = pt2[0] - pt1[0]
- if steps > 0:
- lrange = high - low
- logrange = math.log10(high) - math.log10(low)
- logmin = math.log10(low)
- diff = (float(pt2[1]) - pt1[1]) / steps
- if lrange == 0:
- for i in range(steps):
- tmp.append((pt1[0]+i, pt1[1]))
- else:
- for i in range(steps):
- ratio = ((pt1[1] + diff * i) - low) / lrange
- tmp.append((pt1[0]+i, pow(10, ratio * logrange + logmin)))
- return tmp
-
- def getCosLogPoints(self, pt1, pt2):
- tmp = []
- if pt1[1] <= 0.0:
- pt1 = (pt1[0], 0.000001)
- if pt2[1] <= 0.0:
- pt2 = (pt2[0], 0.000001)
- if pt1[1] > pt2[1]:
- low = pt2[1]
- high = pt1[1]
- else:
- low = pt1[1]
- high = pt2[1]
-
- steps = pt2[0] - pt1[0]
- if steps > 0:
- lrange = high - low
- logrange = math.log10(high) - math.log10(low)
- logmin = math.log10(low)
- diff = (float(pt2[1]) - pt1[1]) / steps
- if lrange == 0:
- for i in range(steps):
- tmp.append((pt1[0]+i, pt1[1]))
- else:
- for i in range(steps):
- mu = float(i) / steps
- mu = (1. - math.cos(mu*math.pi)) * 0.5
- mu = pt1[1] * (1. - mu) + pt2[1] * mu
- ratio = (mu - low) / lrange
- tmp.append((pt1[0]+i, pow(10, ratio * logrange + logmin)))
- return tmp
-
- def getCosPoints(self, pt1, pt2):
- tmp = []
- steps = pt2[0] - pt1[0]
- for i in range(steps):
- mu = float(i) / steps
- mu2 = (1. - math.cos(mu*math.pi)) * 0.5
- tmp.append((pt1[0]+i, pt1[1] * (1. - mu2) + pt2[1] * mu2))
- return tmp
-
- def getExpPoints(self, pt1, pt2):
- tmp = []
- ambitus = pt2[1] - pt1[1]
- steps = pt2[0] - pt1[0]
- if steps == 0:
- inc = 1.0 / 0.0001
- else:
- inc = 1.0 / steps
- pointer = 0.0
- if self.inverse:
- if ambitus >= 0:
- for i in range(steps):
- scl = 1.0 - pow(1.0 - pointer, self.exp)
- tmp.append((pt1[0]+i, scl * ambitus + pt1[1]))
- pointer += inc
- else:
- for i in range(steps):
- scl = pow(pointer, self.exp)
- tmp.append((pt1[0]+i, scl * ambitus + pt1[1]))
- pointer += inc
- else:
- for i in range(steps):
- scl = pow(pointer, self.exp)
- tmp.append((pt1[0]+i, scl * ambitus + pt1[1]))
- pointer += inc
- return tmp
-
- def addImaginaryPoints(self, tmp):
- lst = []
- x = tmp[1][0] - tmp[0][0]
- if tmp[0][1] < tmp[1][1]:
- y = tmp[0][1] - tmp[1][1]
- else:
- y = tmp[0][1] + tmp[1][1]
- lst.append((x,y))
- lst.extend(tmp)
- x = tmp[-2][0] - tmp[-1][0]
- if tmp[-2][1] < tmp[-1][1]:
- y = tmp[-1][1] + tmp[-2][1]
- else:
- y = tmp[-1][1] - tmp[-2][1]
- lst.append((x,y))
- return lst
-
- def getCurvePoints(self, pt0, pt1, pt2, pt3):
- tmp = []
- y0, y1, y2, y3 = pt0[1], pt1[1], pt2[1], pt3[1]
- steps = pt2[0] - pt1[0]
- for i in range(steps):
- mu = float(i) / steps
- mu2 = mu * mu
- mu3 = mu2 * mu
- m0 = (y1 - y0) * (1.0 + self.bias) * (1.0 - self.tension) * 0.5
- m0 += (y2 - y1) * (1.0 - self.bias) * (1.0 - self.tension) * 0.5
- m1 = (y2 - y1) * (1.0 + self.bias) * (1.0 - self.tension) * 0.5
- m1 += (y3 - y2) * (1.0 - self.bias) * (1.0 - self.tension) * 0.5
- a0 = 2.0 * mu3 - 3.0 * mu2 + 1.0
- a1 = mu3 - 2.0 * mu2 + mu
- a2 = mu3 - mu2
- a3 = -2.0 * mu3 + 3.0 * mu2
- tmp.append((pt1[0]+i, a0*y1 + a1*m0 + a2*m1 + a3*y2))
- return tmp
-
- def OnPaint(self, evt):
- w,h = self.GetSize()
- corners = [(OFF,OFF),(w-OFF,OFF),(w-OFF,h-OFF),(OFF,h-OFF)]
- dc = wx.AutoBufferedPaintDC(self)
- if sys.platform != "win32":
- font, ptsize = dc.GetFont(), dc.GetFont().GetPointSize()
- else:
- font, ptsize = dc.GetFont(), 10
- font.SetPointSize(ptsize-4)
- dc.SetFont(font)
- dc.SetTextForeground("#888888")
- dc.Clear()
-
- # Draw grid
- dc.SetPen(wx.Pen("#CCCCCC", 1))
- xstep = int(round((w-OFF2) / float(10)))
- ystep = int(round((h-OFF2) / float(10)))
- for i in range(10):
- xpos = i * xstep + OFF
- dc.DrawLine(xpos, OFF, xpos, h-OFF)
- ypos = i * ystep + OFF
- dc.DrawLine(OFF, ypos, w-OFF, ypos)
- if i > 0:
- if type(self.xlen) == IntType:
- t = "%d" % int(self.xlen * i * 0.1)
- else:
- t = "%.2f" % (self.xlen * i * 0.1)
- dc.DrawText(t, xpos+2, h-OFF-10)
- if i < 9:
- t = "%.2f" % ((9-i) * 0.1 * (self.yrange[1]-self.yrange[0]) + self.yrange[0])
- dc.DrawText(t, OFF+1, ypos+ystep-10)
- else:
- t = "%.2f" % ((9-i) * 0.1 * (self.yrange[1]-self.yrange[0]) + self.yrange[0])
- dc.DrawText(t, OFF+1, h-OFF-10)
-
- dc.SetPen(wx.Pen("#000000", 1))
- dc.SetBrush(wx.Brush("#000000"))
- # Draw bounding box
- for i in range(4):
- dc.DrawLinePoint(corners[i], corners[(i+1)%4])
-
- # Convert points in pixels
- w,h = w-OFF2-RAD2, h-OFF2-RAD2
- tmp = []
- back_y_for_log = []
- for p in self.points:
- x = int(round(p[0] * w)) + OFF + RAD
- y = int(round((1.0-p[1]) * h)) + OFF + RAD
- tmp.append((x,y))
- back_y_for_log.append(p[1])
-
- # Draw lines
- dc.SetPen(wx.Pen("#000000", 1))
- last_p = None
- if len(tmp) > 1:
- if self.mode == 0:
- for i in range(len(tmp)-1):
- dc.DrawLinePoint(tmp[i], tmp[i+1])
- elif self.mode == 1:
- for i in range(len(tmp)-1):
- tmp2 = self.getCosPoints(tmp[i], tmp[i+1])
- if i == 0 and len(tmp2) < 2:
- dc.DrawLinePoint(tmp[i], tmp[i+1])
- if last_p != None:
- dc.DrawLinePoint(last_p, tmp[i])
- for j in range(len(tmp2)-1):
- dc.DrawLinePoint(tmp2[j], tmp2[j+1])
- last_p = tmp2[j+1]
- if last_p != None:
- dc.DrawLinePoint(last_p, tmp[-1])
- elif self.mode == 2:
- for i in range(len(tmp)-1):
- tmp2 = self.getExpPoints(tmp[i], tmp[i+1])
- if i == 0 and len(tmp2) < 2:
- dc.DrawLinePoint(tmp[i], tmp[i+1])
- if last_p != None:
- dc.DrawLinePoint(last_p, tmp[i])
- for j in range(len(tmp2)-1):
- dc.DrawLinePoint(tmp2[j], tmp2[j+1])
- last_p = tmp2[j+1]
- if last_p != None:
- dc.DrawLinePoint(last_p, tmp[-1])
- elif self.mode == 3:
- curvetmp = self.addImaginaryPoints(tmp)
- for i in range(1, len(curvetmp)-2):
- tmp2 = self.getCurvePoints(curvetmp[i-1], curvetmp[i], curvetmp[i+1], curvetmp[i+2])
- if i == 1 and len(tmp2) < 2:
- dc.DrawLinePoint(curvetmp[i], curvetmp[i+1])
- if last_p != None:
- dc.DrawLinePoint(last_p, curvetmp[i])
- for j in range(len(tmp2)-1):
- dc.DrawLinePoint(tmp2[j], tmp2[j+1])
- last_p = tmp2[j+1]
- if last_p != None:
- dc.DrawLinePoint(last_p, tmp[-1])
- elif self.mode == 4:
- back_tmp = [p for p in tmp]
- for i in range(len(tmp)):
- tmp[i] = (tmp[i][0], back_y_for_log[i])
- for i in range(len(tmp)-1):
- tmp2 = self.getLogPoints(tmp[i], tmp[i+1])
- for j in range(len(tmp2)):
- tmp2[j] = (tmp2[j][0], int(round((1.0-tmp2[j][1]) * h)) + OFF + RAD)
- if i == 0 and len(tmp2) < 2:
- dc.DrawLinePoint(back_tmp[i], back_tmp[i+1])
- if last_p != None:
- dc.DrawLinePoint(last_p, back_tmp[i])
- for j in range(len(tmp2)-1):
- dc.DrawLinePoint(tmp2[j], tmp2[j+1])
- last_p = tmp2[j+1]
- if last_p != None:
- dc.DrawLinePoint(last_p, back_tmp[-1])
- tmp = [p for p in back_tmp]
- elif self.mode == 5:
- back_tmp = [p for p in tmp]
- for i in range(len(tmp)):
- tmp[i] = (tmp[i][0], back_y_for_log[i])
- for i in range(len(tmp)-1):
- tmp2 = self.getCosLogPoints(tmp[i], tmp[i+1])
- for j in range(len(tmp2)):
- tmp2[j] = (tmp2[j][0], int(round((1.0-tmp2[j][1]) * h)) + OFF + RAD)
- if i == 0 and len(tmp2) < 2:
- dc.DrawLinePoint(back_tmp[i], back_tmp[i+1])
- if last_p != None:
- dc.DrawLinePoint(last_p, back_tmp[i])
- for j in range(len(tmp2)-1):
- dc.DrawLinePoint(tmp2[j], tmp2[j+1])
- last_p = tmp2[j+1]
- if last_p != None:
- dc.DrawLinePoint(last_p, back_tmp[-1])
- tmp = [p for p in back_tmp]
-
- # Draw points
- for i,p in enumerate(tmp):
- if i == self.selected:
- dc.SetBrush(wx.Brush("#FFFFFF"))
- else:
- dc.SetBrush(wx.Brush("#000000"))
- dc.DrawCircle(p[0],p[1],RAD)
-
- # Draw position values
- font.SetPointSize(ptsize-3)
- dc.SetFont(font)
- dc.SetTextForeground("#222222")
- posptx, pospty = self.pixelsToPoint(self.pos)
- xval, yval = self.pointToValues((posptx, pospty))
- if type(self.xlen) == IntType:
- dc.DrawText("%d, %.3f" % (xval, yval), w-75, OFF)
- else:
- dc.DrawText("%.3f, %.3f" % (xval, yval), w-75, OFF)
-
-class TableGrapher(wx.Frame):
- def __init__(self, parent=None, obj=None, mode=0, xlen=8192, yrange=(0.0, 1.0)):
- wx.Frame.__init__(self, parent)
- pts = obj.getPoints()
- self.yrange = yrange
- for i in range(len(pts)):
- x = pts[i][0] / float(xlen)
- y = (pts[i][1] - float(yrange[0])) / (yrange[1]-yrange[0])
- pts[i] = (x,y)
- if mode == 2:
- self.graph = Grapher(self, xlen=xlen, yrange=yrange, init=pts, mode=mode, exp=obj.exp, inverse=obj.inverse, outFunction=obj.replace)
- elif mode == 3:
- self.graph = Grapher(self, xlen=xlen, yrange=yrange, init=pts, mode=mode, tension=obj.tension, bias=obj.bias, outFunction=obj.replace)
- else:
- self.graph = Grapher(self, xlen=xlen, yrange=yrange, init=pts, mode=mode, outFunction=obj.replace)
-
- self.menubar = wx.MenuBar()
- self.fileMenu = wx.Menu()
- self.fileMenu.Append(9999, 'Close\tCtrl+W', kind=wx.ITEM_NORMAL)
- self.Bind(wx.EVT_MENU, self.close, id=9999)
- self.fileMenu.AppendSeparator()
- self.fileMenu.Append(10000, 'Copy all points to the clipboard (4 digits of precision)\tCtrl+C', kind=wx.ITEM_NORMAL)
- self.Bind(wx.EVT_MENU, self.copy, id=10000)
- self.fileMenu.Append(10001, 'Copy all points to the clipboard (full precision)\tShift+Ctrl+C', kind=wx.ITEM_NORMAL)
- self.Bind(wx.EVT_MENU, self.copy, id=10001)
- self.fileMenu.AppendSeparator()
- self.fileMenu.Append(10002, 'Reset\tCtrl+R', kind=wx.ITEM_NORMAL)
- self.Bind(wx.EVT_MENU, self.reset, id=10002)
- self.menubar.Append(self.fileMenu, "&File")
- self.SetMenuBar(self.menubar)
-
- def close(self, evt):
- self.Destroy()
-
- def copy(self, evt):
- pts = self.graph.getValues()
- if evt.GetId() == 10000:
- pstr = "["
- for i, pt in enumerate(pts):
- pstr += "("
- if type(pt[0]) == IntType:
- pstr += "%d," % pt[0]
- else:
- pstr += "%.4f," % pt[0]
- pstr += "%.4f)" % pt[1]
- if i < (len(pts)-1):
- pstr += ","
- pstr += "]"
- else:
- pstr = str(pts)
- data = wx.TextDataObject(pstr)
- if wx.TheClipboard.Open():
- wx.TheClipboard.Clear()
- wx.TheClipboard.SetData(data)
- wx.TheClipboard.Close()
-
- def reset(self, evt):
- self.graph.reset()
-
-class ServerGUI(wx.Frame):
- def __init__(self, parent=None, nchnls=2, startf=None, stopf=None, recstartf=None,
- recstopf=None, ampf=None, started=0, locals=None, shutdown=None, meter=True, timer=True, amp=1.):
- wx.Frame.__init__(self, parent)
-
- self.SetTitle("pyo server")
-
- self.menubar = wx.MenuBar()
- self.menu = wx.Menu()
- self.menu.Append(22999, 'Start/Stop\tCtrl+R', kind=wx.ITEM_NORMAL)
- self.Bind(wx.EVT_MENU, self.start, id=22999)
- quit_item = self.menu.Append(wx.ID_EXIT, "Quit\tCtrl+Q")
- self.Bind(wx.EVT_MENU, self.on_quit, id=wx.ID_EXIT)
- self.menubar.Append(self.menu, "&File")
- self.SetMenuBar(self.menubar)
-
- self.shutdown = shutdown
- self.locals = locals
- self.nchnls = nchnls
- self.startf = startf
- self.stopf = stopf
- self.recstartf = recstartf
- self.recstopf = recstopf
- self.ampf = ampf
- self._started = False
- self._recstarted = False
- self._history = []
- self._histo_count = 0
-
- panel = wx.Panel(self)
- panel.SetBackgroundColour(BACKGROUND_COLOUR)
- box = wx.BoxSizer(wx.VERTICAL)
-
- if sys.platform == "linux2":
- X_OFF = 0
- Y_OFF = 30
- leftMargin = 25
- elif sys.platform == "win32":
- try:
- if sys.getwindowsversion()[0] >= 6:
- X_OFF = 16
- else:
- X_OFF = 8
- except:
- X_OFF = 8
- Y_OFF = 65
- leftMargin = 24
- else:
- X_OFF = 0
- Y_OFF = 35
- leftMargin = 25
-
- buttonBox = wx.BoxSizer(wx.HORIZONTAL)
- self.startButton = wx.Button(panel, -1, 'Start', (20,20), (72,-1))
- self.startButton.Bind(wx.EVT_BUTTON, self.start)
- buttonBox.Add(self.startButton, 0, wx.RIGHT, 5)
-
- self.recButton = wx.Button(panel, -1, 'Rec Start', (20,20), (72,-1))
- self.recButton.Bind(wx.EVT_BUTTON, self.record)
- buttonBox.Add(self.recButton, 0, wx.RIGHT, 5)
-
- self.quitButton = wx.Button(panel, -1, 'Quit', (20,20), (72,-1))
- self.quitButton.Bind(wx.EVT_BUTTON, self.on_quit)
- buttonBox.Add(self.quitButton, 0, wx.RIGHT, 0)
-
- box.Add(buttonBox, 0, wx.TOP | wx.LEFT | wx.RIGHT, 10)
- box.AddSpacer(10)
-
- box.Add(wx.StaticText(panel, -1, "Amplitude (dB)"), 0, wx.LEFT, leftMargin)
- ampBox = wx.BoxSizer(wx.HORIZONTAL)
- self.ampScale = ControlSlider(panel, -60, 18, 20.0 * math.log10(amp), size=(203, 16), outFunction=self.setAmp)
- ampBox.Add(self.ampScale, 0, wx.LEFT, leftMargin-10)
- box.Add(ampBox, 0, wx.LEFT | wx.RIGHT, 8)
-
- if meter:
- box.AddSpacer(10)
- self.meter = VuMeter(panel, size=(200,5*self.nchnls+1), numSliders=self.nchnls)
- box.Add(self.meter, 0, wx.LEFT, leftMargin-1)
- box.AddSpacer(5)
-
- if timer:
- box.AddSpacer(10)
- tt = wx.StaticText(panel, -1, "Elapsed time (hh : mm : ss : ms)")
- box.Add(tt, 0, wx.LEFT, leftMargin)
- box.AddSpacer(3)
- self.timetext = wx.StaticText(panel, -1, "00 : 00 : 00 : 000")
- box.Add(self.timetext, 0, wx.LEFT, leftMargin)
-
- if self.locals != None:
- box.AddSpacer(10)
- t = wx.StaticText(panel, -1, "Interpreter")
- box.Add(t, 0, wx.LEFT, leftMargin)
- self.text = wx.TextCtrl(panel, -1, "", size=(200, -1), style=wx.TE_PROCESS_ENTER)
- self.text.Bind(wx.EVT_TEXT_ENTER, self.getText)
- self.text.Bind(wx.EVT_CHAR, self.onChar)
- box.Add(self.text, 0, wx.LEFT, leftMargin)
-
- panel.SetSizerAndFit(box)
- x, y = panel.GetSize()
- panel.SetSize((x+X_OFF, y+Y_OFF))
- self.SetSize((x+X_OFF, y+Y_OFF))
- self.SetMinSize(self.GetSize())
- self.SetMaxSize(self.GetSize())
-
- if started == 1:
- self.start(None, True)
-
- def setTime(self, *args):
- wx.CallAfter(self.timetext.SetLabel, "%02d : %02d : %02d : %03d" % (args[0], args[1], args[2], args[3]))
-
- def start(self, evt=None, justSet=False):
- if self._started == False:
- if not justSet:
- self.startf()
- self._started = True
- self.startButton.SetLabel('Stop')
- self.quitButton.Disable()
- else:
- self.stopf()
- self._started = False
- self.startButton.SetLabel('Start')
- self.quitButton.Enable()
-
- def record(self, evt):
- if self._recstarted == False:
- self.recstartf()
- self._recstarted = True
- self.recButton.SetLabel('Rec Stop')
- else:
- self.recstopf()
- self._recstarted = False
- self.recButton.SetLabel('Rec Start')
-
- def on_quit(self, evt):
- self.shutdown()
- self.Destroy()
- sys.exit()
-
- def getPrev(self):
- self.text.Clear()
- self._histo_count -= 1
- if self._histo_count < 0:
- self._histo_count = 0
- self.text.SetValue(self._history[self._histo_count])
- wx.CallAfter(self.text.SetInsertionPointEnd)
-
- def getNext(self):
- self.text.Clear()
- self._histo_count += 1
- if self._histo_count >= len(self._history):
- self._histo_count = len(self._history)
- else:
- self.text.SetValue(self._history[self._histo_count])
- self.text.SetInsertionPointEnd()
-
- def getText(self, evt):
- source = self.text.GetValue()
- self.text.Clear()
- self._history.append(source)
- self._histo_count = len(self._history)
- exec source in self.locals
-
- def onChar(self, evt):
- key = evt.GetKeyCode()
- if key == 315:
- self.getPrev()
- elif key == 317:
- self.getNext()
- evt.Skip()
-
- def setAmp(self, value):
- self.ampf(math.pow(10.0, float(value) * 0.05))
-
- def setRms(self, *args):
- self.meter.setRms(*args)
-
-if __name__ == "__main__":
- def pprint(values):
- print values
-
- app = wx.PySimpleApp()
- f = wx.Frame(None, title="test frame", size=(525,275))
- graph = Grapher(f, xlen=8192, yrange=(0.0, 1.0), init=[(0,0),(.5,1),(1,0)], outFunction=pprint)
- f.Show()
- app.MainLoop()
diff --git a/build/lib.linux-x86_64-2.7/pyolib/analysis.py b/build/lib.linux-x86_64-2.7/pyolib/analysis.py
deleted file mode 100644
index 27dafce..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/analysis.py
+++ /dev/null
@@ -1,367 +0,0 @@
-"""
-Tools to analyze audio signals.
-
-These objects are designed to retrieve specific informations
-from an audio stream. Analysis are sent at audio rate, user
-can use them for controlling parameters of others objects.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-from _core import *
-from _maps import *
-
-class Follower(PyoObject):
- """
- Envelope follower.
-
- Output signal is the continuous mean amplitude of an input signal.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Cutoff frequency of the filter in hertz. Default to 20.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Cutoff frequency of the filter.
-
- Notes:
-
- The out() method is bypassed. Follower's signal can not be sent to
- audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True, mul=.4).out()
- >>> fol = Follower(sf, freq=30)
- >>> n = Noise(mul=fol).out(1)
-
- """
- def __init__(self, input, freq=20, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, mul, add, lmax = convertArgsToLists(self._in_fader, freq, mul, add)
- self._base_objs = [Follower_base(wrap(in_fader,i), wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(1., 500., 'log', 'freq', self._freq)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Cutoff frequency of the filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
-class Follower2(PyoObject):
- """
- Envelope follower with different attack and release times.
-
- Output signal is the continuous mean amplitude of an input signal.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- risetime : float or PyoObject, optional
- Time to reach upward value in seconds. Default to 0.01.
- falltime : float or PyoObject, optional
- Time to reach downward value in seconds. Default to 0.1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setRisetime(x) : Replace the `risetime` attribute.
- setFalltime(x) : Replace the `falltime` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- risetime : float or PyoObject. Time to reach upward value in seconds.
- falltime : float or PyoObject. Time to reach downward value in seconds.
-
- Notes:
-
- The out() method is bypassed. Follower's signal can not be sent to
- audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True, mul=.4).out()
- >>> fol2 = Follower2(sf, risetime=0.002, falltime=.1, mul=.5)
- >>> n = Noise(fol2).out(1)
-
- """
- def __init__(self, input, risetime=0.01, falltime=0.1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._risetime = risetime
- self._falltime = falltime
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, risetime, falltime, mul, add, lmax = convertArgsToLists(self._in_fader, risetime, falltime, mul, add)
- self._base_objs = [Follower2_base(wrap(in_fader,i), wrap(risetime,i), wrap(falltime, i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'risetime', 'falltime', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setRisetime(self, x):
- """
- Replace the `risetime` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `risetime` attribute.
-
- """
- self._risetime = x
- x, lmax = convertArgsToLists(x)
- [obj.setRisetime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFalltime(self, x):
- """
- Replace the `falltime` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `falltime` attribute.
-
- """
- self._falltime = x
- x, lmax = convertArgsToLists(x)
- [obj.setFalltime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0.001, 1., 'log', 'risetime', self._risetime)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def risetime(self):
- """float or PyoObject. Time to reach upward value in seconds."""
- return self._risetime
- @risetime.setter
- def risetime(self, x): self.setRisetime(x)
-
- @property
- def falltime(self):
- """float or PyoObject. Time to reach downward value in seconds."""
- return self._falltime
- @falltime.setter
- def falltime(self, x): self.setFalltime(x)
-
-class ZCross(PyoObject):
- """
- Zero-crossing counter.
-
- Output signal is the number of zero-crossing occured during each
- buffer size, normalized between 0 and 1.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- thresh : float, optional
- Minimum amplitude difference allowed between adjacent samples
- to be included in the zeros count.
-
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setThresh(x) : Replace the `thresh` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- thresh : float. Amplitude difference threshold.
-
- Notes:
-
- The out() method is bypassed. ZCross's signal can not be sent to
- audio outs.
-
- Examples:
-
- >>> s = Server(duplex=1).boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True, mul=.4).out()
- >>> b = ZCross(a, thresh=.02)
- >>> n = Noise(b).out(1)
-
- """
- def __init__(self, input, thresh=0., mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._thresh = thresh
- self._in_fader = InputFader(input)
- in_fader, thresh, mul, add, lmax = convertArgsToLists(self._in_fader, thresh, mul, add)
- self._base_objs = [ZCross_base(wrap(in_fader,i), wrap(thresh,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'thresh', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setThresh(self, x):
- """
- Replace the `thresh` attribute.
-
- Parameters:
-
- x : float
- New amplitude difference threshold.
-
- """
- self._thresh = x
- x, lmax = convertArgsToLists(x)
- [obj.setThresh(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def thresh(self):
- """float. Amplitude difference threshold."""
- return self._thresh
- @thresh.setter
- def thresh(self, x): self.setThresh(x)
-
diff --git a/build/lib.linux-x86_64-2.7/pyolib/arithmetic.py b/build/lib.linux-x86_64-2.7/pyolib/arithmetic.py
deleted file mode 100644
index c532df0..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/arithmetic.py
+++ /dev/null
@@ -1,996 +0,0 @@
-"""
-Tools to perform arithmetic operations on audio signals.
-
-"""
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-from _core import *
-from _maps import *
-
-class Sin(PyoObject):
- """
- Performs a sine function on audio signal.
-
- Returns the sine of audio signal as input.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal, angle in radians.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> import math
- >>> a = Phasor(500, mul=math.pi*2)
- >>> b = Sin(a, mul=.3).mix(2).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Sin_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to filter."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Cos(PyoObject):
- """
- Performs a cosine function on audio signal.
-
- Returns the cosine of audio signal as input.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal, angle in radians.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> import math
- >>> a = Phasor(500, mul=math.pi*2)
- >>> b = Cos(a, mul=.3).mix(2).out()
-
- """
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Cos_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to filter."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Tan(PyoObject):
- """
- Performs a tangent function on audio signal.
-
- Returns the tangent of audio signal as input.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal, angle in radians.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to filter.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Tangent panning function
- >>> import math
- >>> src = Sine(mul=.3)
- >>> a = Phasor(freq=1, mul=90, add=-45)
- >>> b = Tan(Abs(a*math.pi/180))
- >>> b1 = 1.0 - b
- >>> oL = src * b
- >>> oR = src * b1
- >>> oL.out()
- >>> oR.out(1)
-
- """
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Tan_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to filter."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Abs(PyoObject):
- """
- Performs an absolute function on audio signal.
-
- Returns the absolute value of audio signal as input.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Back-and-Forth playback
- >>> t = SndTable(SNDS_PATH + "/transparent.aif")
- >>> a = Phasor(freq=t.getRate()*0.5, mul=2, add=-1)
- >>> b = Pointer(table=t, index=Abs(a), mul=0.5).mix(2).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Abs_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Sqrt(PyoObject):
- """
- Performs a square-root function on audio signal.
-
- Returns the square-root value of audio signal as input.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Equal-power panning function
- >>> src = Sine(mul=.3)
- >>> a = Abs(Phasor(freq=1, mul=2, add=-1))
- >>> left = Sqrt(1.0 - a)
- >>> right = Sqrt(a)
- >>> oL = src * left
- >>> oR = src * right
- >>> oL.out()
- >>> oR.out(1)
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Sqrt_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Log(PyoObject):
- """
- Performs a natural log function on audio signal.
-
- Returns the natural log value of of audio signal as input.
- Values less than 0.0 return 0.0.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- # Logarithmic amplitude envelope
- >>> a = LFO(freq=1, type=3, mul=0.2, add=1.2) # triangle
- >>> b = Log(a)
- >>> c = SineLoop(freq=[300,301], feedback=0.05, mul=b).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Log_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Log2(PyoObject):
- """
- Performs a base 2 log function on audio signal.
-
- Returns the base 2 log value of audio signal as input.
- Values less than 0.0 return 0.0.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- # Logarithmic amplitude envelope
- >>> a = LFO(freq=1, type=3, mul=0.1, add=1.1) # triangle
- >>> b = Log2(a)
- >>> c = SineLoop(freq=[300,301], feedback=0.05, mul=b).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Log2_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Log10(PyoObject):
- """
- Performs a base 10 log function on audio signal.
-
- Returns the base 10 log value of audio signal as input.
- Values less than 0.0 return 0.0.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- # Logarithmic amplitude envelope
- >>> a = LFO(freq=1, type=3, mul=0.4, add=1.4) # triangle
- >>> b = Log10(a)
- >>> c = SineLoop(freq=[300,301], feedback=0.05, mul=b).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Log10_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Pow(PyoObject):
- """
- Performs a power function on audio signal.
-
- Parentclass: PyoObject
-
- Parameters:
-
- base : float or PyoObject, optional
- Base composant. Defaults to 10.
- exponent : float or PyoObject, optional
- Exponent composant. Defaults to 1.
-
- Methods:
-
- setBase(x) : Replace the `base` attribute.
- setExponent(x) : Replace the `exponent` attribute.
-
- Attributes:
-
- base : float or PyoObject, Base composant.
- exponent : float or PyoObject, Exponent composant.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Exponential amplitude envelope
- >>> a = LFO(freq=1, type=3, mul=0.5, add=0.5)
- >>> b = Pow(Clip(a, 0, 1), 4, mul=.3)
- >>> c = SineLoop(freq=[300,301], feedback=0.05, mul=b).out()
-
- """
- def __init__(self, base=10, exponent=1, mul=1, add=0):
- PyoObject.__init__(self)
- self._base = base
- self._exponent = exponent
- self._mul = mul
- self._add = add
- base, exponent, mul, add, lmax = convertArgsToLists(base, exponent, mul, add)
- self._base_objs = [M_Pow_base(wrap(base,i), wrap(exponent,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['base', 'exponent', 'mul', 'add']
-
- def setBase(self, x):
- """
- Replace the `base` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `base` attribute.
-
- """
- self._base = x
- x, lmax = convertArgsToLists(x)
- [obj.setBase(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setExponent(self, x):
- """
- Replace the `exponent` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `exponent` attribute.
-
- """
- self._exponent = x
- x, lmax = convertArgsToLists(x)
- [obj.setExponent(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def base(self):
- """float or PyoObject. Base composant."""
- return self._base
- @base.setter
- def base(self, x): self.setBase(x)
-
- @property
- def exponent(self):
- """float or PyoObject. Exponent composant."""
- return self._exponent
- @exponent.setter
- def exponent(self, x): self.setExponent(x)
-
-class Atan2(PyoObject):
- """
- Computes the principal value of the arc tangent of b/a.
-
- Computes the principal value of the arc tangent of b/a,
- using the signs of both arguments to determine the quadrant
- of the return value.
-
- Parentclass: PyoObject
-
- Parameters:
-
- b : float or PyoObject, optional
- Numerator. Defaults to 1.
- a : float or PyoObject, optional
- Denominator. Defaults to 1.
-
- Methods:
-
- setB(x) : Replace the `b` attribute.
- setA(x) : Replace the `a` attribute.
-
- Attributes:
-
- b : float or PyoObject, Numerator.
- a : float or PyoObject, Denominator.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Simple distortion
- >>> a = Sine(freq=[200,200.3])
- >>> lf = Sine(freq=1, mul=.2, add=.2)
- >>> dist = Atan2(a, lf)
- >>> lp = Tone(dist, freq=2000, mul=.1).out()
-
- """
- def __init__(self, b=1, a=1, mul=1, add=0):
- PyoObject.__init__(self)
- self._b = b
- self._a = a
- self._mul = mul
- self._add = add
- b, a, mul, add, lmax = convertArgsToLists(b, a, mul, add)
- self._base_objs = [M_Atan2_base(wrap(b,i), wrap(a,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['b', 'a', 'mul', 'add']
-
- def setB(self, x):
- """
- Replace the `b` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `b` attribute.
-
- """
- self._b = x
- x, lmax = convertArgsToLists(x)
- [obj.setB(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setA(self, x):
- """
- Replace the `a` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `a` attribute.
-
- """
- self._a = x
- x, lmax = convertArgsToLists(x)
- [obj.setA(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def b(self):
- """float or PyoObject. Numerator."""
- return self._b
- @b.setter
- def b(self, x): self.setB(x)
-
- @property
- def a(self):
- """float or PyoObject. Denominator."""
- return self._a
- @a.setter
- def a(self, x): self.setA(x)
-
-class Floor(PyoObject):
- """
- Rounds to largest integral value not greater than audio signal.
-
- For each samples in the input signal, rounds to the largest integral
- value not greater than the sample value.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Clipping frequencies
- >>> sweep = Phasor(freq=[1,.67], mul=4)
- >>> flo = Floor(sweep, mul=50, add=200)
- >>> a = SineLoop(freq=flo, feedback=.1, mul=.3).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Floor_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Ceil(PyoObject):
- """
- Rounds to smallest integral value greater than or equal to the input signal.
-
- For each samples in the input signal, rounds to the smallest integral
- value greater than or equal to the sample value.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Clipping frequencies
- >>> sweep = Phasor(freq=[1,.67], mul=4)
- >>> flo = Ceil(sweep, mul=50, add=200)
- >>> a = SineLoop(freq=flo, feedback=.1, mul=.3).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Ceil_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Round(PyoObject):
- """
- Rounds to the nearest integer value in a floating-point format.
-
- For each samples in the input signal, rounds to the nearest integer
- value of the sample value.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Clipping frequencies
- >>> sweep = Phasor(freq=[1,.67], mul=4)
- >>> flo = Round(sweep, mul=50, add=200)
- >>> a = SineLoop(freq=flo, feedback=.1, mul=.3).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [M_Round_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/controls.py b/build/lib.linux-x86_64-2.7/pyolib/controls.py
deleted file mode 100644
index 3eb6a20..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/controls.py
+++ /dev/null
@@ -1,891 +0,0 @@
-"""
-Objects designed to create parameter's control at audio rate.
-
-These objects can be used to create envelopes, line segments
-and conversion from python number to audio signal.
-
-The audio streams of these objects can't be sent to the output
-soundcard.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-import sys
-from _core import *
-from _maps import *
-from _widgets import createGraphWindow
-from types import ListType, TupleType
-
-######################################################################
-### Controls
-######################################################################
-class Fader(PyoObject):
- """
- Fadein - fadeout envelope generator.
-
- Generate an amplitude envelope between 0 and 1 with control on fade
- times and total duration of the envelope.
-
- The play() method starts the envelope and is not called at the
- object creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- fadein : float, optional
- Rising time of the envelope in seconds. Defaults to 0.01.
- fadeout : float, optional
- Falling time of the envelope 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 fadeout.
-
- 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.
- setFadein(x) : Replace the `fadein` attribute.
- setFadeout(x) : Replace the `fadeout` attribute.
- setDur(x) : Replace the `dur` attribute.
-
- Attributes:
-
- fadein : float. Rising time of the envelope in seconds.
- fadeout : float. Falling time of the envelope in seconds.
- dur : float. Total duration of the envelope.
-
- Notes:
-
- The out() method is bypassed. Fader's signal can not be sent to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> f = Fader(fadein=0.5, fadeout=0.5, dur=2, mul=.5)
- >>> a = BrownNoise(mul=f).mix(2).out()
- >>> def repeat():
- ... f.play()
- >>> pat = Pattern(function=repeat, time=2).play()
-
- """
- def __init__(self, fadein=0.01, fadeout=0.1, dur=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._fadein = fadein
- self._fadeout = fadeout
- self._dur = dur
- self._mul = mul
- self._add = add
- fadein, fadeout, dur, mul, add, lmax = convertArgsToLists(fadein, fadeout, dur, mul, add)
- self._base_objs = [Fader_base(wrap(fadein,i), wrap(fadeout,i), wrap(dur,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['fadein', 'fadeout', 'dur', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setFadein(self, x):
- """
- Replace the `fadein` attribute.
-
- Parameters:
-
- x : float
- new `fadein` attribute.
-
- """
- self._fadein = x
- x, lmax = convertArgsToLists(x)
- [obj.setFadein(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFadeout(self, x):
- """
- Replace the `fadeout` attribute.
-
- Parameters:
-
- x : float
- new `fadeout` attribute.
-
- """
- self._fadeout = x
- x, lmax = convertArgsToLists(x)
- [obj.setFadeout(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDur(self, x):
- """
- Replace the `dur` attribute.
-
- Parameters:
-
- x : float
- new `dur` attribute.
-
- """
- self._dur = x
- x, lmax = convertArgsToLists(x)
- [obj.setDur(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def fadein(self):
- """float. Rising time of the envelope in seconds."""
- return self._fadein
- @fadein.setter
- def fadein(self, x): self.setFadein(x)
-
- @property
- def fadeout(self):
- """float. Falling time of the envelope in seconds."""
- return self._fadeout
- @fadeout.setter
- def fadeout(self, x): self.setFadeout(x)
-
- @property
- def dur(self):
- """float. Total duration of the envelope."""
- return self._dur
- @dur.setter
- def dur(self, x): self.setDur(x)
-
-
-class Adsr(PyoObject):
- """
- 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.
-
- Parentclass: 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=2, mul=.5)
- >>> a = BrownNoise(mul=f).mix(2).out()
- >>> def repeat():
- ... f.play()
- >>> pat = Pattern(function=repeat, time=2).play()
-
- """
- def __init__(self, attack=0.01, decay=0.05, sustain=0.707, release=0.1, dur=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._attack = attack
- self._decay = decay
- self._sustain = sustain
- self._release = release
- self._dur = dur
- self._mul = mul
- self._add = add
- attack, decay, sustain, release, dur, mul, add, lmax = convertArgsToLists(attack, decay, sustain, release, dur, mul, add)
- self._base_objs = [Adsr_base(wrap(attack,i), wrap(decay,i), wrap(sustain,i), wrap(release,i), wrap(dur,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['attack', 'decay', 'sustain', 'release', 'dur', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setAttack(self, x):
- """
- Replace the `attack` attribute.
-
- Parameters:
-
- x : float
- new `attack` attribute.
-
- """
- self._attack = x
- x, lmax = convertArgsToLists(x)
- [obj.setAttack(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDecay(self, x):
- """
- Replace the `decay` attribute.
-
- Parameters:
-
- x : float
- new `decay` attribute.
-
- """
- self._decay = x
- x, lmax = convertArgsToLists(x)
- [obj.setDecay(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSustain(self, x):
- """
- Replace the `sustain` attribute.
-
- Parameters:
-
- x : float
- new `sustain` attribute.
-
- """
- self._sustain = x
- x, lmax = convertArgsToLists(x)
- [obj.setSustain(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRelease(self, x):
- """
- Replace the `sustain` attribute.
-
- Parameters:
-
- x : float
- new `sustain` attribute.
-
- """
- self._release = x
- x, lmax = convertArgsToLists(x)
- [obj.setRelease(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDur(self, x):
- """
- Replace the `dur` attribute.
-
- Parameters:
-
- x : float
- new `dur` attribute.
-
- """
- self._dur = x
- x, lmax = convertArgsToLists(x)
- [obj.setDur(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def attack(self):
- """float. Duration of the attack phase in seconds."""
- return self._attack
- @attack.setter
- def attack(self, x): self.setAttack(x)
-
- @property
- def decay(self):
- """float. Duration of the decay phase in seconds."""
- return self._decay
- @decay.setter
- def decay(self, x): self.setDecay(x)
-
- @property
- def sustain(self):
- """float. Amplitude of the sustain phase."""
- return self._sustain
- @sustain.setter
- def sustain(self, x): self.setSustain(x)
-
- @property
- def release(self):
- """float. Duration of the release phase in seconds."""
- return self._release
- @release.setter
- def release(self, x): self.setRelease(x)
-
- @property
- def dur(self):
- """float. Total duration of the envelope."""
- return self._dur
- @dur.setter
- def dur(self, x): self.setDur(x)
-
-class Linseg(PyoObject):
- """
- Trace a series of line segments between specified break-points.
-
- The play() method starts the envelope and is not called at the
- object creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- list : list of tuples
- Points used to construct the line segments. Each tuple is a
- new point in the form (time, value). Times are given in seconds
- and must be in increasing order.
- loop : boolean, optional
- Looping mode. Defaults to False.
- initToFirstVal : boolean, optional
- If True, audio buffer will be filled at initialization with the
- starting value of the line. Defaults to False.
-
- Methods:
-
- setList(x) : Replace the `list` attribute.
- replace(x) : Alias for `setList` method.
- setLoop(x) : Replace the `loop` attribute.
- graph(xlen, yrange, title, wxnoserver) : Opens a grapher window
- to control the shape of the envelope.
-
- Attributes:
-
- list : list of tuples. Points used to construct the line segments.
- loop : boolean. Looping mode.
-
- Notes:
-
- The out() method is bypassed. Linseg's signal can not be sent to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> l = Linseg([(0,500),(.03,1000),(.1,700),(1,500),(2,500)], loop=True)
- >>> a = Sine(freq=l, mul=.3).mix(2).out()
- >>> # then call:
- >>> l.play()
-
- """
- def __init__(self, list, loop=False, initToFirstVal=False, mul=1, add=0):
- PyoObject.__init__(self)
- if type(list) != ListType:
- print >> sys.stderr, 'TypeError: "list" argument of %s must be a list of tuples.\n' % self.__class__.__name__
- exit()
- if type(list[0]) != TupleType:
- print >> sys.stderr, 'TypeError: "list" argument of %s must be a list of tuples.\n' % self.__class__.__name__
- exit()
- self._list = list
- self._loop = loop
- self._mul = mul
- self._add = add
- initToFirstVal, loop, mul, add, lmax = convertArgsToLists(initToFirstVal, loop, mul, add)
- if type(list[0]) != ListType:
- self._base_objs = [Linseg_base(list, wrap(loop,i), wrap(initToFirstVal,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- else:
- listlen = len(list)
- lmax = max(listlen, lmax)
- self._base_objs = [Linseg_base(wrap(list,i), wrap(loop,i), wrap(initToFirstVal,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['list', 'loop', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setList(self, x):
- """
- Replace the `list` attribute.
-
- Parameters:
-
- x : list of tuples
- new `list` attribute.
-
- """
- self._list = x
- if type(x[0]) != ListType:
- [obj.setList(x) for i, obj in enumerate(self._base_objs)]
- else:
- [obj.setList(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def replace(self, x):
- """
- Alias for `setList` method.
-
- Parameters:
-
- x : list of tuples
- new `list` attribute.
-
- """
- self.setList(x)
-
- def getPoints(self):
- return self._list
-
- def setLoop(self, x):
- """
- Replace the `loop` attribute.
-
- Parameters:
-
- x : boolean
- new `loop` attribute.
-
- """
- self._loop = x
- x, lmax = convertArgsToLists(x)
- [obj.setLoop(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- def graph(self, xlen=None, yrange=None, title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- xlen : float, optional
- Set the maximum value of the X axis of the graph. If None, the
- maximum value is retrieve from the current list of points.
- Defaults to None.
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph. If
- None, min and max are retrieve from the current list of points.
- Defaults to None.
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- if xlen == None:
- xlen = float(self._list[-1][0])
- else:
- xlen = float(xlen)
- if yrange == None:
- ymin = float(min([x[1] for x in self._list]))
- ymax = float(max([x[1] for x in self._list]))
- if ymin == ymax:
- yrange = (0, ymax)
- else:
- yrange = (ymin, ymax)
- createGraphWindow(self, 0, xlen, yrange, title, wxnoserver)
-
- @property
- def list(self):
- """float. List of points (time, value)."""
- return self._list
- @list.setter
- def list(self, x): self.setList(x)
-
- @property
- def loop(self):
- """boolean. Looping mode."""
- return self._loop
- @loop.setter
- def loop(self, x): self.setLoop(x)
-
-class Expseg(PyoObject):
- """
- Trace a series of exponential segments between specified break-points.
-
- The play() method starts the envelope and is not called at the
- object creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- list : list of tuples
- Points used to construct the line segments. Each tuple is a
- new point in the form (time, value). Times are given in seconds
- and must be in increasing order.
- loop : boolean, optional
- Looping mode. Defaults to False.
- exp : float, optional
- Exponent factor. Used to control the slope of the curves.
- Defaults to 10.
- inverse : boolean, optional
- If True, downward slope will be inversed. Useful to create
- biexponential curves. Defaults to True.
- initToFirstVal : boolean, optional
- If True, audio buffer will be filled at initialization with the
- starting value of the line. Defaults to False.
-
- Methods:
-
- setList(x) : Replace the `list` attribute.
- replace(x) : Alias for `setList` method.
- setLoop(x) : Replace the `loop` attribute.
- setExp(x) : Replace the `exp` attribute.
- setInverse(x) : Replace the `inverse` attribute.
- graph(xlen, yrange, title, wxnoserver) : Opens a grapher window
- to control the shape of the envelope.
-
- Attributes:
-
- list : list of tuples. Points used to construct the line segments.
- loop : boolean. Looping mode.
- exp : float. Exponent factor.
- inverse : boolean. Inversion of downward slope.
-
- Notes:
-
- The out() method is bypassed. Expseg's signal can not be sent to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> l = Expseg([(0,500),(.03,1000),(.1,700),(1,500),(2,500)], loop=True)
- >>> a = Sine(freq=l, mul=.3).mix(2).out()
- >>> # then call:
- >>> l.play()
-
- """
- def __init__(self, list, loop=False, exp=10, inverse=True, initToFirstVal=False, mul=1, add=0):
- PyoObject.__init__(self)
- if type(list) != ListType:
- print >> sys.stderr, 'TypeError: "list" argument of %s must be a list of tuples.\n' % self.__class__.__name__
- exit()
- if type(list[0]) != TupleType:
- print >> sys.stderr, 'TypeError: "list" argument of %s must be a list of tuples.\n' % self.__class__.__name__
- exit()
- self._list = list
- self._loop = loop
- self._exp = exp
- self._inverse = inverse
- self._mul = mul
- self._add = add
- loop, exp, inverse, initToFirstVal, mul, add, lmax = convertArgsToLists(loop, exp, inverse, initToFirstVal, mul, add)
- if type(list[0]) != ListType:
- self._base_objs = [Expseg_base(list, wrap(loop,i), wrap(exp,i), wrap(inverse,i), wrap(initToFirstVal,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- else:
- listlen = len(list)
- lmax = max(listlen, lmax)
- self._base_objs = [Expseg_base(wrap(list,i), wrap(loop,i), wrap(exp,i), wrap(inverse,i), wrap(initToFirstVal,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['list', 'loop', 'exp', 'inverse', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setList(self, x):
- """
- Replace the `list` attribute.
-
- Parameters:
-
- x : list of tuples
- new `list` attribute.
-
- """
- self._list = x
- if type(x[0]) != ListType:
- [obj.setList(x) for i, obj in enumerate(self._base_objs)]
- else:
- [obj.setList(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setLoop(self, x):
- """
- Replace the `loop` attribute.
-
- Parameters:
-
- x : boolean
- new `loop` attribute.
-
- """
- self._loop = x
- x, lmax = convertArgsToLists(x)
- [obj.setLoop(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setExp(self, x):
- """
- Replace the `exp` attribute.
-
- Parameters:
-
- x : float
- new `exp` attribute.
-
- """
- self._exp = x
- x, lmax = convertArgsToLists(x)
- [obj.setExp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInverse(self, x):
- """
- Replace the `inverse` attribute.
-
- Parameters:
-
- x : boolean
- new `inverse` attribute.
-
- """
- self._inverse = x
- x, lmax = convertArgsToLists(x)
- [obj.setInverse(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def replace(self, x):
- """
- Alias for `setList` method.
-
- Parameters:
-
- x : list of tuples
- new `list` attribute.
-
- """
- self.setList(x)
-
- def getPoints(self):
- return self._list
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- def graph(self, xlen=None, yrange=None, title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- xlen : float, optional
- Set the maximum value of the X axis of the graph. If None, the
- maximum value is retrieve from the current list of points.
- Defaults to None.
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph. If
- None, min and max are retrieve from the current list of points.
- Defaults to None.
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- if xlen == None:
- xlen = float(self._list[-1][0])
- else:
- xlen = float(xlen)
- if yrange == None:
- ymin = float(min([x[1] for x in self._list]))
- ymax = float(max([x[1] for x in self._list]))
- if ymin == ymax:
- yrange = (0, ymax)
- else:
- yrange = (ymin, ymax)
- createGraphWindow(self, 2, xlen, yrange, title, wxnoserver)
-
- @property
- def list(self):
- """float. List of points (time, value)."""
- return self._list
- @list.setter
- def list(self, x): self.setList(x)
-
- @property
- def loop(self):
- """boolean. Looping mode."""
- return self._loop
- @loop.setter
- def loop(self, x): self.setLoop(x)
-
- @property
- def exp(self):
- """float. Exponent factor."""
- return self._exp
- @exp.setter
- def exp(self, x): self.setExp(x)
-
- @property
- def inverse(self):
- """boolean. Inverse downward slope."""
- return self._inverse
- @inverse.setter
- def inverse(self, x): self.setInverse(x)
-
-class SigTo(PyoObject):
- """
- Convert numeric value to PyoObject signal with portamento.
-
- When `value` is changed, a ramp is applied from the current
- value to the new value. Can be used with PyoObject to apply
- a linear portamento on an audio signal.
-
- Parentclass: PyoObject
-
- Parameters:
-
- value : float or PyoObject
- Numerical value to convert.
- time : float, optional
- Ramp time, in seconds, to reach the new value. Defaults to 0.025.
- init : float, optional
- Initial value of the internal memory. Defaults to 0.
-
- Methods:
-
- setValue(x) : Changes the value of the signal stream.
- setTime(x) : Changes the ramp time.
-
- Attributes:
-
- value : float or PyoObject. Numerical value to convert.
- time : float. Ramp time.
-
- Notes:
-
- The out() method is bypassed. SigTo's signal can not be sent to audio outs.
-
- Examples:
-
- >>> import random
- >>> s = Server().boot()
- >>> s.start()
- >>> fr = SigTo(value=200, time=0.5, init=200)
- >>> a = SineLoop(freq=fr, feedback=0.08, mul=.3).out()
- >>> b = SineLoop(freq=fr*1.005, feedback=0.08, mul=.3).out(1)
- >>> def pick_new_freq():
- ... fr.value = random.randrange(200,501,50)
- >>> pat = Pattern(function=pick_new_freq, time=1).play()
-
- """
- def __init__(self, value, time=0.025, init=0.0, mul=1, add=0):
- PyoObject.__init__(self)
- self._value = value
- self._time = time
- self._mul = mul
- self._add = add
- value, time, init, mul ,add, lmax = convertArgsToLists(value, time, init, mul, add)
- self._base_objs = [SigTo_base(wrap(value,i), wrap(time,i), wrap(init,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['value', 'time', 'mul', 'add']
-
- def setValue(self, x):
- """
- Changes the value of the signal stream.
-
- Parameters:
-
- x : float or PyoObject
- Numerical value to convert.
-
- """
- x, lmax = convertArgsToLists(x)
- [obj.setValue(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setTime(self, x):
- """
- Changes the ramp time of the object.
-
- Parameters:
-
- x : float
- New ramp time.
-
- """
- x, lmax = convertArgsToLists(x)
- [obj.setTime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- 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)
-
- @property
- def time(self):
- """float. Ramp time."""
- return self._time
- @time.setter
- def time(self, x): self.setTime(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/dynamics.py b/build/lib.linux-x86_64-2.7/pyolib/dynamics.py
deleted file mode 100644
index d85752f..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/dynamics.py
+++ /dev/null
@@ -1,1089 +0,0 @@
-"""
-Objects to modify the dynamic range and sample quality of audio signals.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-
-class Clip(PyoObject):
- """
- Clips a signal to a predefined limit.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- min : float or PyoObject, optional
- Minimum possible value. Defaults to -1.
- max : float or PyoObject, optional
- Maximum possible value. Defaults to 1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- min : float or PyoObject. Minimum possible value.
- max : float or PyoObject. Maximum possible value.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True)
- >>> lfoup = Sine(freq=.25, mul=.48, add=.5)
- >>> lfodown = 0 - lfoup
- >>> c = Clip(a, min=lfodown, max=lfoup, mul=.4).mix(2).out()
-
- """
- def __init__(self, input, min=-1.0, max=1.0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._min = min
- self._max = max
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, min, max, mul, add, lmax = convertArgsToLists(self._in_fader, min, max, mul, add)
- self._base_objs = [Clip_base(wrap(in_fader,i), wrap(min,i), wrap(max,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'min', 'max', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(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(-1., 0., 'lin', 'min', self._min),
- SLMap(0., 1., 'lin', 'max', self._max),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- 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 Mirror(PyoObject):
- """
- Reflects the signal that exceeds the `min` and `max` thresholds.
-
- This object is useful for table indexing or for clipping and
- modeling an audio signal.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- min : float or PyoObject, optional
- Minimum possible value. Defaults to 0.
- max : float or PyoObject, optional
- Maximum possible value. Defaults to 1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- min : float or PyoObject. Minimum possible value.
- max : float or PyoObject. Maximum possible value.
-
- Notes:
-
- If `min` is higher than `max`, then the output will be the average of the two.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Sine(freq=[300,301])
- >>> lfmin = Sine(freq=1.5, mul=.25, add=-0.75)
- >>> lfmax = Sine(freq=2, mul=.25, add=0.75)
- >>> b = Mirror(a, min=lfmin, max=lfmax)
- >>> c = Tone(b, freq=2500, mul=.15).out()
-
- """
- def __init__(self, input, min=0.0, max=1.0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._min = min
- self._max = max
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, min, max, mul, add, lmax = convertArgsToLists(self._in_fader, min, max, mul, add)
- self._base_objs = [Mirror_base(wrap(in_fader,i), wrap(min,i), wrap(max,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'min', 'max', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(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', 'min', self._min),
- SLMap(0., 1., 'lin', 'max', self._max),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- 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 Wrap(PyoObject):
- """
- Wraps-around the signal that exceeds the `min` and `max` thresholds.
-
- This object is useful for table indexing, phase shifting or for
- clipping and modeling an audio signal.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- min : float or PyoObject, optional
- Minimum possible value. Defaults to 0.
- max : float or PyoObject, optional
- Maximum possible value. Defaults to 1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- min : float or PyoObject. Minimum possible value.
- max : float or PyoObject. Maximum possible value.
-
- Notes:
-
- If `min` is higher than `max`, then the output will be the average of the two.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Time-varying overlaping envelopes
- >>> env = HannTable()
- >>> lff = Sine(.5, mul=3, add=4)
- >>> ph1 = Phasor(lff)
- >>> ph2 = Wrap(ph1+0.5, min=0, max=1)
- >>> amp1 = Pointer(env, ph1, mul=.25)
- >>> amp2 = Pointer(env, ph2, mul=.25)
- >>> a = SineLoop(250, feedback=.1, mul=amp1).out()
- >>> b = SineLoop(300, feedback=.1, mul=amp2).out(1)
-
- """
- def __init__(self, input, min=0.0, max=1.0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._min = min
- self._max = max
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, min, max, mul, add, lmax = convertArgsToLists(self._in_fader, min, max, mul, add)
- self._base_objs = [Wrap_base(wrap(in_fader,i), wrap(min,i), wrap(max,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'min', 'max', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(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', 'min', self._min),
- SLMap(0., 1., 'lin', 'max', self._max),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- 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 Degrade(PyoObject):
- """
- Signal quality reducer.
-
- Degrade takes an audio signal and reduces the sampling rate and/or
- bit-depth as specified.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- bitdepth : float or PyoObject, optional
- Signal quantization in bits. Must be in range 1 -> 32.
- Defaults to 16.
- srscale : float or PyoObject, optional
- Sampling rate multiplier. Must be in range 0.0009765625 -> 1.
- Defaults to 1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setBitdepth(x) : Replace the `bitdepth` attribute.
- setSrscale(x) : Replace the `srscale` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- bitdepth : float or PyoObject. Quantization in bits.
- srscale : float or PyoObject. Sampling rate multiplier.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = SquareTable()
- >>> a = Osc(table=t, freq=[100,101], mul=.5)
- >>> lfo = Sine(freq=.2, mul=6, add=8)
- >>> lfo2 = Sine(freq=.25, mul=.45, add=.55)
- >>> b = Degrade(a, bitdepth=lfo, srscale=lfo2, mul=.3).out()
-
- """
- def __init__(self, input, bitdepth=16, srscale=1.0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._bitdepth = bitdepth
- self._srscale = srscale
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, bitdepth, srscale, mul, add, lmax = convertArgsToLists(self._in_fader, bitdepth, srscale, mul, add)
- self._base_objs = [Degrade_base(wrap(in_fader,i), wrap(bitdepth,i), wrap(srscale,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'bitdepth', 'srscale', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setBitdepth(self, x):
- """
- Replace the `bitdepth` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `bitdepth` attribute.
-
- """
- self._bitdepth = x
- x, lmax = convertArgsToLists(x)
- [obj.setBitdepth(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSrscale(self, x):
- """
- Replace the `srscale` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `srscale` attribute.
-
- """
- self._srscale = x
- x, lmax = convertArgsToLists(x)
- [obj.setSrscale(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(1., 32., 'log', 'bitdepth', self._bitdepth),
- SLMap(0.0009765625, 1., 'log', 'srscale', self._srscale),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def bitdepth(self):
- """float or PyoObject. Signal quantization in bits."""
- return self._bitdepth
- @bitdepth.setter
- def bitdepth(self, x): self.setBitdepth(x)
-
- @property
- def srscale(self):
- """float or PyoObject. Sampling rate multiplier."""
- return self._srscale
- @srscale.setter
- def srscale(self, x): self.setSrscale(x)
-
-class Compress(PyoObject):
- """
- Reduces the dynamic range of an audio signal.
-
- Compress reduces the volume of loud sounds or amplifies quiet sounds by
- narrowing or compressing an audio signal's dynamic range.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- thresh : float or PyoObject, optional
- Level, expressed in dB, above which the signal is reduced.
- Reference level is 0dB. Defaults to -20.
- ratio : float or PyoObject, optional
- Determines the input/output ratio for signals above the
- threshold. Defaults to 2.
- risetime : float or PyoObject, optional
- Used in amplitude follower, time to reach upward value in
- seconds. Defaults to 0.01.
- falltime : float or PyoObject, optional
- Used in amplitude follower, time to reach downward value in
- seconds. Defaults to 0.1.
- lookahead : float, optional
- Delay length, in ms, for the "look-ahead" buffer. Range is
- 0 -> 25 ms. Defaults to 5.0.
- knee : float optional
- Shape of the transfert function around the threshold, specified
- in the range 0 -> 1. A value of 0 means a hard knee and a value
- of 1.0 means a softer knee. Defaults to 0.
- outputAmp : boolean, optional
- If True, the object's output signal will be the compression level
- alone, not the compressed signal. It can be useful if 2 or more
- channels need to linked on the same compression slope. Available
- at initialization only. Defaults to False.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setThresh(x) : Replace the `thresh` attribute.
- setRatio(x) : Replace the `ratio` attribute.
- setRiseTime(x) : Replace the `risetime` attribute.
- setFallTime(x) : Replace the `falltime` attribute.
- setLookAhead(x) : Replace the `lookahead` attribute.
- setKnee(x) : Replace the `knee` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- thresh : float or PyoObject. Level above which the signal is reduced.
- ratio : float or PyoObject. in/out ratio for signals above the threshold.
- risetime : float or PyoObject. Time to reach upward value in seconds.
- falltime : float or PyoObject. Time to reach downward value in seconds.
- lookahead : float. Delay length, in ms, for the "look-ahead" buffer.
- knee : float. Shape of the transfert function around the threshold.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + '/transparent.aif', loop=True)
- >>> b = Compress(a, thresh=-24, ratio=6, risetime=.01, falltime=.2, knee=0.5).mix(2).out()
-
- """
- def __init__(self, input, thresh=-20, ratio=2, risetime=0.01, falltime=0.1, lookahead=5.0, knee=0, outputAmp=False, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._thresh = thresh
- self._ratio = ratio
- self._risetime = risetime
- self._falltime = falltime
- self._lookahead = lookahead
- self._knee = knee
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, thresh, ratio, risetime, falltime, lookahead, knee, outputAmp, mul, add, lmax = convertArgsToLists(self._in_fader, thresh, ratio, risetime, falltime, lookahead, knee, outputAmp, mul, add)
- self._base_objs = [Compress_base(wrap(in_fader,i), wrap(thresh,i), wrap(ratio,i), wrap(risetime,i), wrap(falltime,i), wrap(lookahead,i), wrap(knee,i), wrap(outputAmp,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'thresh', 'ratio', 'risetime', 'falltime', 'lookahead', 'knee', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setThresh(self, x):
- """
- Replace the `thresh` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `thresh` attribute.
-
- """
- self._thresh = x
- x, lmax = convertArgsToLists(x)
- [obj.setThresh(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRatio(self, x):
- """
- Replace the `ratio` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `ratio` attribute.
-
- """
- self._ratio = x
- x, lmax = convertArgsToLists(x)
- [obj.setRatio(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRiseTime(self, x):
- """
- Replace the `risetime` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `risetime` attribute.
-
- """
- self._risetime = x
- x, lmax = convertArgsToLists(x)
- [obj.setRiseTime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFallTime(self, x):
- """
- Replace the `falltime` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `falltime` attribute.
-
- """
- self._falltime = x
- x, lmax = convertArgsToLists(x)
- [obj.setFallTime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setLookAhead(self, x):
- """
- Replace the `lookahead` attribute.
-
- Parameters:
-
- x : float
- New `lookahead` attribute.
-
- """
- self._lookahead = x
- x, lmax = convertArgsToLists(x)
- [obj.setLookAhead(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setKnee(self, x):
- """
- Replace the `knee` attribute.
-
- Parameters:
-
- x : float
- New `knee` attribute.
-
- """
- self._knee = x
- x, lmax = convertArgsToLists(x)
- [obj.setKnee(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(-60., 0., 'lin', 'thresh', self._thresh),
- SLMap(1., 10., 'lin', 'ratio', self._ratio),
- SLMap(0.001, .3, 'lin', 'risetime', self._risetime),
- SLMap(0.001, .3, 'lin', 'falltime', self._falltime),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def thresh(self):
- """float or PyoObject. Level above which the signal is reduced."""
- return self._thresh
- @thresh.setter
- def thresh(self, x): self.setThresh(x)
-
- @property
- def ratio(self):
- """float or PyoObject. in/out ratio for signals above the threshold."""
- return self._ratio
- @ratio.setter
- def ratio(self, x): self.setRatio(x)
-
- @property
- def risetime(self):
- """float or PyoObject. Time to reach upward value in seconds."""
- return self._risetime
- @risetime.setter
- def risetime(self, x): self.setRiseTime(x)
-
- @property
- def falltime(self):
- """float or PyoObject. Time to reach downward value in seconds."""
- return self._falltime
- @falltime.setter
- def falltime(self, x): self.setFallTime(x)
-
- @property
- def lookahead(self):
- """float. Delay length, in ms, for the "look-ahead" buffer."""
- return self._lookahead
- @lookahead.setter
- def lookahead(self, x): self.setLookAhead(x)
-
- @property
- def knee(self):
- """float. Shape of the transfert function around the threshold."""
- return self._knee
- @knee.setter
- def knee(self, x): self.setKnee(x)
-
-class Gate(PyoObject):
- """
- Allows a signal to pass only when its amplitude is above a set threshold.
-
- A noise gate is used when the level of the signal is below the level of
- the noise floor. The threshold is set above the level of the noise and so when
- there is no signal the gate is closed. A noise gate does not remove noise
- from the signal. When the gate is open both the signal and the noise will
- pass through.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- thresh : float or PyoObject, optional
- Level, expressed in dB, below which the gate is closed.
- Reference level is 0dB. Defaults to -70.
- risetime : float or PyoObject, optional
- Time to open the gate in seconds. Defaults to 0.01.
- falltime : float or PyoObject, optional
- Time to close the gate in seconds. Defaults to 0.05.
- lookahead : float, optional
- Delay length, in ms, for the "look-ahead" buffer. Range is
- 0 -> 25 ms. Defaults to 5.0.
- outputAmp : boolean, optional
- If True, the object's output signal will be the gating level
- alone, not the gated signal. It can be useful if 2 or more
- channels need to linked on the same gating slope. Available
- at initialization only. Defaults to False.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setThresh(x) : Replace the `thresh` attribute.
- setRiseTime(x) : Replace the `risetime` attribute.
- setFallTime(x) : Replace the `falltime` attribute.
- setLookAhead(x) : Replace the `lookahead` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- thresh : float or PyoObject. Level below which the gate is closed.
- risetime : float or PyoObject. Time to open the gate in seconds.
- falltime : float or PyoObject. Time to close the gate in seconds.
- lookahead : float. Delay length, in ms, for the "look-ahead" buffer.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH + '/transparent.aif', speed=[1,.5], loop=True)
- >>> gt = Gate(sf, thresh=-24, risetime=0.005, falltime=0.01, lookahead=5, mul=.4).out()
-
- """
- def __init__(self, input, thresh=-70, risetime=0.01, falltime=0.05, lookahead=5.0, outputAmp=False, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._thresh = thresh
- self._risetime = risetime
- self._falltime = falltime
- self._lookahead = lookahead
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, thresh, risetime, falltime, lookahead, outputAmp, mul, add, lmax = convertArgsToLists(self._in_fader, thresh, risetime, falltime, lookahead, outputAmp, mul, add)
- self._base_objs = [Gate_base(wrap(in_fader,i), wrap(thresh,i), wrap(risetime,i), wrap(falltime,i), wrap(lookahead,i), wrap(outputAmp,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'thresh', 'risetime', 'falltime', 'lookahead', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setThresh(self, x):
- """
- Replace the `thresh` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `thresh` attribute.
-
- """
- self._thresh = x
- x, lmax = convertArgsToLists(x)
- [obj.setThresh(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRiseTime(self, x):
- """
- Replace the `risetime` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `risetime` attribute.
-
- """
- self._risetime = x
- x, lmax = convertArgsToLists(x)
- [obj.setRiseTime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFallTime(self, x):
- """
- Replace the `falltime` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `falltime` attribute.
-
- """
- self._falltime = x
- x, lmax = convertArgsToLists(x)
- [obj.setFallTime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setLookAhead(self, x):
- """
- Replace the `lookahead` attribute.
-
- Parameters:
-
- x : float
- New `lookahead` attribute.
-
- """
- self._lookahead = x
- x, lmax = convertArgsToLists(x)
- [obj.setLookAhead(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(-100., 0., 'lin', 'thresh', self._thresh),
- SLMap(0.0001, .3, 'lin', 'risetime', self._risetime),
- SLMap(0.0001, .3, 'lin', 'falltime', self._falltime),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def thresh(self):
- """float or PyoObject. Level below which the gate is closed."""
- return self._thresh
- @thresh.setter
- def thresh(self, x): self.setThresh(x)
-
- @property
- def risetime(self):
- """float or PyoObject. Time to open the gate in seconds."""
- return self._risetime
- @risetime.setter
- def risetime(self, x): self.setRiseTime(x)
-
- @property
- def falltime(self):
- """float or PyoObject. Time to close the gate in seconds."""
- return self._falltime
- @falltime.setter
- def falltime(self, x): self.setFallTime(x)
-
- @property
- def lookahead(self):
- """float. Delay length, in ms, for the "look-ahead" buffer."""
- return self._lookahead
- @lookahead.setter
- def lookahead(self, x): self.setLookAhead(x)
-
-class Balance(PyoObject):
- """
- Adjust rms power of an audio signal according to the rms power of another.
-
- The rms power of a signal is adjusted to match that of a comparator signal.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- input2 : PyoObject
- Comparator signal.
- freq : float or PyoObject, optional
- Cutoff frequency of the lowpass filter in hertz. Default to 10.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setInput2(x, fadetime) : Replace the `input2` attribute.
- setFreq(x) : Replace the `freq` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- input2 : PyoObject. Comparator signal.
- freq : float or PyoObject. Cutoff frequency of the lowpass filter.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH + '/accord.aif', speed=[.99,1], loop=True, mul=.3)
- >>> comp = SfPlayer(SNDS_PATH + '/transparent.aif', speed=[.99,1], loop=True, mul=.3)
- >>> out = Balance(sf, comp, freq=10).out()
-
- """
- def __init__(self, input, input2, freq=10, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._input2 = input2
- self._freq = freq
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- self._in_fader2 = InputFader(input2)
- in_fader, in_fader2, freq, mul, add, lmax = convertArgsToLists(self._in_fader, self._in_fader2, freq, mul, add)
- self._base_objs = [Balance_base(wrap(in_fader,i), wrap(in_fader2,i), wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'input2', 'freq', 'mul', 'add']
-
- def setInput(self, x, fadetime=0.05):
- """
- Replace the `input` attribute.
-
- Input signal to process.
-
- Parameters:
-
- x : PyoObject
- New signal to process.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setInput2(self, x, fadetime=0.05):
- """
- Replace the `input2` attribute.
-
- Comparator signal.
-
- Parameters:
-
- x : PyoObject
- New signal to process.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._input2 = x
- self._in_fader2.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Cutoff frequency of the lowpass filter, in Hertz.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(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, 100., "log", "freq", self._freq), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def input2(self):
- """PyoObject. Comparator signal."""
- return self._input2
- @input2.setter
- def input2(self, x): self.setInput2(x)
-
- @property
- def freq(self):
- """float or PyoObject. Cutoff frequency of the lowpass filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/effects.py b/build/lib.linux-x86_64-2.7/pyolib/effects.py
deleted file mode 100644
index 97deb7e..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/effects.py
+++ /dev/null
@@ -1,1396 +0,0 @@
-"""
-Objects to perform specific audio signal processing effects such
-as distortions, delays, chorus and reverbs.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-
-class Disto(PyoObject):
- """
- Arc tangent distortion.
-
- Apply an arc tangent distortion with controllable drive to the input signal.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- drive : float or PyoObject, optional
- Amount of distortion applied to the signal, between 0 and 1.
- Defaults to 0.75.
- slope : float or PyoObject, optional
- Slope of the lowpass filter applied after distortion,
- between 0 and 1. Defaults to 0.5.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setDrive(x) : Replace the `drive` attribute.
- setSlope(x) : Replace the `slope` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- drive : float or PyoObject. Amount of distortion.
- slope : float or PyoObject. Slope of the lowpass filter.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True)
- >>> lfo = Sine(freq=[.2,.25], mul=.5, add=.5)
- >>> d = Disto(a, drive=lfo, slope=.8, mul=.15).out()
-
- """
- def __init__(self, input, drive=.75, slope=.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._drive = drive
- self._slope = slope
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, drive, slope, mul, add, lmax = convertArgsToLists(self._in_fader, drive, slope, mul, add)
- self._base_objs = [Disto_base(wrap(in_fader,i), wrap(drive,i), wrap(slope,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'drive', 'slope', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setDrive(self, x):
- """
- Replace the `drive` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `drive` attribute.
-
- """
- self._drive = x
- x, lmax = convertArgsToLists(x)
- [obj.setDrive(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSlope(self, x):
- """
- Replace the `slope` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `slope` attribute.
-
- """
- self._slope = x
- x, lmax = convertArgsToLists(x)
- [obj.setSlope(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', 'drive', self._drive),
- SLMap(0., 0.999, 'lin', 'slope', self._slope),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def drive(self):
- """float or PyoObject. Amount of distortion."""
- return self._drive
- @drive.setter
- def drive(self, x): self.setDrive(x)
-
- @property
- def slope(self):
- """float or PyoObject. Slope of the lowpass filter."""
- return self._slope
- @slope.setter
- def slope(self, x): self.setSlope(x)
-
-class Delay(PyoObject):
- """
- Sweepable recursive delay.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to delayed.
- delay : float or PyoObject, optional
- Delay time in seconds. Defaults to 0.25.
- feedback : float or PyoObject, optional
- Amount of output signal sent back into the delay line.
- Defaults to 0.
- maxdelay : float, optional
- Maximum delay length in seconds. Available only at initialization.
- Defaults to 1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setDelay(x) : Replace the `delay` attribute.
- setFeedback(x) : Replace the `feedback` attribute.
- reset() : Reset the memory buffer to zeros.
-
- Attributes:
-
- input : PyoObject. Input signal to delayed.
- delay : float or PyoObject. Delay time in seconds.
- feedback : float or PyoObject. Amount of output signal sent back
- into the delay line.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True, mul=.3).mix(2).out()
- >>> d = Delay(a, delay=[.15,.2], feedback=.5, mul=.4).out()
-
- """
- def __init__(self, input, delay=0.25, feedback=0, maxdelay=1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._delay = delay
- self._feedback = feedback
- self._maxdelay = maxdelay
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, delay, feedback, maxdelay, mul, add, lmax = convertArgsToLists(self._in_fader, delay, feedback, maxdelay, mul, add)
- self._base_objs = [Delay_base(wrap(in_fader,i), wrap(delay,i), wrap(feedback,i), wrap(maxdelay,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'delay', 'feedback', 'mul', 'add']
-
- def setInput(self, x, fadetime=0.05):
- """
- Replace the `input` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to delayed.
- fadetime : float, optional
- Crossfade time between old and new input. Defaults to 0.05.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setDelay(self, x):
- """
- Replace the `delay` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `delay` attribute.
-
- """
- self._delay = x
- x, lmax = convertArgsToLists(x)
- [obj.setDelay(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFeedback(self, x):
- """
- Replace the `feedback` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `feedback` attribute.
-
- """
- self._feedback = x
- x, lmax = convertArgsToLists(x)
- [obj.setFeedback(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self):
- """
- Reset the memory buffer to zeros.
-
- """
- [obj.reset() for obj in self._base_objs]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0.001, self._maxdelay, 'log', 'delay', self._delay),
- SLMap(0., 1., 'lin', 'feedback', self._feedback),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to delayed."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def delay(self):
- """float or PyoObject. Delay time in seconds."""
- return self._delay
- @delay.setter
- def delay(self, x): self.setDelay(x)
-
- @property
- def feedback(self):
- """float or PyoObject. Amount of output signal sent back into the delay line."""
- return self._feedback
- @feedback.setter
- def feedback(self, x): self.setFeedback(x)
-
-class SDelay(PyoObject):
- """
- Simple delay without interpolation.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to delayed.
- delay : float or PyoObject, optional
- Delay time in seconds. Defaults to 0.25.
- maxdelay : float, optional
- Maximum delay length in seconds. Available only at initialization.
- Defaults to 1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setDelay(x) : Replace the `delay` attribute.
- reset() : Reset the memory buffer to zeros.
-
- Attributes:
-
- input : PyoObject. Input signal to delayed.
- delay : float or PyoObject. Delay time in seconds.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> srPeriod = 1. / s.getSamplingRate()
- >>> dlys = [srPeriod * i * 5 for i in range(1, 7)]
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True)
- >>> d = SDelay(a, delay=dlys, mul=.1).out(1)
-
- """
- def __init__(self, input, delay=0.25, maxdelay=1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._delay = delay
- self._maxdelay = maxdelay
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, delay, maxdelay, mul, add, lmax = convertArgsToLists(self._in_fader, delay, maxdelay, mul, add)
- self._base_objs = [SDelay_base(wrap(in_fader,i), wrap(delay,i), wrap(maxdelay,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'delay', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setDelay(self, x):
- """
- Replace the `delay` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `delay` attribute.
-
- """
- self._delay = x
- x, lmax = convertArgsToLists(x)
- [obj.setDelay(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self):
- """
- Reset the memory buffer to zeros.
-
- """
- [obj.reset() for obj in self._base_objs]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0.001, self._maxdelay, 'log', 'delay', self._delay),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to delayed."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def delay(self):
- """float or PyoObject. Delay time in seconds."""
- return self._delay
- @delay.setter
- def delay(self, x): self.setDelay(x)
-
-class Waveguide(PyoObject):
- """
- Basic waveguide model.
-
- This waveguide model consisting of one delay-line with a simple
- lowpass filtering and lagrange interpolation.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Frequency, in cycle per second, of the waveguide (i.e. the inverse
- of delay time). Defaults to 100.
- dur : float or PyoObject, optional
- Duration, in seconds, for the waveguide to drop 40 dB below it's
- maxima. Defaults to 10.
- minfreq : float, optional
- Minimum possible frequency, used to initialized delay length.
- Available only at initialization. Defaults to 20.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setDur(x) : Replace the `dur` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Frequency in cycle per second.
- dur : float or PyoObject. Resonance duration in seconds.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH + '/transparent.aif', speed=[.98,1.02], loop=True)
- >>> gt = Gate(sf, thresh=-24, risetime=0.005, falltime=0.01, lookahead=5, mul=.2)
- >>> w = Waveguide(gt, freq=[60,120.17,180.31,240.53], dur=20, minfreq=20, mul=.4).out()
-
- """
- def __init__(self, input, freq=100, dur=10, minfreq=20, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._dur = dur
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, dur, minfreq, mul, add, lmax = convertArgsToLists(self._in_fader, freq, dur, minfreq, mul, add)
- self._base_objs = [Waveguide_base(wrap(in_fader,i), wrap(freq,i), wrap(dur,i), wrap(minfreq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'dur', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDur(self, x):
- """
- Replace the `dur` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `dur` attribute.
-
- """
- self._dur = x
- x, lmax = convertArgsToLists(x)
- [obj.setDur(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(10, 500., 'log', 'freq', self._freq),
- SLMapDur(self._dur),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycle per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def dur(self):
- """float or PyoObject. Resonance duration in seconds."""
- return self._dur
- @dur.setter
- def dur(self, x): self.setDur(x)
-
-class AllpassWG(PyoObject):
- """
- Out of tune waveguide model with a recursive allpass network.
-
- This waveguide model consisting of one delay-line with a 3-stages recursive
- allpass filter which made the resonances of the waveguide out of tune.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Frequency, in cycle per second, of the waveguide (i.e. the inverse
- of delay time). Defaults to 100.
- feed : float or PyoObject, optional
- Amount of output signal (between 0 and 1) sent back into the delay line.
- Defaults to 0.95.
- detune : float or PyoObject, optional
- Control the depth of the allpass delay-line filter, i.e. the depth of
- the detuning. Should be in the range 0 to 1. Defaults to 0.5.
- minfreq : float, optional
- Minimum possible frequency, used to initialized delay length.
- Available only at initialization. Defaults to 20.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setFeed(x) : Replace the `feed` attribute.
- setDetune(x) : Replace the `detune` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Frequency in cycle per second.
- feed : float or PyoObject. Amount of output signal sent back into the delay line.
- detune : float or PyoObject. Depth of the detuning.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH + '/transparent.aif', speed=[.98,1.02], loop=True)
- >>> gt = Gate(sf, thresh=-24, risetime=0.005, falltime=0.01, lookahead=5, mul=.2)
- >>> rnd = Randi(min=.5, max=1.0, freq=[.13,.22,.155,.171])
- >>> rnd2 = Randi(min=.95, max=1.05, freq=[.145,.2002,.1055,.071])
- >>> fx = AllpassWG(gt, freq=rnd2*[74.87,75,75.07,75.21], feed=1, detune=rnd, mul=.15).out()
-
- """
- def __init__(self, input, freq=100, feed=0.95, detune=0.5, minfreq=20, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._feed = feed
- self._detune = detune
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, feed, detune, minfreq, mul, add, lmax = convertArgsToLists(self._in_fader, freq, feed, detune, minfreq, mul, add)
- self._base_objs = [AllpassWG_base(wrap(in_fader,i), wrap(freq,i), wrap(feed,i), wrap(detune,i), wrap(minfreq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'feed', 'detune', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFeed(self, x):
- """
- Replace the `feed` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `feed` attribute.
-
- """
- self._feed = x
- x, lmax = convertArgsToLists(x)
- [obj.setFeed(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDetune(self, x):
- """
- Replace the `detune` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `detune` attribute.
-
- """
- self._detune = x
- x, lmax = convertArgsToLists(x)
- [obj.setDetune(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(20., 500., 'log', 'freq', self._freq),
- SLMap(0., 1., 'lin', 'feed', self._feed),
- SLMap(0., 1., 'lin', 'detune', self._detune),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycle per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def feed(self):
- """float or PyoObject. Amount of output signal sent back into the delay line."""
- return self._feed
- @feed.setter
- def feed(self, x): self.setFeed(x)
-
- @property
- def detune(self):
- """float or PyoObject. Depth of the detuning."""
- return self._detune
- @detune.setter
- def detune(self, x): self.setDetune(x)
-
-class Freeverb(PyoObject):
- """
- Implementation of Jezar's Freeverb.
-
- Freeverb is a reverb unit generator based on Jezar's public domain
- C++ sources, composed of eight parallel comb filters, followed by four
- allpass units in series. Filters on each stream are slightly detuned
- in order to create multi-channel effects.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- size : float or PyoObject, optional
- Controls the length of the reverb, between 0 and 1. A higher
- value means longer reverb. Defaults to 0.5.
- damp : float or PyoObject, optional
- High frequency attenuation, between 0 and 1. A higher value
- will result in a faster decay of the high frequency range.
- Defaults to 0.5.
- bal : float or PyoObject, optional
- Balance between wet and dry signal, between 0 and 1. 0 means no
- reverb. Defaults to 0.5.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setSize(x) : Replace the `size` attribute.
- setDamp(x) : Replace the `damp` attribute.
- setBal(x) : Replace the `bal` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- size : float or PyoObject. Room size.
- damp : float or PyoObject. High frequency damping.
- bal : float or PyoObject. Balance between wet and dry signal.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True, mul=.4)
- >>> b = Freeverb(a, size=[.79,.8], damp=.9, bal=.3).out()
-
- """
- def __init__(self, input, size=.5, damp=.5, bal=.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._size = size
- self._damp = damp
- self._bal = bal
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, size, damp, bal, mul, add, lmax = convertArgsToLists(self._in_fader, size, damp, bal, mul, add)
- self._base_objs = [Freeverb_base(wrap(in_fader,i), wrap(size,i), wrap(damp,i), wrap(bal,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'size', 'damp', 'bal', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setSize(self, x):
- """
- Replace the `size` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `size` attribute.
-
- """
- self._size = x
- x, lmax = convertArgsToLists(x)
- [obj.setSize(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDamp(self, x):
- """
- Replace the `damp` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `damp` attribute.
-
- """
- self._damp = x
- x, lmax = convertArgsToLists(x)
- [obj.setDamp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setBal(self, x):
- """
- Replace the `bal` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `bal` attribute.
-
- """
- self._bal = x
- x, lmax = convertArgsToLists(x)
- [obj.setMix(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', 'size', self._size),
- SLMap(0., 1., 'lin', 'damp', self._damp),
- SLMap(0., 1., 'lin', 'bal', self._bal),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def size(self):
- """float or PyoObject. Room size."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def damp(self):
- """float or PyoObject. High frequency damping."""
- return self._damp
- @damp.setter
- def damp(self, x): self.setDamp(x)
-
- @property
- def bal(self):
- """float or PyoObject. Balance between wet and dry signal."""
- return self._bal
- @bal.setter
- def bal(self, x): self.setBal(x)
-
-class Convolve(PyoObject):
- """
- Implements filtering using circular convolution.
-
- A circular convolution is defined as the integral of the product of two
- functions after one is reversed and shifted.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- table : PyoTableObject
- Table containning the impulse response.
- size : int
- Length, in samples, of the convolution. Available at initialization
- time only. If the table changes during the performance, its size
- must egal or greater than this value. If greater only the first
- `size` samples will be used.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setTable(x) : Replace the `table` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- table : PyoTableObject. Table containning the impulse response.
-
- Notes :
-
- Convolution is very expensive to compute, so the impulse response must
- be kept very short to run in real time.
-
- Usually convolution generates a high amplitude level, take care of the
- `mul` parameter!
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> snd = SNDS_PATH + '/transparent.aif'
- >>> sf = SfPlayer(snd, speed=[.999,1], loop=True, mul=.25).out()
- >>> a = Convolve(sf, SndTable(SNDS_PATH+'/accord.aif'), size=512, mul=.2).out()
-
- """
- def __init__(self, input, table, size, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._table = table
- self._size = size
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, table, size, mul, add, lmax = convertArgsToLists(self._in_fader, table, size, mul, add)
- self._base_objs = [Convolve_base(wrap(in_fader,i), wrap(table,i), wrap(size,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'table', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to filter."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the impulse response."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
-class WGVerb(PyoObject):
- """
- 8 delay line mono FDN reverb.
-
- 8 delay line FDN reverb, with feedback matrix based upon physical
- modeling scattering junction of 8 lossless waveguides of equal
- characteristic impedance.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- feedback : float or PyoObject, optional
- Amount of output signal sent back into the delay lines.
- 0.6 gives a good small "live" room sound, 0.8 a small hall,
- and 0.9 a large hall. Defaults to 0.5.
- cutoff : float or PyoObject, optional
- cutoff frequency of simple first order lowpass filters in the
- feedback loop of delay lines, in Hz. Defaults to 5000.
- bal : float or PyoObject, optional
- Balance between wet and dry signal, between 0 and 1. 0 means no
- reverb. Defaults to 0.5.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFeedback(x) : Replace the `feedback` attribute.
- setCutoff(x) : Replace the `cutoff` attribute.
- setBal(x) : Replace the `bal` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- feedback : float or PyoObject. Amount of output signal sent back
- into the delay line.
- cutoff : float or PyoObject. Internal lowpass filter cutoff
- frequency in Hz.
- bal : float or PyoObject. Balance between wet and dry signal.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True)
- >>> d = WGVerb(a, feedback=[.74,.75], cutoff=5000, bal=.25, mul=.3).out()
-
- """
- def __init__(self, input, feedback=0.5, cutoff=5000, bal=0.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._feedback = feedback
- self._cutoff = cutoff
- self._bal = bal
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, feedback, cutoff, bal, mul, add, lmax = convertArgsToLists(self._in_fader, feedback, cutoff, bal, mul, add)
- self._base_objs = [WGVerb_base(wrap(in_fader,i), wrap(feedback,i), wrap(cutoff,i), wrap(bal,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'feedback', 'cutoff', 'bal', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFeedback(self, x):
- """
- Replace the `feedback` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `feedback` attribute.
-
- """
- self._feedback = x
- x, lmax = convertArgsToLists(x)
- [obj.setFeedback(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setCutoff(self, x):
- """
- Replace the `cutoff` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `cutoff` attribute.
-
- """
- self._cutoff = x
- x, lmax = convertArgsToLists(x)
- [obj.setCutoff(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setBal(self, x):
- """
- Replace the `bal` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `bal` attribute.
-
- """
- self._bal = x
- x, lmax = convertArgsToLists(x)
- [obj.setMix(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', 'feedback', self._feedback),
- SLMap(500., 15000., 'log', 'cutoff', self._cutoff),
- SLMap(0., 1., 'lin', 'bal', self._bal),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def feedback(self):
- """float or PyoObject. Amount of output signal sent back into the delay line."""
- return self._feedback
- @feedback.setter
- def feedback(self, x): self.setFeedback(x)
-
- @property
- def cutoff(self):
- """float or PyoObject. Lowpass filter cutoff in Hz."""
- return self._cutoff
- @cutoff.setter
- def cutoff(self, x): self.setCutoff(x)
-
- @property
- def bal(self):
- """float or PyoObject. wet - dry balance."""
- return self._bal
- @bal.setter
- def bal(self, x): self.setBal(x)
-
-class Chorus(PyoObject):
- """
- 8 modulated delay lines chorus processor.
-
- A chorus effect occurs when individual sounds with roughly the same timbre and
- nearly (but never exactly) the same pitch converge and are perceived as one.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- depth : float or PyoObject, optional
- Chorus depth, between 0 and 5. Defaults to 1.
- feedback : float or PyoObject, optional
- Amount of output signal sent back into the delay lines.
- Defaults to 0.25.
- bal : float or PyoObject, optional
- Balance between wet and dry signals, between 0 and 1. 0 means no
- chorus. Defaults to 0.5.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setDepth(x) : Replace the `depth` attribute.
- setFeedback(x) : Replace the `feedback` attribute.
- setBal(x) : Replace the `bal` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- depth : float or PyoObject. Chorus depth, between 0 and 5.
- feedback : float or PyoObject. Amount of output signal sent back
- into the delay line.
- bal : float or PyoObject. Balance between wet and dry signal.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH + '/transparent.aif', loop=True, mul=.5)
- >>> chor = Chorus(sf, depth=[1.5,1.6], feedback=0.5, bal=0.5).out()
-
- """
- def __init__(self, input, depth=1, feedback=0.25, bal=0.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._depth = depth
- self._feedback = feedback
- self._bal = bal
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, depth, feedback, bal, mul, add, lmax = convertArgsToLists(self._in_fader, depth, feedback, bal, mul, add)
- self._base_objs = [Chorus_base(wrap(in_fader,i), wrap(depth,i), wrap(feedback,i), wrap(bal,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'depth', 'feedback', 'bal', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setDepth(self, x):
- """
- Replace the `depth` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `depth` attribute.
-
- """
- self._depth = x
- x, lmax = convertArgsToLists(x)
- [obj.setDepth(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFeedback(self, x):
- """
- Replace the `feedback` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `feedback` attribute.
-
- """
- self._feedback = x
- x, lmax = convertArgsToLists(x)
- [obj.setFeedback(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setBal(self, x):
- """
- Replace the `bal` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `bal` attribute.
-
- """
- self._bal = x
- x, lmax = convertArgsToLists(x)
- [obj.setMix(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., 5., 'lin', 'depth', self._depth),
- SLMap(0., 1., 'lin', 'feedback', self._feedback),
- SLMap(0., 1., 'lin', 'bal', self._bal),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def depth(self):
- """float or PyoObject. Chorus depth, between 0 and 5."""
- return self._depth
- @depth.setter
- def depth(self, x): self.setDepth(x)
-
- @property
- def feedback(self):
- """float or PyoObject. Amount of output signal sent back into the delay lines."""
- return self._feedback
- @feedback.setter
- def feedback(self, x): self.setFeedback(x)
-
- @property
- def bal(self):
- """float or PyoObject. wet - dry balance."""
- return self._bal
- @bal.setter
- def bal(self, x): self.setBal(x)
-
-class Harmonizer(PyoObject):
- """
- Generates harmonizing voices in synchrony with its audio input.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- transpo : float or PyoObject, optional
- Transposition factor in semitone. Defaults to -7.0.
- feedback : float or PyoObject, optional
- Amount of output signal sent back into the delay line.
- Defaults to 0.
- winsize : float, optional
- Window size in seconds (max = 1.0).
- Defaults to 0.1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setTranspo(x) : Replace the `transpo` attribute.
- setFeedback(x) : Replace the `feedback` attribute.
- setWinsize(x) : Replace the `winsize` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal.
- transpo : float or PyoObject. Transposition factor in semitone.
- feedback : float or PyoObject. Amount of output signal sent back
- into the delay line.
- winsize : float. Window size in seconds (max = 1.0).
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH + '/transparent.aif', loop=True, mul=.3).out()
- >>> harm = Harmonizer(sf, transpo=-5, winsize=0.05).out(1)
-
- """
- def __init__(self, input, transpo=-7.0, feedback=0, winsize=0.1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._transpo = transpo
- self._feedback = feedback
- self._winsize = winsize
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, transpo, feedback, winsize, mul, add, lmax = convertArgsToLists(self._in_fader, transpo, feedback, winsize, mul, add)
- self._base_objs = [Harmonizer_base(wrap(in_fader,i), wrap(transpo,i), wrap(feedback,i), wrap(winsize,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'transpo', 'feedback', 'winsize', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setTranspo(self, x):
- """
- Replace the `transpo` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `transpo` attribute.
-
- """
- self._transpo = x
- x, lmax = convertArgsToLists(x)
- [obj.setTranspo(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFeedback(self, x):
- """
- Replace the `feedback` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `feedback` attribute.
-
- """
- self._feedback = x
- x, lmax = convertArgsToLists(x)
- [obj.setFeedback(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setWinsize(self, x):
- """
- Replace the `winsize` attribute.
-
- Parameters:
-
- x : float
- New `winsize` attribute.
-
- """
- self._winsize = x
- x, lmax = convertArgsToLists(x)
- [obj.setWinsize(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(-24.0, 24.0, 'lin', 'transpo', self._transpo),
- SLMap(0., 1., 'lin', 'feedback', self._feedback),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to delayed."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def transpo(self):
- """float or PyoObject. Transposition factor in semitone."""
- return self._transpo
- @transpo.setter
- def transpo(self, x): self.setTranspo(x)
-
- @property
- def feedback(self):
- """float or PyoObject. Amount of output signal sent back into the delay line."""
- return self._feedback
- @feedback.setter
- def feedback(self, x): self.setFeedback(x)
-
- @property
- def winsize(self):
- """float. Window size in seconds (max = 1.0)."""
- return self._winsize
- @winsize.setter
- def winsize(self, x): self.setWinsize(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/filters.py b/build/lib.linux-x86_64-2.7/pyolib/filters.py
deleted file mode 100644
index ed0d3c0..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/filters.py
+++ /dev/null
@@ -1,2915 +0,0 @@
-"""
-Different kinds of audio filtering operations.
-
-An audio filter is designed to amplify, pass or attenuate (negative amplification)
-some frequency ranges. Common types include low-pass, which pass through
-frequencies below their cutoff frequencies, and progressively attenuates
-frequencies above the cutoff frequency. A high-pass filter does the opposite,
-passing high frequencies above the cutoff frequency, and progressively
-attenuating frequencies below the cutoff frequency. A bandpass filter passes
-frequencies between its two cutoff frequencies, while attenuating those outside
-the range. A band-reject filter, attenuates frequencies between its two cutoff
-frequencies, while passing those outside the 'reject' range.
-
-An all-pass filter, passes all frequencies, but affects the phase of any given
-sinusoidal component according to its frequency.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-
-class Biquad(PyoObject):
- """
- A sweepable general purpose biquadratic digital filter.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Cutoff or center frequency of the filter. Defaults to 1000.
- q : float or PyoObject, optional
- Q of the filter, defined (for bandpass filters) as freq/bandwidth.
- Should be between 1 and 500. Defaults to 1.
- type : int, optional
- Filter type. Five possible values :
- 0 = lowpass (default)
- 1 = highpass
- 2 = bandpass
- 3 = bandstop
- 4 = allpass
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setQ(x) : Replace the `q` attribute.
- setType(x) : Replace the `type` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Cutoff or center frequency of the filter.
- q : float or PyoObject. Q of the filter.
- type : int. Filter type.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(mul=.7)
- >>> lfo = Sine(freq=[.2, .25], mul=1000, add=1000)
- >>> f = Biquad(a, freq=lfo, q=5, type=2).out()
-
- """
- def __init__(self, input, freq=1000, q=1, type=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._q = q
- self._type = type
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, q, type, mul, add, lmax = convertArgsToLists(self._in_fader, freq, q, type, mul, add)
- self._base_objs = [Biquad_base(wrap(in_fader,i), wrap(freq,i), wrap(q,i), wrap(type,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'q', 'type', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setQ(self, x):
- """
- Replace the `q` attribute. Should be between 1 and 500.
-
- Parameters:
-
- x : float or PyoObject
- New `q` attribute.
-
- """
- self._q = x
- x, lmax = convertArgsToLists(x)
- [obj.setQ(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setType(self, x):
- """
- Replace the `type` attribute.
-
- Parameters:
-
- x : int
- New `type` attribute.
- 0 = lowpass, 1 = highpass, 2 = bandpass, 3 = bandstop, 4 = allpass
-
- """
- self._type = x
- x, lmax = convertArgsToLists(x)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMapQ(self._q), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Cutoff or center frequency of the filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def q(self):
- """float or PyoObject. Q of the filter."""
- return self._q
- @q.setter
- def q(self, x): self.setQ(x)
-
- @property
- def type(self):
- """int. Filter type."""
- return self._type
- @type.setter
- def type(self, x): self.setType(x)
-
-class Biquadx(PyoObject):
- """
- A multi-stages sweepable general purpose biquadratic digital filter.
-
- Biquadx is equivalent to a filter consisting of more layers of Biquad
- with the same arguments, serially connected. It is faster than using
- a large number of instances of the Biquad object, It uses less memory
- and allows filters with sharper cutoff.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Cutoff or center frequency of the filter. Defaults to 1000.
- q : float or PyoObject, optional
- Q of the filter, defined (for bandpass filters) as freq/bandwidth.
- Should be between 1 and 500. Defaults to 1.
- type : int, optional
- Filter type. Five possible values :
- 0 = lowpass (default)
- 1 = highpass
- 2 = bandpass
- 3 = bandstop
- 4 = allpass
- stages : int, optional
- The number of filtering stages in the filter stack. Defaults to 4.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setQ(x) : Replace the `q` attribute.
- setType(x) : Replace the `type` attribute.
- setStages(x) : Replace the `stages` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Cutoff or center frequency of the filter.
- q : float or PyoObject. Q of the filter.
- type : int. Filter type.
- stages : int. The number of filtering stages.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(mul=.7)
- >>> lfo = Sine(freq=[.2, .25], mul=1000, add=1500)
- >>> f = Biquadx(a, freq=lfo, q=5, type=2).out()
-
- """
- def __init__(self, input, freq=1000, q=1, type=0, stages=4, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._q = q
- self._type = type
- self._stages = stages
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, q, type, stages, mul, add, lmax = convertArgsToLists(self._in_fader, freq, q, type, stages, mul, add)
- self._base_objs = [Biquadx_base(wrap(in_fader,i), wrap(freq,i), wrap(q,i), wrap(type,i), wrap(stages,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'q', 'type', 'stages', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setQ(self, x):
- """
- Replace the `q` attribute. Should be between 1 and 500.
-
- Parameters:
-
- x : float or PyoObject
- New `q` attribute.
-
- """
- self._q = x
- x, lmax = convertArgsToLists(x)
- [obj.setQ(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setType(self, x):
- """
- Replace the `type` attribute.
-
- Parameters:
-
- x : int
- New `type` attribute.
- 0 = lowpass, 1 = highpass, 2 = bandpass, 3 = bandstop, 4 = allpass
-
- """
- self._type = x
- x, lmax = convertArgsToLists(x)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setStages(self, x):
- """
- Replace the `stages` attribute.
-
- Parameters:
-
- x : int
- New `stages` attribute.
-
- """
- self._stages = x
- x, lmax = convertArgsToLists(x)
- [obj.setStages(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMapQ(self._q), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Cutoff or center frequency of the filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def q(self):
- """float or PyoObject. Q of the filter."""
- return self._q
- @q.setter
- def q(self, x): self.setQ(x)
-
- @property
- def type(self):
- """int. Filter type."""
- return self._type
- @type.setter
- def type(self, x): self.setType(x)
-
- @property
- def stages(self):
- """int. The number of filtering stages."""
- return self._stages
- @stages.setter
- def stages(self, x): self.setStages(x)
-
-class Biquada(PyoObject):
- """
- A general purpose biquadratic digital filter (floating-point arguments).
-
- A digital biquad filter is a second-order recursive linear filter, containing
- two poles and two zeros. Biquadi is a "Direct Form 1" implementation of a Biquad
- filter:
-
- y[n] = ( b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2] ) / a0
-
- This object is directly controlled via the six coefficients, as floating-point
- values or audio stream, of the filter. There is no clipping of the values given as
- coefficients, so, unless you know what you do, it is recommended to use the Biquad
- object, which is controlled with frequency, Q and type arguments.
-
- The default values of the object give a lowpass filter with a 1000 Hz cutoff frequency.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- b0 : float or PyoObject, optional
- Amplitude of the current sample. Defaults to 0.005066.
- b1 : float or PyoObject, optional
- Amplitude of the first input sample delayed. Defaults to 0.010132.
- b2 : float or PyoObject, optional
- Amplitude of the second input sample delayed. Defaults to 0.005066.
- a0 : float or PyoObject, optional
- Overall gain coefficient. Defaults to 1.070997.
- a1 : float or PyoObject, optional
- Amplitude of the first output sample delayed. Defaults to -1.979735.
- a2 : float or PyoObject, optional
- Amplitude of the second output sample delayed. Defaults to 0.929003.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setB0(x) : Replace the `b0` attribute.
- setB1(x) : Replace the `b1` attribute.
- setB2(x) : Replace the `b2` attribute.
- setA0(x) : Replace the `a0` attribute.
- setA1(x) : Replace the `a1` attribute.
- setA2(x) : Replace the `a2` attribute.
- setCoeffs(b0, b1, b2, a0, a1, a2) : Replace all filter's coefficients.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- b0 : float or PyoObject. Amplitude of the current sample.
- b1 : float or PyoObject. Amplitude of the first input sample delayed.
- b2 : float or PyoObject. Amplitude of the second input sample delayed.
- a0 : float or PyoObject. Overall gain coefficient.
- a1 : float or PyoObject. Amplitude of the first output sample delayed.
- a2 : float or PyoObject. Amplitude of the second output sample delayed.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(mul=.7)
- >>> lf = Sine([1.5, 2], mul=.07, add=-1.9)
- >>> f = Biquada(a, 0.005066, 0.010132, 0.005066, 1.070997, lf, 0.929003).out()
-
- """
- def __init__(self, input, b0=0.005066, b1=0.010132, b2=0.005066, a0=1.070997, a1=-1.979735, a2=0.929003, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._b0 = Sig(b0)
- self._b1 = Sig(b1)
- self._b2 = Sig(b2)
- self._a0 = Sig(a0)
- self._a1 = Sig(a1)
- self._a2 = Sig(a2)
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, b0, b1, b2, a0, a1, a2, mul, add, lmax = convertArgsToLists(self._in_fader, self._b0, self._b1, self._b2, self._a0, self._a1, self._a2, mul, add)
- self._base_objs = [Biquada_base(wrap(in_fader,i), wrap(b0,i), wrap(b1,i), wrap(b2,i), wrap(a0,i), wrap(a1,i), wrap(a2,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'b0', 'b1', 'b2', 'a0', 'a1', 'a2', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setB0(self, x):
- """
- Replace the `b0` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `b0` attribute.
-
- """
- self._b0.value = x
-
- def setB1(self, x):
- """
- Replace the `b1` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `b1` attribute.
-
- """
- self._b1.value = x
-
- def setB2(self, x):
- """
- Replace the `b2` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `b2` attribute.
-
- """
- self._b2.value = x
-
- def setA0(self, x):
- """
- Replace the `a0` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `a0` attribute.
-
- """
- self._a0.value = x
-
- def setA1(self, x):
- """
- Replace the `a1` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `a1` attribute.
-
- """
- self._a1.value = x
-
- def setA2(self, x):
- """
- Replace the `a2` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `a2` attribute.
-
- """
- self._a2.value = x
-
- def setCoeffs(self, *args, **kwds):
- """
- Replace all filter coefficients.
-
- Parameters:
-
- b0 : float or PyoObject, optional
- New `b0` attribute.
- b1 : float or PyoObject, optional
- New `b1` attribute.
- b2 : float or PyoObject, optional
- New `b2` attribute.
- a0 : float or PyoObject, optional
- New `a0` attribute.
- a1 : float or PyoObject, optional
- New `a1` attribute.
- a2 : float or PyoObject, optional
- New `a2` attribute.
-
- """
- for i, val in enumerate(args):
- attr = getattr(self, ["_b0", "_b1", "_b2", "_a0", "_a1", "_a2"][i])
- attr.value = val
- for key in kwds.keys():
- if hasattr(self, key):
- attr = getattr(self, "_"+key)
- attr.value = kwds[key]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def b0(self):
- """float or PyoObject. b0 coefficient."""
- return self._b0
- @b0.setter
- def b0(self, x): self.setB0(x)
-
- @property
- def b1(self):
- """float or PyoObject. b1 coefficient."""
- return self._b1
- @b1.setter
- def b1(self, x): self.setB1(x)
-
- @property
- def b2(self):
- """float or PyoObject. b2 coefficient."""
- return self._b2
- @b2.setter
- def b2(self, x): self.setB2(x)
-
- @property
- def a0(self):
- """float or PyoObject. a0 coefficient."""
- return self._a0
- @a0.setter
- def a0(self, x): self.setA0(x)
-
- @property
- def a1(self):
- """float or PyoObject. a1 coefficient."""
- return self._a1
- @a1.setter
- def a1(self, x): self.setA1(x)
-
- @property
- def a2(self):
- """float or PyoObject. a2 coefficient."""
- return self._a2
- @a2.setter
- def a2(self, x): self.setA2(x)
-
-class EQ(PyoObject):
- """
- Equalizer filter.
-
- EQ is a biquadratic digital filter designed for equalization. It
- provides peak/notch and lowshelf/highshelf filters for building
- parametric equalizers.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Cutoff or center frequency of the filter. Defaults to 1000.
- q : float or PyoObject, optional
- Q of the filter, defined as freq/bandwidth.
- Should be between 1 and 500. Defaults to 1.
- boost : float or PyoObject, optional
- Gain, expressed in dB, to add or remove at the center frequency.
- Default to -3.
- type : int, optional
- Filter type. Three possible values :
- 0 = peak/notch (default)
- 1 = lowshelf
- 2 = highshelf
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setQ(x) : Replace the `q` attribute.
- setBoost(x) : Replace the `boost` attribute.
- setType(x) : Replace the `type` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Cutoff or center frequency of the filter.
- q : float or PyoObject. Q of the filter.
- boost : float or PyoObject. Boost of the filter at center frequency.
- type : int. Filter type.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> amp = Fader(1, 1, mul=.15).play()
- >>> src = PinkNoise(amp)
- >>> fr = Sine(.2, 0, 500, 1500)
- >>> boo = Sine([4, 4], 0, 6)
- >>> out = EQ(src, freq=fr, q=1, boost=boo, type=0).out()
-
- """
- def __init__(self, input, freq=1000, q=1, boost=-3.0, type=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._q = q
- self._boost = boost
- self._type = type
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, q, boost, type, mul, add, lmax = convertArgsToLists(self._in_fader, freq, q, boost, type, mul, add)
- self._base_objs = [EQ_base(wrap(in_fader,i), wrap(freq,i), wrap(q,i), wrap(boost,i), wrap(type,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'q', 'boost', 'type', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setQ(self, x):
- """
- Replace the `q` attribute. Should be between 1 and 500.
-
- Parameters:
-
- x : float or PyoObject
- New `q` attribute.
-
- """
- self._q = x
- x, lmax = convertArgsToLists(x)
- [obj.setQ(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setBoost(self, x):
- """
- Replace the `boost` attribute, expressed in dB.
-
- Parameters:
-
- x : float or PyoObject
- New `boost` attribute.
-
- """
- self._boost = x
- x, lmax = convertArgsToLists(x)
- [obj.setBoost(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setType(self, x):
- """
- Replace the `type` attribute.
-
- Parameters:
-
- x : int
- New `type` attribute.
- 0 = peak, 1 = lowshelf, 2 = highshelf
-
- """
- self._type = x
- x, lmax = convertArgsToLists(x)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMapQ(self._q),
- SLMap(-40.0, 40.0, "lin", "boost", self._boost),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Cutoff or center frequency of the filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def q(self):
- """float or PyoObject. Q of the filter."""
- return self._q
- @q.setter
- def q(self, x): self.setQ(x)
-
- @property
- def boost(self):
- """float or PyoObject. Boost factor of the filter."""
- return self._boost
- @boost.setter
- def boost(self, x): self.setBoost(x)
-
- @property
- def type(self):
- """int. Filter type."""
- return self._type
- @type.setter
- def type(self, x): self.setType(x)
-
-class Tone(PyoObject):
- """
- A first-order recursive low-pass filter with variable frequency response.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Cutoff frequency of the filter in hertz. Default to 1000.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Cutoff frequency of the filter.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> n = Noise(.3)
- >>> lf = Sine(freq=.2, mul=800, add=1000)
- >>> f = Tone(n, lf).mix(2).out()
-
- """
- def __init__(self, input, freq=1000, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, mul, add, lmax = convertArgsToLists(self._in_fader, freq, mul, add)
- self._base_objs = [Tone_base(wrap(in_fader,i), wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Cutoff frequency of the filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
-class Atone(PyoObject):
- """
- A first-order recursive high-pass filter with variable frequency response.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Cutoff frequency of the filter in hertz. Default to 1000.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Cutoff frequency of the filter.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> n = Noise(.3)
- >>> lf = Sine(freq=.2, mul=5000, add=6000)
- >>> f = Atone(n, lf).mix(2).out()
-
- """
- def __init__(self, input, freq=1000, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, mul, add, lmax = convertArgsToLists(self._in_fader, freq, mul, add)
- self._base_objs = [Atone_base(wrap(in_fader,i), wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Cutoff frequency of the filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
-class Port(PyoObject):
- """
- Exponential portamento.
-
- Perform an exponential portamento on an audio signal with
- different rising and falling times.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- risetime : float or PyoObject, optional
- Time to reach upward value in seconds. Defaults to 0.05.
- falltime : float or PyoObject, optional
- Time to reach downward value in seconds. Defaults to 0.05.
- init : float, optional
- Initial state of the internal memory. Available at intialization
- time only. Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setRiseTime(x) : Replace the `risetime` attribute.
- setFallTime(x) : Replace the `falltime` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- risetime : float or PyoObject. Time to reach upward value in seconds.
- falltime : float or PyoObject. Time to reach downward value in seconds.
-
- Examples:
-
- >>> from random import uniform
- >>> s = Server().boot()
- >>> s.start()
- >>> x = Sig(value=500)
- >>> p = Port(x, risetime=.1, falltime=1)
- >>> a = Sine(freq=[p, p*1.01], mul=.2).out()
- >>> def new_freq():
- ... x.value = uniform(400, 800)
- >>> pat = Pattern(function=new_freq, time=1).play()
-
- """
- def __init__(self, input, risetime=0.05, falltime=0.05, init=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._risetime = risetime
- self._falltime = falltime
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, risetime, falltime, init, mul, add, lmax = convertArgsToLists(self._in_fader, risetime, falltime, init, mul, add)
- self._base_objs = [Port_base(wrap(in_fader,i), wrap(risetime,i), wrap(falltime,i), wrap(init,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'risetime', 'falltime', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setRiseTime(self, x):
- """
- Replace the `risetime` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `risetime` attribute.
-
- """
- self._risetime = x
- x, lmax = convertArgsToLists(x)
- [obj.setRiseTime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFallTime(self, x):
- """
- Replace the `falltime` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `falltime` attribute.
-
- """
- self._falltime = x
- x, lmax = convertArgsToLists(x)
- [obj.setFallTime(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.001, 10., 'lin', 'risetime', self._risetime),
- SLMap(0.001, 10., 'lin', 'falltime', self._falltime)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def risetime(self):
- """float or PyoObject. Time to reach upward value in seconds."""
- return self._risetime
- @risetime.setter
- def risetime(self, x): self.setRiseTime(x)
-
- @property
- def falltime(self):
- """float or PyoObject. Time to reach downward value in seconds."""
- return self._falltime
- @falltime.setter
- def falltime(self, x): self.setFallTime(x)
-
-class DCBlock(PyoObject):
- """
- Implements the DC blocking filter.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> n = Noise(.01)
- >>> w = Delay(n, delay=[0.02, 0.01], feedback=.995, mul=.5)
- >>> f = DCBlock(w).out()
-
- """
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [DCBlock_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class BandSplit(PyoObject):
- """
- Splits an input signal into multiple frequency bands.
-
- The input signal will be separated into `num` bands between `min`
- and `max` frequencies using second-order bandpass filters. Each
- band will then be assigned to an independent audio stream.
- Useful for multiband processing.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- num : int, optional
- Number of frequency bands created. Available at initialization
- time only. Defaults to 6.
- min : float, optional
- Lowest frequency. Available at initialization time only.
- Defaults to 20.
- max : float, optional
- Highest frequency. Available at initialization time only.
- Defaults to 20000.
- q : float or PyoObject, optional
- Q of the filters, defined as center frequency / bandwidth.
- Should be between 1 and 500. Defaults to 1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setQ(x) : Replace the `q` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- q : float or PyoObject. Q of the filters.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> lfos = Sine(freq=[.3,.4,.5,.6,.7,.8], mul=.5, add=.5)
- >>> n = PinkNoise(.5)
- >>> a = BandSplit(n, num=6, min=250, max=4000, q=5, mul=lfos).out()
-
- """
- def __init__(self, input, num=6, min=20, max=20000, q=1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._num = num
- self._min = min
- self._max = max
- self._q = q
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, q, lmax = convertArgsToLists(self._in_fader, q)
- self._op_duplicate = lmax
- mul, add, lmax2 = convertArgsToLists(mul, add)
- self._base_players = [BandSplitter_base(wrap(in_fader,i), num, min, max, wrap(q,i)) for i in range(lmax)]
- self._base_objs = []
- for j in range(num):
- for i in range(lmax):
- self._base_objs.append(BandSplit_base(wrap(self._base_players,i), j, wrap(mul,j), wrap(add,j)))
-
- def __dir__(self):
- return ['input', 'q', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setQ(self, x):
- """
- Replace the `q` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `q` attribute.
-
- """
- self._q = x
- x, lmax = convertArgsToLists(x)
- [obj.setQ(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapQ(self._q), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def q(self):
- """float or PyoObject. Q of the filters."""
- return self._q
- @q.setter
- def q(self, x): self.setQ(x)
-
-class FourBand(PyoObject):
- """
- Splits an input signal into four frequency bands.
-
- The input signal will be separated into 4 bands around `freqs`
- arguments using fourth-order Linkwitz-Riley lowpass and highpass
- filters. Each band will then be assigned to an independent audio
- stream. The sum of the four bands reproduces the same signal as
- the `input`. Useful for multiband processing.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq1 : float or PyoObject, optional
- First crossover frequency. First band will contain signal
- from 0 Hz to `freq1` Hz. Defaults to 150.
- freq2 : float or PyoObject, optional
- Second crossover frequency. Second band will contain signal
- from `freq1` Hz to `freq2`. `freq2` is the lower limit of the
- third band signal. Defaults to 500.
- freq3 : float or PyoObject, optional
- Third crossover frequency. It's the upper limit of the third
- band signal and fourth band will contain signal from `freq3`
- to sr/2. Defaults to 2000.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq1(x) : Replace the `freq1` attribute.
- setFreq2(x) : Replace the `freq2` attribute.
- setFreq3(x) : Replace the `freq3` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq1 : float or PyoObject. First crossover frequency.
- freq2 : float or PyoObject. Second crossover frequency.
- freq3 : float or PyoObject. Third crossover frequency.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> lfos = Sine(freq=[.3,.4,.5,.6], mul=.5, add=.5)
- >>> n = PinkNoise(.3)
- >>> a = FourBand(n, freq1=250, freq2=1000, freq3=2500, mul=lfos).out()
-
- """
- def __init__(self, input, freq1=150, freq2=500, freq3=2000, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq1 = freq1
- self._freq2 = freq2
- self._freq3 = freq3
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq1, freq2, freq3, lmax = convertArgsToLists(self._in_fader, freq1, freq2, freq3)
- self._op_duplicate = lmax
- mul, add, lmax2 = convertArgsToLists(mul, add)
- self._base_players = [FourBandMain_base(wrap(in_fader,i), wrap(freq1,i), wrap(freq2,i), wrap(freq3,i)) for i in range(lmax)]
- self._base_objs = []
- for j in range(4):
- for i in range(lmax):
- self._base_objs.append(FourBand_base(wrap(self._base_players,i), j, wrap(mul,j), wrap(add,j)))
-
- def __dir__(self):
- return ['input', 'freq1', 'freq2', 'freq3', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq1(self, x):
- """
- Replace the `freq1` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq1` attribute.
-
- """
- self._freq1 = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq1(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setFreq2(self, x):
- """
- Replace the `freq2` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq2` attribute.
-
- """
- self._freq2 = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq2(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setFreq3(self, x):
- """
- Replace the `freq3` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq3` attribute.
-
- """
- self._freq3 = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq3(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(40,300,"log","freq1",self._freq1),
- SLMap(300,1000,"log","freq2",self._freq2),
- SLMap(1000,5000,"log","freq3",self._freq3),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq1(self):
- """float or PyoObject. First crossover frequency."""
- return self._freq1
- @freq1.setter
- def freq1(self, x): self.setFreq1(x)
-
- @property
- def freq2(self):
- """float or PyoObject. Second crossover frequency."""
- return self._freq2
- @freq2.setter
- def freq2(self, x): self.setFreq2(x)
-
- @property
- def freq3(self):
- """float or PyoObject. Third crossover frequency."""
- return self._freq3
- @freq3.setter
- def freq3(self, x): self.setFreq3(x)
-
-class Hilbert(PyoObject):
- """
- Hilbert transform.
-
- Hilbert is an IIR filter based implementation of a broad-band 90 degree
- phase difference network. The outputs of hilbert have an identical
- frequency response to the input (i.e. they sound the same), but the two
- outputs have a constant phase difference of 90 degrees, plus or minus some
- small amount of error, throughout the entire frequency range. The outputs
- are in quadrature.
-
- Hilbert is useful in the implementation of many digital signal processing
- techniques that require a signal in phase quadrature. The real part corresponds
- to the cosine output of hilbert, while the imaginary part corresponds to the
- sine output. The two outputs have a constant phase difference throughout the
- audio range that corresponds to the phase relationship between cosine and sine waves.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- get(identifier, all) : Return the first sample of the current
- buffer as a float.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Notes:
-
- Real and imaginary parts are two separated set of streams.
- The user should call :
-
- Hilbert['real'] to retrieve the real part.
- Hilbert['imag'] to retrieve the imaginary part.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/accord.aif", loop=True, mul=0.5).out(0)
- >>> b = Hilbert(a)
- >>> quad = Sine([250, 500], [0, .25])
- >>> mod1 = b['real'] * quad[0]
- >>> mod2 = b['imag'] * quad[1]
- >>> up = (mod1 - mod2) * 0.7
- >>> down = mod1 + mod2
- >>> up.out(1)
-
- """
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._real_dummy = []
- self._imag_dummy = []
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, lmax = convertArgsToLists(self._in_fader)
- mul, add, lmax2 = convertArgsToLists(mul, add)
- self._base_players = [HilbertMain_base(wrap(in_fader,i)) for i in range(lmax)]
- self._base_objs = []
- for i in range(lmax2):
- for j in range(lmax):
- self._base_objs.append(Hilbert_base(wrap(self._base_players,j), 0, wrap(mul,i), wrap(add,i)))
- self._base_objs.append(Hilbert_base(wrap(self._base_players,j), 1, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def __getitem__(self, str):
- if str == 'real':
- self._real_dummy.append(Dummy([obj for i, obj in enumerate(self._base_objs) if (i%2) == 0]))
- return self._real_dummy[-1]
- if str == 'imag':
- self._imag_dummy.append(Dummy([obj for i, obj in enumerate(self._base_objs) if (i%2) == 1]))
- return self._imag_dummy[-1]
-
- def get(self, identifier="real", all=False):
- """
- Return the first sample of the current buffer as a float.
-
- Can be used to convert audio stream to usable Python data.
-
- "real" or "imag" must be given to `identifier` to specify
- which stream to get value from.
-
- Parameters:
-
- identifier : string {"real", "imag"}
- Address string parameter identifying audio stream.
- Defaults to "real".
- all : boolean, optional
- If True, the first value of each object's stream
- will be returned as a list. Otherwise, only the value
- of the first object's stream will be returned as a float.
- Defaults to False.
-
- """
- if not all:
- return self.__getitem__(identifier)[0]._getStream().getValue()
- else:
- return [obj._getStream().getValue() for obj in self.__getitem__(identifier).getBaseObjects()]
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Allpass(PyoObject):
- """
- Delay line based allpass filter.
-
- Allpass is based on the combination of feedforward and feedback comb
- filter. This kind of filter is often used in simple digital reverb
- implementations.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- delay : float or PyoObject, optional
- Delay time in seconds. Defaults to 0.01.
- feedback : float or PyoObject, optional
- Amount of output signal sent back into the delay line.
- Defaults to 0.
- maxdelay : float, optional
- Maximum delay length in seconds. Available only at initialization.
- Defaults to 1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setDelay(x) : Replace the `delay` attribute.
- setFeedback(x) : Replace the `feedback` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- delay : float or PyoObject. Delay time in seconds.
- feedback : float or PyoObject. Amount of output signal sent back
- into the delay line.
-
- Examples:
-
- >>> # SIMPLE REVERB
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", loop=True, mul=0.25).mix(2).out()
- >>> b1 = Allpass(a, delay=[.0204,.02011], feedback=0.25)
- >>> b2 = Allpass(b1, delay=[.06653,.06641], feedback=0.31)
- >>> b3 = Allpass(b2, delay=[.035007,.03504], feedback=0.4)
- >>> b4 = Allpass(b3, delay=[.023021 ,.022987], feedback=0.55)
- >>> c1 = Tone(b1, 5000, mul=0.2).out()
- >>> c2 = Tone(b2, 3000, mul=0.2).out()
- >>> c3 = Tone(b3, 1500, mul=0.2).out()
- >>> c4 = Tone(b4, 500, mul=0.2).out()
-
- """
- def __init__(self, input, delay=0.01, feedback=0, maxdelay=1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._delay = delay
- self._feedback = feedback
- self._maxdelay = maxdelay
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, delay, feedback, maxdelay, mul, add, lmax = convertArgsToLists(self._in_fader, delay, feedback, maxdelay, mul, add)
- self._base_objs = [Allpass_base(wrap(in_fader,i), wrap(delay,i), wrap(feedback,i), wrap(maxdelay,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'delay', 'feedback', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setDelay(self, x):
- """
- Replace the `delay` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `delay` attribute.
-
- """
- self._delay = x
- x, lmax = convertArgsToLists(x)
- [obj.setDelay(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFeedback(self, x):
- """
- Replace the `feedback` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `feedback` attribute.
-
- """
- self._feedback = x
- x, lmax = convertArgsToLists(x)
- [obj.setFeedback(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.001, self._maxdelay, 'log', 'delay', self._delay),
- SLMap(0., 1., 'lin', 'feedback', self._feedback),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def delay(self):
- """float or PyoObject. Delay time in seconds."""
- return self._delay
- @delay.setter
- def delay(self, x): self.setDelay(x)
-
- @property
- def feedback(self):
- """float or PyoObject. Amount of output signal sent back into the delay line."""
- return self._feedback
- @feedback.setter
- def feedback(self, x): self.setFeedback(x)
-
-class Allpass2(PyoObject):
- """
- Second-order phase shifter allpass.
-
- This kind of filter is used in phaser implementation. The signal
- of this filter, when added to original sound, creates a notch in
- the spectrum at frequencies that are in phase opposition.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Center frequency of the filter. Defaults to 1000.
- bw : float or PyoObject, optional
- Bandwidth of the filter in Hertz. Defaults to 100.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setBw(x) : Replace the `bw` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Center frequency of the filter.
- bw : float or PyoObject. Bandwidth of the filter.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # 3 STAGES PHASER
- >>> a = BrownNoise(.025).mix(2).out()
- >>> blfo = Sine(freq=.1, mul=250, add=500)
- >>> b = Allpass2(a, freq=blfo, bw=125).out()
- >>> clfo = Sine(freq=.14, mul=500, add=1000)
- >>> c = Allpass2(b, freq=clfo, bw=350).out()
- >>> dlfo = Sine(freq=.17, mul=1000, add=2500)
- >>> d = Allpass2(c, freq=dlfo, bw=800).out()
-
- """
- def __init__(self, input, freq=1000, bw=100, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._bw = bw
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, bw, mul, add, lmax = convertArgsToLists(self._in_fader, freq, bw, mul, add)
- self._base_objs = [Allpass2_base(wrap(in_fader,i), wrap(freq,i), wrap(bw,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'bw', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setBw(self, x):
- """
- Replace the `bw` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `bw` attribute.
-
- """
- self._bw = x
- x, lmax = convertArgsToLists(x)
- [obj.setBw(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMap(10, 1000, "lin", "bw", self._bw),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to filter."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Center frequency of the filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def bw(self):
- """float or PyoObject. Bandwidth of the filter."""
- return self._bw
- @bw.setter
- def bw(self, x): self.setBw(x)
-
-class Phaser(PyoObject):
- """
- Multi-stages second-order phase shifter allpass filters.
-
- Phaser implements `num` number of second-order allpass filters.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Center frequency of the first notch. Defaults to 1000.
- spread : float or PyoObject, optional
- Spreading factor for upper notch frequencies. Defaults to 1.1.
- q : float or PyoObject, optional
- Q of the filter as center frequency / bandwidth. Defaults to 10.
- feedback : float or PyoObject, optional
- Amount of output signal which is fed back into the input of the
- allpass chain. Defaults to 0.
- num : int, optional
- The number of allpass stages in series. Defines the number of
- notches in the spectrum. Available at initialization only.
- Defaults to 8.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setSpread(x) : Replace the `spread` attribute.
- setQ(x) : Replace the `q` attribute.
- setFeedback(x) : Replace the `feedback` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Center frequency of the first notch.
- spread : float or PyoObject. Spreading factor for upper notch frequencies.
- q : float or PyoObject. Q factor of the filter.
- feedback : float or PyoObject. Amount of output signal fed back in input.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> fade = Fader(fadein=.1, mul=.07).play()
- >>> a = Noise(fade).mix(2).out()
- >>> lf1 = Sine(freq=[.1, .15], mul=100, add=250)
- >>> lf2 = Sine(freq=[.18, .15], mul=.4, add=1.5)
- >>> b = Phaser(a, freq=lf1, spread=lf2, q=1, num=20, mul=.5).out(0)
-
- """
- def __init__(self, input, freq=1000, spread=1.1, q=10, feedback=0, num=8, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._spread = spread
- self._q = q
- self._feedback = feedback
- self._num= num
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, spread, q, feedback, num, mul, add, lmax = convertArgsToLists(self._in_fader, freq, spread, q, feedback, num, mul, add)
- self._base_objs = [Phaser_base(wrap(in_fader,i), wrap(freq,i), wrap(spread,i), wrap(q,i), wrap(feedback,i), wrap(num,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'spread', 'q', 'feedback', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSpread(self, x):
- """
- Replace the `spread` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `spread` attribute.
-
- """
- self._spread = x
- x, lmax = convertArgsToLists(x)
- [obj.setSpread(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setQ(self, x):
- """
- Replace the `q` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `q` attribute.
-
- """
- self._q = x
- x, lmax = convertArgsToLists(x)
- [obj.setQ(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFeedback(self, x):
- """
- Replace the `feedback` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `feedback` attribute.
-
- """
- self._feedback = x
- x, lmax = convertArgsToLists(x)
- [obj.setFeedback(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(20, 2000, "log", "freq", self._freq),
- SLMap(0.5, 2, "lin", "spread", self._spread),
- SLMap(0.5, 100, "log", "q", self._q),
- SLMap(0, 1, "lin", "feedback", self._feedback),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Center frequency of the first notch."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def spread(self):
- """float or PyoObject. Spreading factor for upper notch frequencies."""
- return self._spread
- @spread.setter
- def spread(self, x): self.setSpread(x)
-
- @property
- def q(self):
- """float or PyoObject. Q factor of the filter."""
- return self._q
- @q.setter
- def q(self, x): self.setQ(x)
-
- @property
- def feedback(self):
- """float or PyoObject. Feedback factor of the filter."""
- return self._feedback
- @feedback.setter
- def feedback(self, x): self.setFeedback(x)
-
-class Vocoder(PyoObject):
- """
- Applies the spectral envelope of a first sound to the spectrum of a second sound.
-
- The vocoder is an analysis/synthesis system, historically used to reproduce
- human speech. In the encoder, the first input (spectral envelope) is passed
- through a multiband filter, each band is passed through an envelope follower,
- and the control signals from the envelope followers are communicated to the
- decoder. The decoder applies these (amplitude) control signals to corresponding
- filters modifying the second source (exciter).
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Spectral envelope. Gives the spectral properties of the bank of filters.
- For best results, this signal must have a dynamic spectrum, both for
- amplitudes and frequencies.
- input2 : PyoObject
- Exciter. Spectrum to filter. For best results, this signal must have a
- broadband spectrum with few amplitude variations.
- freq : float or PyoObject, optional
- Center frequency of the first band. This is the base frequency used to
- compute the upper bands. Defaults to 60.
- spread : float or PyoObject, optional
- Spreading factor for upper band frequencies. Each band is
- `freq * pow(order, spread)`, where order is the harmonic rank of the band.
- Defaults to 1.25.
- q : float or PyoObject, optional
- Q of the filters as `center frequency / bandwidth`. Higher values imply
- more resonance around the center frequency. Defaults to 20.
- slope : float or PyoObject, optional
- Time response of the envelope follower. Lower values mean smoother changes,
- while higher values mean a better time accuracy. Defaults to 0.5.
- stages : int, optional
- The number of bands in the filter bank. Defines the number of notches in
- the spectrum. Defaults to 24.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setInput2(x, fadetime) : Replace the `input2` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setSpread(x) : Replace the `spread` attribute.
- setQ(x) : Replace the `q` attribute.
- setSlope(x) : Replace the `slope` attribute.
- setStages(x) : Replace the `stages` attribute.
-
- Attributes:
-
- input : PyoObject. Spectral envelope of the process.
- input2 : PyoObject. Exciter of the filter bank.
- freq : float or PyoObject. Center frequency of the first band.
- spread : float or PyoObject. Spreading factor for upper band frequencies.
- q : float or PyoObject. Q factor of the filters.
- slope : float or PyoObject. Time response of the envelope follower.
- stages : int. The number of bands in the filter bank.
-
- Notes:
-
- Altough parameters can be audio signals, values are sampled only four times
- per buffer size. To avoid artefacts, it is recommended to keep variations
- at low rate (< 20 Hz).
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH+'/transparent.aif', loop=True)
- >>> ex = BrownNoise(0.5)
- >>> voc = Vocoder(sf, ex, freq=80, spread=1.2, q=20, slope=0.5)
- >>> out = voc.mix(2).out()
-
- """
- def __init__(self, input, input2, freq=60, spread=1.25, q=20, slope=0.5, stages=24, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._input2 = input2
- self._freq = freq
- self._spread = spread
- self._q = q
- self._slope = slope
- self._stages = stages
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- self._in_fader2 = InputFader(input2)
- in_fader, in_fader2, freq, spread, q, slope, stages, mul, add, lmax = convertArgsToLists(self._in_fader, self._in_fader2, freq, spread, q, slope, stages, mul, add)
- self._base_objs = [Vocoder_base(wrap(in_fader,i), wrap(in_fader2,i), wrap(freq,i), wrap(spread,i), wrap(q,i), wrap(slope,i), wrap(stages,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'input2', 'freq', 'spread', 'q', 'slope', 'stages', 'mul', 'add']
-
- def setInput(self, x, fadetime=0.05):
- """
- Replace the `input` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to process. The spectral envelope.
- fadetime : float, optional
- Crossfade time between old and new input. Defaults to 0.05.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setInput2(self, x, fadetime=0.05):
- """
- Replace the `input2` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to process. The exciter.
- fadetime : float, optional
- Crossfade time between old and new input. Defaults to 0.05.
-
- """
- self._input2 = x
- self._in_fader2.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSpread(self, x):
- """
- Replace the `spread` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `spread` attribute.
-
- """
- self._spread = x
- x, lmax = convertArgsToLists(x)
- [obj.setSpread(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setQ(self, x):
- """
- Replace the `q` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `q` attribute.
-
- """
- self._q = x
- x, lmax = convertArgsToLists(x)
- [obj.setQ(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSlope(self, x):
- """
- Replace the `slope` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `slope` attribute.
-
- """
- self._slope = x
- x, lmax = convertArgsToLists(x)
- [obj.setSlope(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setStages(self, x):
- """
- Replace the `stages` attribute.
-
- Parameters:
-
- x : int
- New `stages` attribute.
-
- """
- self._stages = x
- x, lmax = convertArgsToLists(x)
- [obj.setStages(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(10, 1000, "log", "freq", self._freq),
- SLMap(0.25, 2, "lin", "spread", self._spread),
- SLMap(0.5, 200, "log", "q", self._q),
- SLMap(0, 1, "lin", "slope", self._slope),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process. Spectral envelope."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def input2(self):
- """PyoObject. Input signal to process. Exciter."""
- return self._input2
- @input2.setter
- def input2(self, x): self.setInput2(x)
-
- @property
- def freq(self):
- """float or PyoObject. Center frequency of the first band."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def spread(self):
- """float or PyoObject. Spreading factor for upper band frequencies."""
- return self._spread
- @spread.setter
- def spread(self, x): self.setSpread(x)
-
- @property
- def q(self):
- """float or PyoObject. Q factor of the filters."""
- return self._q
- @q.setter
- def q(self, x): self.setQ(x)
-
- @property
- def slope(self):
- """float or PyoObject. Time response of the envelope follower."""
- return self._slope
- @slope.setter
- def slope(self, x): self.setSlope(x)
-
- @property
- def stages(self):
- """int. The number of bands in the filter bank."""
- return self._stages
- @stages.setter
- def stages(self, x): self.setStages(x)
-
-class IRWinSinc(PyoObject):
- """
- Windowed-sinc filter using circular convolution.
-
- IRWinSinc uses circular convolution to implement standard filters like
- lowpass, highpass, bandreject and bandpass with very flat passband
- response and sharp roll-off. User can defined the length, in samples,
- of the impulse response, also known as the filter kernel.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Frequency cutoff for lowpass and highpass and center frequency for
- bandjrect and bandpass filters, expressed in Hertz. Defaults to 1000.
- bw : float or PyoObject, optional
- Bandwidth, expressed in Hertz, for bandreject and bandpass filters.
- Defaults to 500.
- type : int, optional
- Filter type. Four possible values :
- 0 = lowpass (default)
- 1 = highpass
- 2 = bandreject
- 3 = bandpass
- order : int {even number}, optional
- Length, in samples, of the filter kernel used for convolution. Available
- at initialization time only. This value must be even. Higher is the order
- and sharper is the roll-off of the filter, but it is also more expensive
- to compute, watch your CPU! Defaults to 256.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setBw(x) : Replace the `bw` attribute.
- setType(x) : Replace the `type` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Cutoff or center frequency, in Hz, of the filter.
- bw : float or PyoObject. Bandwidth, in Hz, for bandreject and bandpass filters.
- type : int. Filter type {0 = lowpass, 1 = highpass, 2 = bandreject, 3 = bandpass}.
-
- Notes :
-
- Convolution is very expensive to compute, so the length of the impulse
- response (the `order` parameter) must be kept very short to run in real time.
-
- Note that although `freq` and `bw` can be PyoObjects, the impulse response of
- the filter is only updated once per buffer size.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(.3)
- >>> lfr = Sine([.15, .2], mul=2000, add=3500)
- >>> lbw = Sine([.3, .25], mul=1000, add=1500)
- >>> b = IRWinSinc(a, freq=lfr, bw=lbw, type=3, order=256).out()
-
- """
- def __init__(self, input, freq=1000, bw=500, type=0, order=256, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._bw = bw
- self._type = type
- if (order % 2) != 0:
- order += 1
- print "order argument of IRWinSinc must be even, set to %i" % order
- self._order = order
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, bw, type, order, mul, add, lmax = convertArgsToLists(self._in_fader, freq, bw, type, order, mul, add)
- self._base_objs = [IRWinSinc_base(wrap(in_fader,i), wrap(freq,i), wrap(bw,i), wrap(type,i), wrap(order,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'bw', 'type', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setBw(self, x):
- """
- Replace the `bw` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `bw` attribute.
-
- """
- self._bw = x
- x, lmax = convertArgsToLists(x)
- [obj.setBandwidth(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setType(self, x):
- """
- Replace the `type` attribute.
-
- Parameters:
-
- x : int
- New `type` attribute.
- 0 = lowpass, 1 = highpass, 2 = bandreject, 3 = bandpass
-
- """
- self._type = x
- x, lmax = convertArgsToLists(x)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq),
- SLMap(20., 10000., "log", "bw", self._bw)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Cutoff or Center frequency of the filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def bw(self):
- """float or PyoObject. Bandwidth for bandreject and bandpass filters."""
- return self._bw
- @bw.setter
- def bw(self, x): self.setBw(x)
-
- @property
- def type(self):
- """int. Filter type {0 = lowpass, 1 = highpass, 2 = bandreject, 3 = bandpass}."""
- return self._type
- @type.setter
- def type(self, x): self.setType(x)
-
-class IRAverage(PyoObject):
- """
- Moving average filter using circular convolution.
-
- IRAverage uses circular convolution to implement an average filter. This
- filter is designed to reduce the noise in the input signal while keeping
- as much as possible the step response of the original signal. User can
- defined the length, in samples, of the impulse response, also known as
- the filter kernel. This controls the ratio of removed noise vs the fidelity
- of the original step response.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- order : int {even number}, optional
- Length, in samples, of the filter kernel used for convolution. Available
- at initialization time only. This value must be even. A high order will
- reduced more noise and will have a higher damping effect on the step
- response, but it is also more expensive to compute, watch your CPU!
- Defaults to 256.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Notes :
-
- Convolution is very expensive to compute, so the length of the impulse
- response (the `order` parameter) must be kept very short to run in real time.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> nz = Noise(.05)
- >>> a = Sine([300, 400], mul=.25, add=nz)
- >>> b = IRAverage(a, order=128).out()
-
- """
- def __init__(self, input, order=256, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- if (order % 2) != 0:
- order += 1
- print "order argument of IRAverage must be even, set to %i" % order
- self._order = order
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, order, mul, add, lmax = convertArgsToLists(self._in_fader, order, mul, add)
- self._base_objs = [IRAverage_base(wrap(in_fader,i), wrap(order,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class IRPulse(PyoObject):
- """
- Comb-like filter using circular convolution.
-
- IRPulse uses circular convolution to implement standard comb-like
- filters consisting of an harmonic series with fundamental `freq` and
- a comb filter with the first notch at `bw` frequency. The `type`
- parameter defines variations of this pattern. User can defined the length,
- in samples, of the impulse response, also known as the filter kernel.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- freq : float or PyoObject, optional
- Fundamental frequency of the spikes in the filter's spectrum, expressed
- in Hertz. Defaults to 500.
- bw : float or PyoObject, optional
- Frequency, expressed in Hertz, of the first notch in the comb filtering.
- Defaults to 2500.
- type : int, optional
- Filter type. Four possible values :
- 0 = Pulse & comb (default)
- 1 = Pulse & comb & lowpass
- 2 = Pulse (odd harmonics) & comb
- 3 = Pulse (odd harmonics) & comb & lowpass
- order : int {even number}, optional
- Length, in samples, of the filter kernel used for convolution. Available
- at initialization time only. This value must be even. Higher is the order
- and sharper is the roll-off of the filter, but it is also more expensive
- to compute, watch your CPU! Defaults to 256.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setBw(x) : Replace the `bw` attribute.
- setType(x) : Replace the `type` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- freq : float or PyoObject. Fundamental frequency of the spikes.
- bw : float or PyoObject. Frequency of the comb's first notch.
- type : int. Filter type {0 = pulse, 1 = pulse_lp, 2 = pulse_odd, 3 = pulse_odd_lp}.
-
- Notes :
-
- Convolution is very expensive to compute, so the length of the impulse
- response (the `order` parameter) must be kept very short to run in real time.
-
- Note that although `freq` and `bw` can be PyoObjects, the impulse response of
- the filter is only updated once per buffer size.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(.5)
- >>> b = IRPulse(a, freq=[245, 250], bw=2500, type=3, order=256).out()
-
- """
- def __init__(self, input, freq=500, bw=2500, type=0, order=256, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._freq = freq
- self._bw = bw
- self._type = type
- if (order % 2) != 0:
- order += 1
- print "order argument of IRPulse must be even, set to %i" % order
- self._order = order
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, freq, bw, type, order, mul, add, lmax = convertArgsToLists(self._in_fader, freq, bw, type, order, mul, add)
- self._base_objs = [IRPulse_base(wrap(in_fader,i), wrap(freq,i), wrap(bw,i), wrap(type,i), wrap(order,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'freq', 'bw', 'type', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setBw(self, x):
- """
- Replace the `bw` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `bw` attribute.
-
- """
- self._bw = x
- x, lmax = convertArgsToLists(x)
- [obj.setBandwidth(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setType(self, x):
- """
- Replace the `type` attribute.
-
- Parameters:
-
- x : int
- New `type` attribute.
- Filter type. Four possible values :
- 0 = Pulse & comb (default)
- 1 = Pulse & comb & lowpass
- 2 = Pulse (odd harmonics) & comb
- 3 = Pulse (odd harmonics) & comb & lowpass
-
- """
- self._type = x
- x, lmax = convertArgsToLists(x)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq),
- SLMap(20., 10000., "log", "bw", self._bw)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def freq(self):
- """float or PyoObject. Cutoff or Center frequency of the filter."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def bw(self):
- """float or PyoObject. Bandwidth for bandreject and bandpass filters."""
- return self._bw
- @bw.setter
- def bw(self, x): self.setBw(x)
-
- @property
- def type(self):
- """int. Filter type {0 = pulse, 1 = pulse_lp, 2 = pulse_odd, 3 = pulse_odd_lp}."""
- return self._type
- @type.setter
- def type(self, x): self.setType(x)
-
-class IRFM(PyoObject):
- """
- Filters a signal with a frequency modulation spectrum using circular convolution.
-
- IRFM uses circular convolution to implement filtering with a frequency
- modulation spectrum. User can defined the length, in samples, of the
- impulse response, also known as the filter kernel. The higher the `order`,
- the narrower the bandwidth around each of the FM components.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- carrier : float or PyoObject, optional
- Carrier frequency in cycles per second. Defaults to 1000.
- ratio : float or PyoObject, optional
- A factor that, when multiplied by the `carrier` parameter,
- gives the modulator frequency. Defaults to 0.5.
- index : float or PyoObject, optional
- The modulation index. This value multiplied by the modulator
- frequency gives the modulator amplitude. Defaults to 3.
- order : int {even number}, optional
- Length, in samples, of the filter kernel used for convolution. Available
- at initialization time only. This value must be even. Higher is the order
- and sharper is the roll-off of the filter, but it is also more expensive
- to compute, watch your CPU! Defaults to 256.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setCarrier(x) : Replace the `carrier` attribute.
- setRatio(x) : Replace the `ratio` attribute.
- setIndex(x) : Replace the `index` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- carrier : float or PyoObject. Carrier frequency in Hz.
- ratio : float or PyoObject. Modulator/carrier ratio.
- index : float or PyoObject.The modulation index.
-
- Notes :
-
- Convolution is very expensive to compute, so the length of the impulse
- response (the `order` parameter) must be kept very short to run in real time.
-
- Note that although `carrier`, `ratio` and `index` can be PyoObjects, the
- impulse response of the filter is only updated once per buffer size.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> nz = Noise(.7)
- >>> lf = Sine(freq=[.2, .25], mul=.125, add=.5)
- >>> b = IRFM(nz, carrier=3500, ratio=lf, index=3, order=256).out()
-
- """
- def __init__(self, input, carrier=1000, ratio=0.5, index=3, order=256, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._carrier = carrier
- self._ratio = ratio
- self._index = index
- if (order % 2) != 0:
- order += 1
- print "order argument of IRFM must be even, set to %i" % order
- self._order = order
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, carrier, ratio, index, order, mul, add, lmax = convertArgsToLists(self._in_fader, carrier, ratio, index, order, mul, add)
- self._base_objs = [IRFM_base(wrap(in_fader,i), wrap(carrier,i), wrap(ratio,i), wrap(index,i), wrap(order,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'carrier', 'ratio', 'index', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setCarrier(self, x):
- """
- Replace the `carrier` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `carrier` attribute.
-
- """
- self._carrier = x
- x, lmax = convertArgsToLists(x)
- [obj.setCarrier(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRatio(self, x):
- """
- Replace the `ratio` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `ratio` attribute.
-
- """
- self._ratio = x
- x, lmax = convertArgsToLists(x)
- [obj.setRatio(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setIndex(self, x):
- """
- Replace the `index` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `index` attribute.
-
- """
- self._index = x
- x, lmax = convertArgsToLists(x)
- [obj.setIndex(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(20., 10000., "log", "carrier", self._carrier),
- SLMap(0.01, 4., "log", "ratio", self._ratio),
- SLMap(0., 20., "lin", "index", self._index)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def carrier(self):
- """float or PyoObject. Carrier frequency in Hz."""
- return self._carrier
- @carrier.setter
- def carrier(self, x): self.setCarrier(x)
-
- @property
- def ratio(self):
- """float or PyoObject. Modulator/carrier ratio."""
- return self._ratio
- @ratio.setter
- def ratio(self, x): self.setRatio(x)
-
- @property
- def index(self):
- """float or PyoObject. Modulation index."""
- return self._index
- @index.setter
- def index(self, x): self.setIndex(x)
-
diff --git a/build/lib.linux-x86_64-2.7/pyolib/fourier.py b/build/lib.linux-x86_64-2.7/pyolib/fourier.py
deleted file mode 100644
index bb059e2..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/fourier.py
+++ /dev/null
@@ -1,1294 +0,0 @@
-"""
-Fast Fourier Transform.
-
-A Fast Fourier Transform (FFT) is an efficient algorithm to compute
-the discrete Fourier transform (DFT) and its inverse (IFFT).
-
-The objects below can be used to perform sound processing in the
-spectral domain.
-
-"""
-
-"""
-Copyright 2011 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-
-class FFT(PyoObject):
- """
- Fast Fourier Transform.
-
- FFT analyses an input signal and converts it into the spectral
- domain. Three audio signals are sent out of the object, the
- `real` part, from bin 0 (DC) to bin size/2 (Nyquist), the
- `imaginary` part, from bin 0 to bin size/2-1, and the bin
- number, an increasing count from 0 to size-1. `real` and
- `imaginary` buffer's left samples up to size-1 are filled
- with zeros. See notes below for an example of how to retrieve
- each signal component.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- size : int {pow-of-two > 4}, optional
- FFT size. Must be a power of two greater than 4.
- The FFT size is the number of samples used in each
- analysis frame. Defaults to 1024.
- overlaps : int, optional
- The number of overlaped analysis block. Must be a
- positive integer. More overlaps can greatly improved
- sound quality synthesis but it is also more CPU
- expensive. Defaults to 4.
- wintype : int, optional
- Shape of the envelope used to filter each input frame.
- Possible shapes are :
- 0 : rectangular (no windowing)
- 1 : Hamming
- 2 : Hanning
- 3 : Bartlett (triangular)
- 4 : Blackman 3-term
- 5 : Blackman-Harris 4-term
- 6 : Blackman-Harris 7-term
- 7 : Tuckey (alpha = 0.66)
- 8 : Sine (half-sine window)
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setSize(x) : Replace the `size` attribute.
- setWinType(x) : Replace the `wintype` attribute.
- get(identifier, all) : Return the first sample of the current
- buffer as a float.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- size : int {pow-of-two > 4}. FFT size.
- wintype : int. Shape of the envelope.
-
- Notes:
-
- FFT has no `out` method. Signal must be converted back to time domain,
- with IFFT, before being sent to output.
-
- FFT has no `mul` and `add` attributes.
-
- Real, imaginary and bin_number parts are three separated set
- of audio streams. The user should call :
-
- FFT['real'] to retrieve the real part.
- FFT['imag'] to retrieve the imaginary part.
- FFT['bin'] to retrieve the bin number part.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(.25).mix(2)
- >>> fin = FFT(a, size=1024, overlaps=4, wintype=2)
- >>> t = ExpTable([(0,0),(3,0),(10,1),(20,0),(30,.8),(50,0),(70,.6),(150,0),(512,0)], size=512)
- >>> amp = TableIndex(t, fin["bin"])
- >>> re = fin["real"] * amp
- >>> im = fin["imag"] * amp
- >>> fout = IFFT(re, im, size=1024, overlaps=4, wintype=2).mix(2).out()
-
- """
- def __init__(self, input, size=1024, overlaps=4, wintype=2):
- PyoObject.__init__(self)
- mul = 1
- add = 0
- self._real_dummy = []
- self._imag_dummy = []
- self._bin_dummy = []
- self._input = input
- self._size = size
- self._overlaps = overlaps
- self._wintype = wintype
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, size, wintype, lmax = convertArgsToLists(self._in_fader, size, wintype)
- self._base_players = []
- for j in range(overlaps):
- for i in range(lmax):
- hopsize = wrap(size,i) * j / overlaps
- self._base_players.append(FFTMain_base(wrap(in_fader,i), wrap(size,i), hopsize, wrap(wintype,i)))
- self._real_objs = []
- self._imag_objs = []
- self._bin_objs = []
- for j in range(len(self._base_players)):
- self._real_objs.append(FFT_base(wrap(self._base_players,j), 0, mul, add))
- self._imag_objs.append(FFT_base(wrap(self._base_players,j), 1, mul, add))
- self._bin_objs.append(FFT_base(wrap(self._base_players,j), 2, mul, add))
-
- def __dir__(self):
- return ['input', 'size', 'wintype', 'mul', 'add']
-
- def __len__(self):
- return len(self._real_objs)
-
- def __getitem__(self, str):
- if str == 'real':
- self._real_dummy.append(Dummy([obj for i, obj in enumerate(self._real_objs)]))
- return self._real_dummy[-1]
- if str == 'imag':
- self._imag_dummy.append(Dummy([obj for i, obj in enumerate(self._imag_objs)]))
- return self._imag_dummy[-1]
- if str == 'bin':
- self._bin_dummy.append(Dummy([obj for i, obj in enumerate(self._bin_objs)]))
- return self._bin_dummy[-1]
-
- def get(self, identifier="real", all=False):
- """
- Return the first sample of the current buffer as a float.
-
- Can be used to convert audio stream to usable Python data.
-
- "real", "imag" or "bin" must be given to `identifier` to specify
- which stream to get value from.
-
- Parameters:
-
- identifier : string {"real", "imag", "bin"}
- Address string parameter identifying audio stream.
- Defaults to "real".
- all : boolean, optional
- If True, the first value of each object's stream
- will be returned as a list. Otherwise, only the value
- of the first object's stream will be returned as a float.
- Defaults to False.
-
- """
- if not all:
- return self.__getitem__(identifier)[0]._getStream().getValue()
- else:
- return [obj._getStream().getValue() for obj in self.__getitem__(identifier).getBaseObjects()]
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def play(self, dur=0, delay=0):
- dur, delay, lmax = convertArgsToLists(dur, delay)
- self._base_players = [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._base_players)]
- self._real_objs = [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._real_objs)]
- self._imag_objs = [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._imag_objs)]
- self._bin_objs = [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._bin_objs)]
- return self
-
- def stop(self):
- [obj.stop() for obj in self._base_players]
- [obj.stop() for obj in self._real_objs]
- [obj.stop() for obj in self._imag_objs]
- [obj.stop() for obj in self._bin_objs]
- return self
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setSize(self, x):
- """
- Replace the `size` attribute.
-
- Parameters:
-
- x : int
- new `size` attribute.
-
- """
- self._size = x
- x, lmax = convertArgsToLists(x)
- poly = len(self._base_players) / self._overlaps
- for j in range(self._overlaps):
- for i in range(poly):
- hopsize = wrap(x,i) * j / self._overlaps
- self._base_players[j*poly+i].setSize(wrap(x,i), hopsize)
-
- def setWinType(self, x):
- """
- Replace the `wintype` attribute.
-
- Parameters:
-
- x : int
- new `wintype` attribute.
-
- """
- self._wintype = x
- x, lmax = convertArgsToLists(x)
- [obj.setWinType(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def size(self):
- """int. FFT size."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def wintype(self):
- """int. Windowing method."""
- return self._wintype
- @wintype.setter
- def wintype(self, x): self.setWinType(x)
-
-class IFFT(PyoObject):
- """
- Inverse Fast Fourier Transform.
-
- IFFT takes a signal in the spectral domain and converts it to a
- real audio signal using an inverse fast fourier transform.
- IFFT takes two signals in input, the `real` and `imaginary` parts
- of an FFT analysis and returns the corresponding real signal.
- These signals must correspond to `real` and `imaginary` parts
- from an FFT object.
-
- Parentclass : PyoObject
-
- Parameters:
-
- inreal : PyoObject
- Input `real` signal.
- inimag : PyoObject
- Input `imaginary` signal.
- size : int {pow-of-two > 4}, optional
- FFT size. Must be a power of two greater than 4.
- The FFT size is the number of samples used in each
- analysis frame. This value must match the `size`
- attribute of the former FFT object. Defaults to 1024.
- overlaps : int, optional
- The number of overlaped analysis block. Must be a
- positive integer. More overlaps can greatly improved
- sound quality synthesis but it is also more CPU
- expensive. This value must match the `overlaps`
- atribute of the former FFT object. Defaults to 4.
- wintype : int, optional
- Shape of the envelope used to filter each output frame.
- Possible shapes are :
- 0 : rectangular (no windowing)
- 1 : Hamming
- 2 : Hanning
- 3 : Bartlett (triangular)
- 4 : Blackman 3-term
- 5 : Blackman-Harris 4-term
- 6 : Blackman-Harris 7-term
- 7 : Tuckey (alpha = 0.66)
- 8 : Sine (half-sine window)
-
- Methods:
-
- setInReal(x, fadetime) : Replace the `inreal` attribute.
- setInImag(x, fadetime) : Replace the `inmag` attribute.
- setSize(x) : Replace the `size` attribute.
- setWinType(x) : Replace the `wintype` attribute.
-
- Attributes:
-
- inreal : PyoObject. Input `real` signal.
- inimag : PyoObject. Input `imag` signal.
- size : int {pow-of-two > 4}. FFT size.
- wintype : int. Shape of the envelope.
-
- Notes:
-
- The number of streams in `inreal` and `inimag` attributes
- must be egal to the output of the former FFT object. In
- most case, it will be `channels of processed sound` * `overlaps`.
-
- The output of IFFT must be mixed to reconstruct the real
- signal from the overlapped streams. It is left to the user
- to call the mix(channels of the processed sound) method on
- an IFFT object.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(.25).mix(2)
- >>> fin = FFT(a, size=1024, overlaps=4, wintype=2)
- >>> t = ExpTable([(0,0),(3,0),(10,1),(20,0),(30,.8),(50,0),(70,.6),(150,0),(512,0)], size=512)
- >>> amp = TableIndex(t, fin["bin"])
- >>> re = fin["real"] * amp
- >>> im = fin["imag"] * amp
- >>> fout = IFFT(re, im, size=1024, overlaps=4, wintype=2).mix(2).out()
-
- """
- def __init__(self, inreal, inimag, size=1024, overlaps=4, wintype=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._inreal = inreal
- self._inimag = inimag
- self._size = size
- self._overlaps = overlaps
- self._wintype = wintype
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(inreal)
- self._in_fader2 = InputFader(inimag)
- in_fader, in_fader2, size, wintype, mul, add, lmax = convertArgsToLists(self._in_fader, self._in_fader2, size, wintype, mul, add)
- self._base_objs = []
- ratio = lmax / overlaps
- for i in range(lmax):
- hopsize = wrap(size,i) * ((i/ratio)%overlaps) / overlaps
- self._base_objs.append(IFFT_base(wrap(in_fader,i), wrap(in_fader2,i), wrap(size,i), hopsize, wrap(wintype,i), wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['inreal', 'inimag', 'size', 'wintype', 'mul', 'add']
-
- def __len__(self):
- return len(self._inreal)
-
- def setInReal(self, x, fadetime=0.05):
- """
- Replace the `inreal` attribute.
-
- Parameters:
-
- x : PyoObject
- New input `real` signal.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._inreal = x
- self._in_fader.setInput(x, fadetime)
-
- def setInImag(self, x, fadetime=0.05):
- """
- Replace the `inimag` attribute.
-
- Parameters:
-
- x : PyoObject
- New input `imag` signal.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._inimag = x
- self._in_fader2.setInput(x, fadetime)
-
- def setSize(self, x):
- """
- Replace the `size` attribute.
-
- Parameters:
-
- x : int
- new `size` attribute.
-
- """
- self._size = x
- x, lmax = convertArgsToLists(x)
- ratio = len(self._base_objs) / self._overlaps
- for i, obj in enumerate(self._base_objs):
- hopsize = wrap(x,i) * ((i/ratio)%self._overlaps) / self._overlaps
- self._base_objs[i].setSize(wrap(x,i), hopsize)
-
- def setWinType(self, x):
- """
- Replace the `wintype` attribute.
-
- Parameters:
-
- x : int
- new `wintype` attribute.
-
- """
- self._wintype = x
- x, lmax = convertArgsToLists(x)
- [obj.setWinType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def inreal(self):
- """PyoObject. Real input signal."""
- return self._inreal
- @inreal.setter
- def inreal(self, x): self.setInReal(x)
-
- @property
- def inimag(self):
- """PyoObject. Imaginary input signal."""
- return self._inimag
- @inimag.setter
- def inimag(self, x): self.setInImag(x)
-
- @property
- def size(self):
- """int. FFT size."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def wintype(self):
- """int. Windowing method."""
- return self._wintype
- @wintype.setter
- def wintype(self, x): self.setWinType(x)
-
-class CarToPol(PyoObject):
- """
- Performs the cartesian to polar conversion.
-
- The Cartesian system locates points on a plane by measuring the horizontal and
- vertical distances from an arbitrary origin to a point. These are usually denoted
- as a pair of values (X,Y).
-
- The Polar system locates the point by measuring the straight line distance, usually
- denoted by R, from the origin to the point and the angle of an imaginary line from
- the origin to the point measured counterclockwise from the positive X axis.
-
- Parentclass: PyoObject
-
- Parameters:
-
- inreal : PyoObject
- Real input signal.
- inimag : PyoObject
- Imaginary input signal.
-
- Methods:
-
- setInReal(x, fadetime) : Replace the `inreal` attribute.
- setInImag(x, fadetime) : Replace the `inimag` attribute.
-
- Attributes:
-
- inreal : PyoObject. Real input signal.
- inimag : PyoObject. Imaginary input signal.
-
- Notes:
-
- Polar coordinates can be retrieve by calling :
-
- CarToPol['mag'] to retrieve the magnitude part.
- CarToPol['ang'] to retrieve the angle part.
-
- CarToPol has no `out` method. Signal must be converted back to time domain,
- with IFFT, before being sent to output.
-
- Examples:
-
- >>> s = Server().boot()
- >>> snd1 = SfPlayer(SNDS_PATH+"/transparent.aif", loop=True, mul=.7).mix(2)
- >>> snd2 = FM(carrier=[75,100,125,150], ratio=[.499,.5,.501,.502], index=20, mul=.1).mix(2)
- >>> fin1 = FFT(snd1, size=1024, overlaps=4)
- >>> fin2 = FFT(snd2, size=1024, overlaps=4)
- >>> # get magnitudes and phases of input sounds
- >>> pol1 = CarToPol(fin1["real"], fin1["imag"])
- >>> pol2 = CarToPol(fin2["real"], fin2["imag"])
- >>> # times magnitudes and adds phases
- >>> mag = pol1["mag"] * pol2["mag"] * 100
- >>> pha = pol1["ang"] + pol2["ang"]
- >>> # converts back to rectangular
- >>> car = PolToCar(mag, pha)
- >>> fout = IFFT(car["real"], car["imag"], size=1024, overlaps=4).mix(2).out()
- >>> s.start()
-
- """
- def __init__(self, inreal, inimag, mul=1, add=0):
- PyoObject.__init__(self)
- self._mag_dummy = []
- self._ang_dummy = []
- self._inreal = inreal
- self._inimag = inimag
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(inreal)
- self._in_fader2 = InputFader(inimag)
- in_fader, in_fader2, mul, add, lmax = convertArgsToLists(self._in_fader, self._in_fader2, mul, add)
- self._base_objs = []
- for i in range(lmax):
- self._base_objs.append(CarToPol_base(wrap(in_fader,i), wrap(in_fader2,i), 0, wrap(mul,i), wrap(add,i)))
- self._base_objs.append(CarToPol_base(wrap(in_fader,i), wrap(in_fader2,i), 1, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['inreal', 'inimag', 'mul', 'add']
-
- def __len__(self):
- return len(self._inreal)
-
- def __getitem__(self, str):
- if str == 'mag':
- self._mag_dummy.append(Dummy([obj for i, obj in enumerate(self._base_objs) if i%2 == 0]))
- return self._mag_dummy[-1]
- if str == 'ang':
- self._ang_dummy.append(Dummy([obj for i, obj in enumerate(self._base_objs) if i%2 == 1]))
- return self._ang_dummy[-1]
-
- def get(self, identifier="mag", all=False):
- """
- Return the first sample of the current buffer as a float.
-
- Can be used to convert audio stream to usable Python data.
-
- "mag" or "ang" must be given to `identifier` to specify
- which stream to get value from.
-
- Parameters:
-
- identifier : string {"mag", "ang"}
- Address string parameter identifying audio stream.
- Defaults to "mag".
- all : boolean, optional
- If True, the first value of each object's stream
- will be returned as a list. Otherwise, only the value
- of the first object's stream will be returned as a float.
- Defaults to False.
-
- """
- if not all:
- return self.__getitem__(identifier)[0]._getStream().getValue()
- else:
- return [obj._getStream().getValue() for obj in self.__getitem__(identifier).getBaseObjects()]
-
- def setInReal(self, x, fadetime=0.05):
- """
- Replace the `inreal` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to process.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._inreal = x
- self._in_fader.setInput(x, fadetime)
-
- def setInImag(self, x, fadetime=0.05):
- """
- Replace the `inimag` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to process.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._inimag = x
- self._in_fader2.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def inreal(self):
- """PyoObject. Real input signal."""
- return self._inreal
- @inreal.setter
- def inreal(self, x): self.setInReal(x)
-
- @property
- def inimag(self):
- """PyoObject. Imaginary input signal."""
- return self._inimag
- @inimag.setter
- def inimag(self, x): self.setInImag(x)
-
-class PolToCar(PyoObject):
- """
- Performs the polar to cartesian conversion.
-
- The Polar system locates the point by measuring the straight line distance, usually
- denoted by R, from the origin to the point and the angle of an imaginary line from
- the origin to the point measured counterclockwise from the positive X axis.
-
- The Cartesian system locates points on a plane by measuring the horizontal and
- vertical distances from an arbitrary origin to a point. These are usually denoted
- as a pair of values (X,Y).
-
- Parentclass: PyoObject
-
- Parameters:
-
- inmag : PyoObject
- Magintude input signal.
- inang : PyoObject
- Angle input signal.
-
- Methods:
-
- setInMag(x, fadetime) : Replace the `inmag` attribute.
- setInAng(x, fadetime) : Replace the `inang` attribute.
-
- Attributes:
-
- inmag : PyoObject. Magintude input signal.
- inang : PyoObject. Angle input signal.
-
- Notes:
-
- Cartesians coordinates can be retrieve by calling :
-
- PolToCar['real'] to retrieve the real part.
- CarToPol['imag'] to retrieve the imaginary part.
-
- PolToCar has no `out` method. Signal must be converted back to time domain,
- with IFFT, before being sent to output.
-
- Examples:
-
- >>> s = Server().boot()
- >>> snd1 = SfPlayer(SNDS_PATH+"/transparent.aif", loop=True, mul=.7).mix(2)
- >>> snd2 = FM(carrier=[75,100,125,150], ratio=[.499,.5,.501,.502], index=20, mul=.1).mix(2)
- >>> fin1 = FFT(snd1, size=1024, overlaps=4)
- >>> fin2 = FFT(snd2, size=1024, overlaps=4)
- >>> # get magnitudes and phases of input sounds
- >>> pol1 = CarToPol(fin1["real"], fin1["imag"])
- >>> pol2 = CarToPol(fin2["real"], fin2["imag"])
- >>> # times magnitudes and adds phases
- >>> mag = pol1["mag"] * pol2["mag"] * 100
- >>> pha = pol1["ang"] + pol2["ang"]
- >>> # converts back to rectangular
- >>> car = PolToCar(mag, pha)
- >>> fout = IFFT(car["real"], car["imag"], size=1024, overlaps=4).mix(2).out()
- >>> s.start()
-
- """
- def __init__(self, inmag, inang, mul=1, add=0):
- PyoObject.__init__(self)
- self._real_dummy = []
- self._imag_dummy = []
- self._inmag = inmag
- self._inang = inang
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(inmag)
- self._in_fader2 = InputFader(inang)
- in_fader, in_fader2, mul, add, lmax = convertArgsToLists(self._in_fader, self._in_fader2, mul, add)
- self._base_objs = []
- for i in range(lmax):
- self._base_objs.append(PolToCar_base(wrap(in_fader,i), wrap(in_fader2,i), 0, wrap(mul,i), wrap(add,i)))
- self._base_objs.append(PolToCar_base(wrap(in_fader,i), wrap(in_fader2,i), 1, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['inmag', 'inang', 'mul', 'add']
-
- def __len__(self):
- return len(self._inmag)
-
- def __getitem__(self, str):
- if str == 'real':
- self._real_dummy.append(Dummy([obj for i, obj in enumerate(self._base_objs) if i%2 == 0]))
- return self._real_dummy[-1]
- if str == 'imag':
- self._imag_dummy.append(Dummy([obj for i, obj in enumerate(self._base_objs) if i%2 == 1]))
- return self._imag_dummy[-1]
-
- def get(self, identifier="real", all=False):
- """
- Return the first sample of the current buffer as a float.
-
- Can be used to convert audio stream to usable Python data.
-
- "real" or "imag" must be given to `identifier` to specify
- which stream to get value from.
-
- Parameters:
-
- identifier : string {"real", "imag"}
- Address string parameter identifying audio stream.
- Defaults to "mag".
- all : boolean, optional
- If True, the first value of each object's stream
- will be returned as a list. Otherwise, only the value
- of the first object's stream will be returned as a float.
- Defaults to False.
-
- """
- if not all:
- return self.__getitem__(identifier)[0]._getStream().getValue()
- else:
- return [obj._getStream().getValue() for obj in self.__getitem__(identifier).getBaseObjects()]
-
- def setInMag(self, x, fadetime=0.05):
- """
- Replace the `inmag` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to process.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._inmag = x
- self._in_fader.setInput(x, fadetime)
-
- def setInAng(self, x, fadetime=0.05):
- """
- Replace the `inang` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to process.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._inang = x
- self._in_fader2.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def inmag(self):
- """PyoObject. Magnitude input signal."""
- return self._inmag
- @inmag.setter
- def inmag(self, x): self.setInMag(x)
-
- @property
- def inang(self):
- """PyoObject. Angle input signal."""
- return self._inang
- @inang.setter
- def inang(self, x): self.setInAng(x)
-
-class FrameDelta(PyoObject):
- """
- Computes the phase differences between successive frames.
-
- The difference between the phase values of successive FFT frames for a given bin
- determines the exact frequency of the energy centered in that bin. This is often
- known as the phase difference (and sometimes also referred to as phase derivative
- or instantaneous frequency if it's been subjected to a few additional calculations).
-
- In order to reconstruct a plausible playback of re-ordered FFT frames, we need to
- calculate the phase difference between successive frames and use it to construct a
- `running phase` (by simply summing the successive differences with FrameAccum) for
- the output FFT frames.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Phase input signal, usually from an FFT analysis.
- framesize : int, optional
- Frame size in samples. Usually the same as the FFT size.
- Defaults to 1024.
- overlaps : int, optional
- Number of overlaps in incomming signal. Usually the same
- as the FFT overlaps. Defaults to 4.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFrameSize(x) : Replace the `framesize` attribute.
-
- Attributes:
-
- input : PyoObject. Phase input signal.
- framesize : int. Frame size in samples.
-
- Notes:
-
- FrameDelta has no `out` method. Signal must be converted back to time domain,
- with IFFT, before being sent to output.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> snd = SNDS_PATH + '/transparent.aif'
- >>> size, hop = 1024, 256
- >>> nframes = sndinfo(snd)[0] / size
- >>> a = SfPlayer(snd, mul=.3)
- >>> m_mag = [NewMatrix(width=size, height=nframes) for i in range(4)]
- >>> m_pha = [NewMatrix(width=size, height=nframes) for i in range(4)]
- >>> fin = FFT(a, size=size, overlaps=4)
- >>> pol = CarToPol(fin["real"], fin["imag"])
- >>> delta = FrameDelta(pol["ang"], framesize=size, overlaps=4)
- >>> m_mag_rec = MatrixRec(pol["mag"], m_mag, 0, [i*hop for i in range(4)]).play()
- >>> m_pha_rec = MatrixRec(delta, m_pha, 0, [i*hop for i in range(4)]).play()
- >>> m_mag_read = MatrixPointer(m_mag, fin["bin"]/size, Sine(freq=0.25, mul=.5, add=.5))
- >>> m_pha_read = MatrixPointer(m_pha, fin["bin"]/size, Sine(freq=0.25, mul=.5, add=.5))
- >>> accum = FrameAccum(m_pha_read, framesize=size, overlaps=4)
- >>> car = PolToCar(m_mag_read, accum)
- >>> fout = IFFT(car["real"], car["imag"], size=size, overlaps=4).mix(1).out()
- >>> right = Delay(fout, delay=0.013).out(1)
-
- """
- def __init__(self, input, framesize=1024, overlaps=4, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._framesize = framesize
- self._overlaps = overlaps
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, framesize, overlaps, mul, add, lmax = convertArgsToLists(self._in_fader, framesize, overlaps, mul, add)
- num_of_mains = len(self._in_fader) / self._overlaps
- self._base_players = []
- for j in range(num_of_mains):
- objs_list = []
- for i in range(len(self._in_fader)):
- if (i % num_of_mains) == j:
- objs_list.append(self._in_fader[i])
- self._base_players.append(FrameDeltaMain_base(objs_list, wrap(framesize,j), wrap(overlaps,j)))
- self._base_objs = []
- for i in range(lmax):
- base_player = i % num_of_mains
- overlap = i / num_of_mains
- self._base_objs.append(FrameDelta_base(self._base_players[base_player], overlap, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['input', 'framesize', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFrameSize(self, x):
- """
- Replace the `framesize` attribute.
-
- Parameters:
-
- x : int
- new `framesize` attribute.
-
- """
- self._framesize = x
- x, lmax = convertArgsToLists(x)
- [obj.setFrameSize(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Phase input signal."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def framesize(self):
- """PyoObject. Frame size in samples."""
- return self._framesize
- @framesize.setter
- def framesize(self, x): self.setFrameSize(x)
-
-class FrameAccum(PyoObject):
- """
- Accumulates the phase differences between successive frames.
-
- The difference between the phase values of successive FFT frames for a given bin
- determines the exact frequency of the energy centered in that bin. This is often
- known as the phase difference (and sometimes also referred to as phase derivative
- or instantaneous frequency if it's been subjected to a few additional calculations).
-
- In order to reconstruct a plausible playback of re-ordered FFT frames, we need to
- calculate the phase difference between successive frames, with FrameDelta, and use
- it to construct a `running phase` (by simply summing the successive differences) for
- the output FFT frames.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Phase input signal.
- framesize : int, optional
- Frame size in samples. Usually same as the FFT size.
- Defaults to 1024.
- overlaps : int, optional
- Number of overlaps in incomming signal. Usually the same
- as the FFT overlaps. Defaults to 4.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFrameSize(x) : Replace the `framesize` attribute.
-
- Attributes:
-
- input : PyoObject. Phase input signal.
- framesize : int. Frame size in samples.
-
- Notes:
-
- FrameAccum has no `out` method. Signal must be converted back to time domain,
- with IFFT, before being sent to output.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> snd = SNDS_PATH + '/transparent.aif'
- >>> size, hop = 1024, 256
- >>> nframes = sndinfo(snd)[0] / size
- >>> a = SfPlayer(snd, mul=.3)
- >>> m_mag = [NewMatrix(width=size, height=nframes) for i in range(4)]
- >>> m_pha = [NewMatrix(width=size, height=nframes) for i in range(4)]
- >>> fin = FFT(a, size=size, overlaps=4)
- >>> pol = CarToPol(fin["real"], fin["imag"])
- >>> delta = FrameDelta(pol["ang"], framesize=size, overlaps=4)
- >>> m_mag_rec = MatrixRec(pol["mag"], m_mag, 0, [i*hop for i in range(4)]).play()
- >>> m_pha_rec = MatrixRec(delta, m_pha, 0, [i*hop for i in range(4)]).play()
- >>> m_mag_read = MatrixPointer(m_mag, fin["bin"]/size, Sine(freq=0.25, mul=.5, add=.5))
- >>> m_pha_read = MatrixPointer(m_pha, fin["bin"]/size, Sine(freq=0.25, mul=.5, add=.5))
- >>> accum = FrameAccum(m_pha_read, framesize=size, overlaps=4)
- >>> car = PolToCar(m_mag_read, accum)
- >>> fout = IFFT(car["real"], car["imag"], size=size, overlaps=4).mix(1).out()
- >>> right = Delay(fout, delay=0.013).out(1)
-
- """
- def __init__(self, input, framesize=1024, overlaps=4, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._framesize = framesize
- self._overlaps = overlaps
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, framesize, overlaps, mul, add, lmax = convertArgsToLists(self._in_fader, framesize, overlaps, mul, add)
- num_of_mains = len(self._in_fader) / self._overlaps
- self._base_players = []
- for j in range(num_of_mains):
- objs_list = []
- for i in range(len(self._in_fader)):
- if (i%num_of_mains) == j:
- objs_list.append(self._in_fader[i])
- self._base_players.append(FrameAccumMain_base(objs_list, wrap(framesize,j), wrap(overlaps,j)))
- self._base_objs = []
- for i in range(lmax):
- base_player = i % num_of_mains
- overlap = i / num_of_mains
- self._base_objs.append(FrameAccum_base(self._base_players[base_player], overlap, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['input', 'framesize', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFrameSize(self, x):
- """
- Replace the `framesize` attribute.
-
- Parameters:
-
- x : int
- new `framesize` attribute.
-
- """
- self._framesize = x
- x, lmax = convertArgsToLists(x)
- [obj.setFrameSize(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Phase input signal."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def framesize(self):
- """PyoObject. Frame size in samples."""
- return self._framesize
- @framesize.setter
- def framesize(self, x): self.setFrameSize(x)
-
-class Vectral(PyoObject):
- """
- Performs magnitude smoothing between successive frames.
-
- Vectral applies filter with different coefficients for increasing
- and decreasing magnitude vectors, bin by bin.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Magnitude input signal, usually from an FFT analysis.
- framesize : int, optional
- Frame size in samples. Usually the same as the FFT size.
- Defaults to 1024.
- overlaps : int, optional
- Number of overlaps in incomming signal. Usually the same
- as the FFT overlaps. Defaults to 4.
- up : float or PyoObject, optional
- Filter coefficient for increasing bins, between 0 and 1.
- Lower values results in a longer ramp time for bin magnitude.
- Defaults to 1.
- down : float or PyoObject, optional
- Filter coefficient for decreasing bins, between 0 and 1.
- Lower values results in a longer decay time for bin magnitude.
- Defaults to 0.7
- damp : float or PyoObject, optional
- High frequencies damping factor, between 0 and 1. Lower values
- mean more damping. Defaults to 0.9.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFrameSize(x) : Replace the `framesize` attribute.
- setUp(x) : Replace the `up` attribute.
- setDown(x) : Replace the `down` attribute.
- setDamp(x) : Replace the `damp` attribute.
-
- Attributes:
-
- input : PyoObject. Phase input signal.
- framesize : int. Frame size in samples.
- up : float or PyoObject. Filter coefficient for increasing bins.
- down : float or PyoObject. Filter coefficient for decreasing bins.
- damp : float or PyoObject. High frequencies damping factor.
-
- Notes:
-
- Vectral has no `out` method. Signal must be converted back to time domain,
- with IFFT, before being sent to output.
-
- Examples:
-
- >>> s = Server().boot()
- >>> snd = SNDS_PATH + '/accord.aif'
- >>> size, olaps = 1024, 4
- >>> snd = SfPlayer(snd, speed=[.75,.8], loop=True, mul=.3)
- >>> fin = FFT(snd, size=size, overlaps=olaps)
- >>> pol = CarToPol(fin["real"], fin["imag"])
- >>> vec = Vectral(pol["mag"], framesize=size, overlaps=olaps, down=.2, damp=.6)
- >>> car = PolToCar(vec, pol["ang"])
- >>> fout = IFFT(car["real"], car["imag"], size=size, overlaps=olaps).mix(2).out()
- >>> s.start()
-
- """
- def __init__(self, input, framesize=1024, overlaps=4, up=1.0, down=0.7, damp=0.9, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._framesize = framesize
- self._overlaps = overlaps
- self._up = up
- self._down = down
- self._damp = damp
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, framesize, overlaps, up, down, damp, mul, add, lmax = convertArgsToLists(self._in_fader, framesize, overlaps, up, down, damp, mul, add)
- num_of_mains = len(self._in_fader) / self._overlaps
- self._base_players = []
- for j in range(num_of_mains):
- objs_list = []
- for i in range(len(self._in_fader)):
- if (i % num_of_mains) == j:
- objs_list.append(self._in_fader[i])
- self._base_players.append(VectralMain_base(objs_list, wrap(framesize,j), wrap(overlaps,j), wrap(up,j), wrap(down,j), wrap(damp,j)))
- self._base_objs = []
- for i in range(lmax):
- base_player = i % num_of_mains
- overlap = i / num_of_mains
- self._base_objs.append(Vectral_base(self._base_players[base_player], overlap, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['input', 'framesize', 'up', 'down', 'damp', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFrameSize(self, x):
- """
- Replace the `framesize` attribute.
-
- Parameters:
-
- x : int
- new `framesize` attribute.
-
- """
- self._framesize = x
- x, lmax = convertArgsToLists(x)
- [obj.setFrameSize(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setUp(self, x):
- """
- Replace the `up` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `up` attribute.
-
- """
- self._up = x
- x, lmax = convertArgsToLists(x)
- [obj.setUp(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setDown(self, x):
- """
- Replace the `down` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `down` attribute.
-
- """
- self._down = x
- x, lmax = convertArgsToLists(x)
- [obj.setDown(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setDamp(self, x):
- """
- Replace the `damp` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `damp` attribute.
-
- """
- self._damp = x
- x, lmax = convertArgsToLists(x)
- [obj.setDamp(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0., 1., "lin", "up", self._up),
- SLMap(0., 1., "lin", "down", self._down),
- SLMap(0., 1., "lin", "damp", self._damp),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Magnitude input signal."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def framesize(self):
- """int. Frame size in samples."""
- return self._framesize
- @framesize.setter
- def framesize(self, x): self.setFrameSize(x)
-
- @property
- def up(self):
- """float or PyoObject. Filter coefficient for increasing bins."""
- return self._up
- @up.setter
- def up(self, x): self.setUp(x)
-
- @property
- def down(self):
- """float or PyoObject. Filter coefficient for decreasing bins."""
- return self._down
- @down.setter
- def down(self, x): self.setDown(x)
-
- @property
- def damp(self):
- """float or PyoObject. High frequencies damping factor."""
- return self._damp
- @damp.setter
- def damp(self, x): self.setDamp(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/generators.py b/build/lib.linux-x86_64-2.7/pyolib/generators.py
deleted file mode 100644
index 6230eec..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/generators.py
+++ /dev/null
@@ -1,1510 +0,0 @@
-"""
-Synthesis generators.
-
-Set of synthesis generators that can be used as sources of a signal
-processing chain or as parameter's modifiers.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-
-######################################################################
-### Sources
-######################################################################
-class Sine(PyoObject):
- """
- A simple sine wave oscillator.
-
- Parentclass: PyoObject
-
- Parameters:
-
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 1000.
- phase : float or PyoObject, optional
- Phase of sampling, expressed as a fraction of a cycle (0 to 1).
- Defaults to 0.
-
- Methods:
-
- setFreq(x) : Replace the `freq` attribute.
- setPhase(x) : Replace the `phase` attribute.
- reset() : Resets the reading pointer to 0.
-
- Attributes:
-
- freq : float or PyoObject, Frequency in cycles per second.
- phase : float or PyoObject, Phase of sampling (0 -> 1).
-
- See also: Osc, Phasor
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sine = Sine(freq=[400,500], mul=.2).out()
-
- """
- def __init__(self, freq=1000, phase=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._freq = freq
- self._phase = phase
- self._mul = mul
- self._add = add
- freq, phase, mul, add, lmax = convertArgsToLists(freq, phase, mul, add)
- self._base_objs = [Sine_base(wrap(freq,i), wrap(phase,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['freq', 'phase', 'mul', 'add']
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPhase(self, x):
- """
- Replace the `phase` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `phase` attribute.
-
- """
- self._phase = x
- x, lmax = convertArgsToLists(x)
- [obj.setPhase(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self):
- """
- Resets current phase to 0.
-
- """
- [obj.reset() for i, obj in enumerate(self._base_objs)]
-
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMapPhase(self._phase), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def phase(self):
- """float or PyoObject. Phase of sampling."""
- return self._phase
- @phase.setter
- def phase(self, x): self.setPhase(x)
-
-class SineLoop(PyoObject):
- """
- A simple sine wave oscillator with feedback.
-
- The oscillator output, multiplied by `feedback`, is added to the position
- increment and can be used to control the brightness of the oscillator.
-
- Parentclass: PyoObject
-
- Parameters:
-
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 1000.
- feedback : float or PyoObject, optional
- Amount of the output signal added to position increment, between 0 and 1.
- Controls the brightness. Defaults to 0.
-
- Methods:
-
- setFreq(x) : Replace the `freq` attribute.
- setFeedback(x) : Replace the `feedback` attribute.
-
- Attributes:
-
- freq : float or PyoObject, Frequency in cycles per second.
- feedback : float or PyoObject, Brightness control.
-
- See also: Sine, OscLoop
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> lfo = Sine(.25, 0, .1, .1)
- >>> a = SineLoop(freq=[400,500], feedback=lfo, mul=.2).out()
-
- """
- def __init__(self, freq=1000, feedback=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._freq = freq
- self._feedback = feedback
- self._mul = mul
- self._add = add
- freq, feedback, mul, add, lmax = convertArgsToLists(freq, feedback, mul, add)
- self._base_objs = [SineLoop_base(wrap(freq,i), wrap(feedback,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['freq', 'feedback', 'mul', 'add']
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFeedback(self, x):
- """
- Replace the `feedback` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `feedback` attribute.
-
- """
- self._feedback = x
- x, lmax = convertArgsToLists(x)
- [obj.setFeedback(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMap(0, 1, "lin", "feedback", self._feedback), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def feedback(self):
- """float or PyoObject. Brightness control."""
- return self._feedback
- @feedback.setter
- def feedback(self, x): self.setFeedback(x)
-
-class Phasor(PyoObject):
- """
- A simple phase incrementor.
-
- Output is a periodic ramp from 0 to 1.
-
- Parentclass: PyoObject
-
- Parameters:
-
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 100.
- phase : float or PyoObject, optional
- Phase of sampling, expressed as a fraction of a cycle (0 to 1).
- Defaults to 0.
-
- Methods:
-
- setFreq(x) : Replace the `freq` attribute.
- setPhase(x) : Replace the `phase` attribute.
- reset() : Resets the reading pointer to 0.
-
- Attributes:
-
- freq : float or PyoObject, Frequency in cycles per second.
- phase : float or PyoObject, Phase of sampling (0 -> 1).
-
- See also: Osc, Sine
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> f = Phasor(freq=[1, 1.5], mul=1000, add=500)
- >>> sine = Sine(freq=f, mul=.2).out()
-
- """
- def __init__(self, freq=100, phase=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._freq = freq
- self._phase = phase
- self._mul = mul
- self._add = add
- freq, phase, mul, add, lmax = convertArgsToLists(freq, phase, mul, add)
- self._base_objs = [Phasor_base(wrap(freq,i), wrap(phase,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['freq', 'phase', 'mul', 'add']
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPhase(self, x):
- """
- Replace the `phase` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `phase` attribute.
-
- """
- self._phase = x
- x, lmax = convertArgsToLists(x)
- [obj.setPhase(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self):
- """
- Resets current phase to 0.
-
- """
- [obj.reset() for i, obj in enumerate(self._base_objs)]
-
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMapPhase(self._phase), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def phase(self):
- """float or PyoObject. Phase of sampling."""
- return self._phase
- @phase.setter
- def phase(self, x): self.setPhase(x)
-
-class Input(PyoObject):
- """
- Read from a numbered channel in an external audio signal.
-
- Parentclass: PyoObject
-
- Parameters:
-
- chnl : int, optional
- Input channel to read from. Defaults to 0.
-
- Notes:
-
- Requires that the Server's duplex mode is set to 1.
-
- Examples:
-
- >>> s = Server(duplex=1).boot()
- >>> s.start()
- >>> a = Input(chnl=0, mul=.7)
- >>> b = Delay(a, delay=.25, feedback=.5, mul=.5).out()
-
- """
- def __init__(self, chnl=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._chnl = chnl
- self._mul = mul
- self._add = add
- chnl, mul, add, lmax = convertArgsToLists(chnl, mul, add)
- self._base_objs = [Input_base(wrap(chnl,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['mul', 'add']
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class Noise(PyoObject):
- """
- A white noise generator.
-
- Parentclass: PyoObject
-
- Methods:
-
- setType(x) : Sets the generation algorithm.
-
- Attributes:
-
- type : int {0, 1}, Generation algorithm.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(.1).mix(2).out()
-
- """
- def __init__(self, mul=1, add=0):
- PyoObject.__init__(self)
- self._type = 0
- self._mul = mul
- self._add = add
- mul, add, lmax = convertArgsToLists(mul, add)
- self._base_objs = [Noise_base(wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['mul', 'add']
-
- def setType(self, x):
- """
- Sets the generation algorithm.
-
- Parameters:
-
- x : int, {0, 1}
- 0 uses the system rand() method to generate number. Used as default.
- 1 uses a simple linear congruential generator, cheaper than rand().
-
- """
- self._type = x
- x, lmax = convertArgsToLists(x)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def type(self):
- """int {0, 1}. Sets the generation algorithm."""
- return self._type
- @type.setter
- def type(self, x): self.setType(x)
-
-class PinkNoise(PyoObject):
- """
- A pink noise generator.
-
- Paul Kellet's implementation of pink noise generator.
-
- This is an approximation to a -10dB/decade filter using a weighted sum
- of first order filters. It is accurate to within +/-0.05dB above 9.2Hz
- (44100Hz sampling rate).
-
- Parentclass: PyoObject
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = PinkNoise(.1).mix(2).out()
-
- """
- def __init__(self, mul=1, add=0):
- PyoObject.__init__(self)
- self._mul = mul
- self._add = add
- mul, add, lmax = convertArgsToLists(mul, add)
- self._base_objs = [PinkNoise_base(wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['mul', 'add']
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class BrownNoise(PyoObject):
- """
- A brown noise generator.
-
- The spectrum of a brown noise has a power density which decreases 6 dB
- per octave with increasing frequency (density proportional to 1/f^2).
-
- Parentclass: PyoObject
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = BrownNoise(.1).mix(2).out()
-
- """
- def __init__(self, mul=1, add=0):
- PyoObject.__init__(self)
- self._mul = mul
- self._add = add
- mul, add, lmax = convertArgsToLists(mul, add)
- self._base_objs = [BrownNoise_base(wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['mul', 'add']
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class FM(PyoObject):
- """
- A simple frequency modulation generator.
-
- Implements frequency modulation synthesis based on Chowning's algorithm.
-
- Parentclass: PyoObject
-
- Parameters:
-
- carrier : float or PyoObject, optional
- Carrier frequency in cycles per second. Defaults to 100.
- ratio : float or PyoObject, optional
- A factor that, when multiplied by the `carrier` parameter,
- gives the modulator frequency. Defaults to 0.5.
- index : float or PyoObject, optional
- The modulation index. This value multiplied by the modulator
- frequency gives the modulator amplitude. Defaults to 5.
-
- Methods:
-
- setCarrier(x) : Replace the `carrier` attribute.
- setRatio(x) : Replace the `ratio` attribute.
- setIndex(x) : Replace the `index` attribute.
-
- Attributes:
-
- carrier : float or PyoObject, Carrier frequency in cycles per second.
- ratio : float or PyoObject, Modulator/Carrier ratio.
- index : float or PyoObject, Modulation index.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> ind = LinTable([(0,3), (20,40), (300,10), (1000,5), (8191,3)])
- >>> m = Metro(4).play()
- >>> tr = TrigEnv(m, table=ind, dur=4)
- >>> f = FM(carrier=[251,250], ratio=[.2498,.2503], index=tr, mul=.2).out()
-
- """
- def __init__(self, carrier=100, ratio=0.5, index=5, mul=1, add=0):
- PyoObject.__init__(self)
- self._carrier = carrier
- self._ratio = ratio
- self._index = index
- self._mul = mul
- self._add = add
- carrier, ratio, index, mul, add, lmax = convertArgsToLists(carrier, ratio, index, mul, add)
- self._base_objs = [Fm_base(wrap(carrier,i), wrap(ratio,i), wrap(index,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['carrier', 'ratio', 'index', 'mul', 'add']
-
- def setCarrier(self, x):
- """
- Replace the `carrier` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `carrier` attribute.
-
- """
- self._carrier = x
- x, lmax = convertArgsToLists(x)
- [obj.setCarrier(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRatio(self, x):
- """
- Replace the `ratio` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `ratio` attribute.
-
- """
- self._ratio = x
- x, lmax = convertArgsToLists(x)
- [obj.setRatio(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setIndex(self, x):
- """
- Replace the `index` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `index` attribute.
-
- """
- self._index = x
- x, lmax = convertArgsToLists(x)
- [obj.setIndex(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(10, 500, "lin", "carrier", self._carrier),
- SLMap(.01, 10, "lin", "ratio", self._ratio),
- SLMap(0, 20, "lin", "index", self._index),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def carrier(self):
- """float or PyoObject. Carrier frequency in cycles per second."""
- return self._carrier
- @carrier.setter
- def carrier(self, x): self.setCarrier(x)
-
- @property
- def ratio(self):
- """float or PyoObject. Modulator/Carrier ratio."""
- return self._ratio
- @ratio.setter
- def ratio(self, x): self.setRatio(x)
-
- @property
- def index(self):
- """float or PyoObject. Modulation index."""
- return self._index
- @index.setter
- def index(self, x): self.setIndex(x)
-
-class CrossFM(PyoObject):
- """
- Cross frequency modulation generator.
-
- Frequency modulation synthesis where the output of both oscillators
- modulates the frequency of the other one.
-
- Parentclass: PyoObject
-
- Parameters:
-
- carrier : float or PyoObject, optional
- Carrier frequency in cycles per second. Defaults to 100.
- ratio : float or PyoObject, optional
- A factor that, when multiplied by the `carrier` parameter,
- gives the modulator frequency. Defaults to 0.5.
- ind1 : float or PyoObject, optional
- The carrier index. This value multiplied by the carrier
- frequency gives the carrier amplitude for modulating the
- modulation oscillator frequency.
- Defaults to 2.
- ind1 : float or PyoObject, optional
- The modulation index. This value multiplied by the modulation
- frequency gives the modulation amplitude for modulating the
- carrier oscillator frequency.
- Defaults to 2.
-
- Methods:
-
- setCarrier(x) : Replace the `carrier` attribute.
- setRatio(x) : Replace the `ratio` attribute.
- setInd1(x) : Replace the `ind1` attribute.
- setInd2(x) : Replace the `ind2` attribute.
-
- Attributes:
-
- carrier : float or PyoObject, Carrier frequency in cycles per second.
- ratio : float or PyoObject, Modulator/Carrier ratio.
- ind1 : float or PyoObject, Carrier index.
- ind2 : float or PyoObject, Modulation index.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> ind = LinTable([(0,20), (200,5), (1000,2), (8191,1)])
- >>> m = Metro(4).play()
- >>> tr = TrigEnv(m, table=ind, dur=4)
- >>> f = CrossFM(carrier=[250.5,250], ratio=[.2499,.2502], ind1=tr, ind2=tr, mul=.2).out()
-
- """
- def __init__(self, carrier=100, ratio=0.5, ind1=2, ind2=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._carrier = carrier
- self._ratio = ratio
- self._ind1 = ind1
- self._ind2 = ind2
- self._mul = mul
- self._add = add
- carrier, ratio, ind1, ind2, mul, add, lmax = convertArgsToLists(carrier, ratio, ind1, ind2, mul, add)
- self._base_objs = [CrossFm_base(wrap(carrier,i), wrap(ratio,i), wrap(ind1,i), wrap(ind2,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['carrier', 'ratio', 'ind1', 'ind2', 'mul', 'add']
-
- def setCarrier(self, x):
- """
- Replace the `carrier` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `carrier` attribute.
-
- """
- self._carrier = x
- x, lmax = convertArgsToLists(x)
- [obj.setCarrier(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRatio(self, x):
- """
- Replace the `ratio` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `ratio` attribute.
-
- """
- self._ratio = x
- x, lmax = convertArgsToLists(x)
- [obj.setRatio(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInd1(self, x):
- """
- Replace the `ind1` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `ind1` attribute.
-
- """
- self._ind1 = x
- x, lmax = convertArgsToLists(x)
- [obj.setInd1(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInd2(self, x):
- """
- Replace the `ind2` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `ind2` attribute.
-
- """
- self._ind2 = x
- x, lmax = convertArgsToLists(x)
- [obj.setInd2(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(10, 500, "lin", "carrier", self._carrier),
- SLMap(.01, 10, "lin", "ratio", self._ratio),
- SLMap(0, 20, "lin", "ind1", self._ind1),
- SLMap(0, 20, "lin", "ind2", self._ind2),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def carrier(self):
- """float or PyoObject. Carrier frequency in cycles per second."""
- return self._carrier
- @carrier.setter
- def carrier(self, x): self.setCarrier(x)
-
- @property
- def ratio(self):
- """float or PyoObject. Modulator/Carrier ratio."""
- return self._ratio
- @ratio.setter
- def ratio(self, x): self.setRatio(x)
-
- @property
- def ind1(self):
- """float or PyoObject. Carrier index."""
- return self._ind1
- @ind1.setter
- def ind1(self, x): self.setInd1(x)
-
- @property
- def ind2(self):
- """float or PyoObject. Modulation index."""
- return self._ind2
- @ind2.setter
- def ind2(self, x): self.setInd2(x)
-
-class Blit(PyoObject):
- """
- Band limited impulse train synthesis.
-
- Impulse train generator with control over the number of harmonics
- in the spectrum, which gives oscillators with very low aliasing.
-
- Parentclass: PyoObject
-
- Parameters:
-
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 100.
- harms : float or PyoObject, optional
- Number of harmonics in the generated spectrum. Defaults to 40.
-
- Methods:
-
- setFreq(x) : Replace the `freq` attribute.
- setHarms(x) : Replace the `harms` attribute.
-
- Attributes:
-
- freq : float or PyoObject, Frequency in cycles per second.
- harms : float or PyoObject, Number of harmonics.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> lfo = Sine(freq=4, mul=.02, add=1)
- >>> lf2 = Sine(freq=.25, mul=10, add=30)
- >>> a = Blit(freq=[100, 99.7]*lfo, harms=lf2, mul=.3).out()
-
- """
- def __init__(self, freq=100, harms=40, mul=1, add=0):
- PyoObject.__init__(self)
- self._freq = freq
- self._harms = harms
- self._mul = mul
- self._add = add
- freq, harms, mul, add, lmax = convertArgsToLists(freq, harms, mul, add)
- self._base_objs = [Blit_base(wrap(freq,i), wrap(harms,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['freq', 'harms', 'mul', 'add']
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setHarms(self, x):
- """
- Replace the `harms` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `harms` attribute.
-
- """
- self._harms = x
- x, lmax = convertArgsToLists(x)
- [obj.setHarms(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(1, 5000, "log", "freq", self._freq),
- SLMap(2, 100, "lin", "harms", self._harms),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def harms(self):
- """float or PyoObject. Number of harmonics."""
- return self._harms
- @harms.setter
- def harms(self, x): self.setHarms(x)
-
-class Rossler(PyoObject):
- """
- Chaotic attractor for the Rossler system.
-
- The Rossler attractor is a system of three non-linear ordinary differential
- equations. These differential equations define a continuous-time dynamical
- system that exhibits chaotic dynamics associated with the fractal properties
- of the attractor.
-
- Parentclass: PyoObject
-
- Parameters:
-
- pitch : float or PyoObject, optional
- Controls the speed, in the range 0 -> 1, of the variations. With values
- below 0.2, this object can be used as a low frequency oscillator (LFO)
- and above 0.2, it will generate a broad spectrum noise with harmonic peaks.
- Defaults to 0.25.
- chaos : float or PyoObject, optional
- Controls the chaotic behavior, in the range 0 -> 1, of the oscillator.
- 0 means nearly periodic while 1 is totally chaotic. Defaults to 0.5.
- stereo, boolean, optional
- If True, 2 streams will be generated, one with the X variable signal of
- the algorithm and a second composed of the Y variable signal of the algorithm.
- These two signal are strongly related in their frequency spectrum but
- the Y signal is out-of-phase by approximatly 180 degrees. Useful to create
- alternating LFOs. Available at initialization only. Defaults to False.
-
- Methods:
-
- setPitch(x) : Replace the `pitch` attribute.
- setChaos(x) : Replace the `chaos` attribute.
-
- Attributes:
-
- pitch : float or PyoObject, Speed of the variations {0. -> 1.}.
- chaos : float or PyoObject, Chaotic behavior {0. -> 1.}.
-
- See also: Lorenz
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Rossler(pitch=.003, stereo=True, mul=.2, add=.2)
- >>> b = Rossler(pitch=[.5,.48], mul=a).out()
-
- """
- def __init__(self, pitch=0.25, chaos=0.5, stereo=False, mul=1, add=0):
- PyoObject.__init__(self)
- self._pitch = pitch
- self._chaos = chaos
- self._stereo = stereo
- self._mul = mul
- self._add = add
- pitch, chaos, mul, add, lmax = convertArgsToLists(pitch, chaos, mul, add)
- self._base_objs = []
- self._alt_objs = []
- for i in range(lmax):
- self._base_objs.append(Rossler_base(wrap(pitch,i), wrap(chaos,i), wrap(mul,i), wrap(add,i)))
- if self._stereo:
- self._base_objs.append(RosslerAlt_base(self._base_objs[-1], wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['pitch', 'chaos', 'mul', 'add']
-
- def setPitch(self, x):
- """
- Replace the `pitch` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `pitch` attribute. {0. -> 1.}
-
- """
- self._pitch = x
- x, lmax = convertArgsToLists(x)
- if self._stereo:
- [obj.setPitch(wrap(x,i)) for i, obj in enumerate(self._base_objs) if (i % 2) == 0]
- else:
- [obj.setPitch(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setChaos(self, x):
- """
- Replace the `chaos` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `chaos` attribute. {0. -> 1.}
-
- """
- self._chaos = x
- x, lmax = convertArgsToLists(x)
- if self._stereo:
- [obj.setChaos(wrap(x,i)) for i, obj in enumerate(self._base_objs) if (i % 2) == 0]
- else:
- [obj.setChaos(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", "pitch", self._pitch),
- SLMap(0., 1., "lin", "chaos", self._chaos), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def pitch(self):
- """float or PyoObject. Speed of the variations."""
- return self._pitch
- @pitch.setter
- def pitch(self, x): self.setPitch(x)
-
- @property
- def chaos(self):
- """float or PyoObject. Chaotic behavior."""
- return self._chaos
- @chaos.setter
- def chaos(self, x): self.setChaos(x)
-
-class Lorenz(PyoObject):
- """
- Chaotic attractor for the Lorenz system.
-
- The Lorenz attractor is a system of three non-linear ordinary differential
- equations. These differential equations define a continuous-time dynamical
- system that exhibits chaotic dynamics associated with the fractal properties
- of the attractor.
-
- Parentclass: PyoObject
-
- Parameters:
-
- pitch : float or PyoObject, optional
- Controls the speed, in the range 0 -> 1, of the variations. With values
- below 0.2, this object can be used as a low frequency oscillator (LFO)
- and above 0.2, it will generate a broad spectrum noise with harmonic peaks.
- Defaults to 0.25.
- chaos : float or PyoObject, optional
- Controls the chaotic behavior, in the range 0 -> 1, of the oscillator.
- 0 means nearly periodic while 1 is totally chaotic. Defaults to 0.5
- stereo, boolean, optional
- If True, 2 streams will be generated, one with the X variable signal of
- the algorithm and a second composed of the Y variable signal of the algorithm.
- These two signal are strongly related in their frequency spectrum but
- the Y signal is out-of-phase by approximatly 180 degrees. Useful to create
- alternating LFOs. Available at initialization only. Defaults to False.
-
- Methods:
-
- setPitch(x) : Replace the `pitch` attribute.
- setChaos(x) : Replace the `chaos` attribute.
-
- Attributes:
-
- pitch : float or PyoObject, Speed of the variations {0. -> 1.}.
- chaos : float or PyoObject, Chaotic behavior {0. -> 1.}.
-
- See also: Rossler
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Lorenz(pitch=.003, stereo=True, mul=.2, add=.2)
- >>> b = Lorenz(pitch=[.4,.38], mul=a).out()
-
- """
- def __init__(self, pitch=0.25, chaos=0.5, stereo=False, mul=1, add=0):
- PyoObject.__init__(self)
- self._pitch = pitch
- self._chaos = chaos
- self._stereo = stereo
- self._mul = mul
- self._add = add
- pitch, chaos, mul, add, lmax = convertArgsToLists(pitch, chaos, mul, add)
- self._base_objs = []
- self._alt_objs = []
- for i in range(lmax):
- self._base_objs.append(Lorenz_base(wrap(pitch,i), wrap(chaos,i), wrap(mul,i), wrap(add,i)))
- if self._stereo:
- self._base_objs.append(LorenzAlt_base(self._base_objs[-1], wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['pitch', 'chaos', 'mul', 'add']
-
- def setPitch(self, x):
- """
- Replace the `pitch` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `pitch` attribute. {0. -> 1.}
-
- """
- self._pitch = x
- x, lmax = convertArgsToLists(x)
- if self._stereo:
- [obj.setPitch(wrap(x,i)) for i, obj in enumerate(self._base_objs) if (i % 2) == 0]
- else:
- [obj.setPitch(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setChaos(self, x):
- """
- Replace the `chaos` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `chaos` attribute. {0. -> 1.}
-
- """
- self._chaos = x
- x, lmax = convertArgsToLists(x)
- if self._stereo:
- [obj.setChaos(wrap(x,i)) for i, obj in enumerate(self._base_objs) if (i % 2) == 0]
- else:
- [obj.setChaos(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", "pitch", self._pitch),
- SLMap(0., 1., "lin", "chaos", self._chaos), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def pitch(self):
- """float or PyoObject. Speed of the variations."""
- return self._pitch
- @pitch.setter
- def pitch(self, x): self.setPitch(x)
-
- @property
- def chaos(self):
- """float or PyoObject. Chaotic behavior."""
- return self._chaos
- @chaos.setter
- def chaos(self, x): self.setChaos(x)
-
-class LFO(PyoObject):
- """
- Band-limited Low Frequency Oscillator with different wave shapes.
-
- Parentclass : PyoObject
-
- Parameters:
-
- freq : float or PyoObject, optional
- Oscillator frequency in cycles per second. Defaults to 100.
- sharp : float or PyoObject, optional
- Sharpness factor between 0 and 1. Sharper waveform results
- in more harmonics in the spectrum. Defaults to 0.5.
- type : int, optional
- Waveform type. eight possible values :
- 0 = Saw up (default)
- 1 = Saw down
- 2 = Square
- 3 = Triangle
- 4 = Pulse
- 5 = Bipolar pulse
- 6 = Sample and hold
- 7 = Modulated Sine
-
- Methods:
-
- setFreq(x) : Replace the `freq` attribute.
- setSharp(x) : Replace the `sharp` attribute.
- setType(x) : Replace the `type` attribute.
- reset() : Resets the reading pointer to 0.
-
- Attributes:
-
- freq : float or PyoObject. Oscillator frequency in cycles per second.
- sharp : float or PyoObject. Sharpness factor between 0 and 1.
- type : int. Waveform type.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> lf = Sine([.31,.34], mul=15, add=20)
- >>> lf2 = LFO([.43,.41], sharp=.7, type=2, mul=.4, add=.4)
- >>> a = LFO(freq=lf, sharp=lf2, type=7, mul=100, add=300)
- >>> b = SineLoop(freq=a, feedback=0.12, mul=.2).out()
-
- """
- def __init__(self, freq=100, sharp=0.5, type=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._freq = freq
- self._sharp = sharp
- self._type = type
- self._mul = mul
- self._add = add
- freq, sharp, type, mul, add, lmax = convertArgsToLists(freq, sharp, type, mul, add)
- self._base_objs = [LFO_base(wrap(freq,i), wrap(sharp,i), wrap(type,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['freq', 'sharp', 'type', 'mul', 'add']
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `freq` attribute, in cycles per seconds.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSharp(self, x):
- """
- Replace the `sharp` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `sharp` attribute, in the range 0 -> 1.
-
- """
- self._sharp = x
- x, lmax = convertArgsToLists(x)
- [obj.setSharp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setType(self, x):
- """
- Replace the `type` attribute.
-
- Parameters:
-
- x : int
- New `type` attribute. Choices are :
- 0 = Saw up, 1 = Saw down, 2 = Square, 3 = Triangle, 4 = Pulse
- 5 = Bipolar pulse, 6 = Sample and hold, 7 = Modulated Sine
-
-
- """
- if x >= 0 and x < 8:
- self._type = x
- x, lmax = convertArgsToLists(x)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self):
- """
- Resets current phase to 0.
-
- """
- [obj.reset() for i, obj in enumerate(self._base_objs)]
-
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMap(0., 1., "lin", "sharp", self._sharp), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def freq(self):
- """float or PyoObject. Oscillator frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def sharp(self):
- """float or PyoObject. Sharpness factor {0 -> 1}."""
- return self._sharp
- @sharp.setter
- def sharp(self, x): self.setSharp(x)
-
- @property
- def type(self):
- """int. Waveform type."""
- return self._type
- @type.setter
- def type(self, x): self.setType(x)
-
-class SumOsc(PyoObject):
- """
- Discrete summation formulae to produce complex spectra.
-
- This object implements a discrete summation formulae taken from
- the paper 'The synthesis of complex audio spectra by means of
- discrete summation formulae' by James A. Moorer. The formulae
- used is of this form:
-
- (sin(theta) - a * sin(theta - beta)) / (1 + a**2 - 2 * a * cos(beta))
-
- where 'theta' and 'beta' are periodic functions and 'a' is
- the modulation index, providing control over the damping of
- the partials.
-
- The resulting sound is related to the family of modulation
- techniques but this formulae express 'one-sided' spectra,
- useful to avoid aliasing from the negative frequencies.
-
- Parentclass: PyoObject
-
- Parameters:
-
- freq : float or PyoObject, optional
- Base frequency in cycles per second. Defaults to 100.
- ratio : float or PyoObject, optional
- A factor used to stretch or compress the partial serie by
- manipulating the frequency of the modulation oscillator.
- Integer ratios give harmonic spectra. Defaults to 0.5.
- index : float or PyoObject, optional
- Damping of successive partials, between 0 and 1. With a
- value of 0.5, each partial is 6dB lower than the previous
- partial. Defaults to 5.
-
- Methods:
-
- setFreq(x) : Replace the `freq` attribute.
- setRatio(x) : Replace the `ratio` attribute.
- setIndex(x) : Replace the `index` attribute.
-
- Attributes:
-
- freq : float or PyoObject, Base frequency in cycles per second.
- ratio : float or PyoObject, Base/modulator frequency ratio.
- index : float or PyoObject, High frequency damping.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> ind = LinTable([(0,.3), (20,.85), (300,.7), (1000,.5), (8191,.3)])
- >>> m = Metro(4).play()
- >>> tr = TrigEnv(m, table=ind, dur=4)
- >>> f = SumOsc(freq=[301,300], ratio=[.2498,.2503], index=tr, mul=.2).out()
-
- """
- def __init__(self, freq=100, ratio=0.5, index=0.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._freq = freq
- self._ratio = ratio
- self._index = index
- self._mul = mul
- self._add = add
- freq, ratio, index, mul, add, lmax = convertArgsToLists(freq, ratio, index, mul, add)
- self._base_objs = [SumOsc_base(wrap(freq,i), wrap(ratio,i), wrap(index,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['freq', 'ratio', 'index', 'mul', 'add']
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRatio(self, x):
- """
- Replace the `ratio` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `ratio` attribute.
-
- """
- self._ratio = x
- x, lmax = convertArgsToLists(x)
- [obj.setRatio(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setIndex(self, x):
- """
- Replace the `index` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `index` attribute.
-
- """
- self._index = x
- x, lmax = convertArgsToLists(x)
- [obj.setIndex(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(10, 500, "lin", "freq", self._freq),
- SLMap(.01, 10, "lin", "ratio", self._ratio),
- SLMap(0, 1, "lin", "index", self._index),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def freq(self):
- """float or PyoObject. Base frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def ratio(self):
- """float or PyoObject. Base/modulator frequency ratio."""
- return self._ratio
- @ratio.setter
- def ratio(self, x): self.setRatio(x)
-
- @property
- def index(self):
- """float or PyoObject. Index, high frequency damping."""
- return self._index
- @index.setter
- def index(self, x): self.setIndex(x)
-
-class SuperSaw(PyoObject):
- """
- Roland JP-8000 Supersaw emulator.
-
- This object implements an emulation of the Roland JP-8000 Supersaw algorithm.
- The shape of the waveform is produced from 7 sawtooth oscillators detuned
- against each other over a period of time. It allows control over the depth
- of the detuning and the balance between central and sideband oscillators.
-
- Parentclass: PyoObject
-
- Parameters:
-
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 100.
- detune : float or PyoObject, optional
- Depth of the detuning, between 0 and 1. 0 means all oscillators are
- tuned to the same frequency and 1 means sideband oscillators are at
- maximum detuning regarding the central frequency. Defaults to 0.5.
- bal : float or PyoObject, optional
- Balance between central oscillator and sideband oscillators. A value
- of 0 outputs only the central oscillator while a value of 1 gives a
- mix of all oscillators with the central one lower than the sidebands.
- Defaults to 0.7.
-
- Methods:
-
- setFreq(x) : Replace the `freq` attribute.
- setDetune(x) : Replace the `detune` attribute.
- setBal() : Replace the `bal` attribute.
-
- Attributes:
-
- freq : float or PyoObject, Frequency in cycles per second.
- detune : float or PyoObject, Depth of the detuning (0 -> 1).
- bal : float or PyoObject, Balance between central and sideband oscillators.
-
- See also: Phasor, SineLoop
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> lfd = Sine([.4,.3], mul=.2, add=.5)
- >>> a = SuperSaw(freq=[49,50], detune=lfd, bal=0.7, mul=0.2).out()
-
- """
- def __init__(self, freq=100, detune=0.5, bal=0.7, mul=1, add=0):
- PyoObject.__init__(self)
- self._freq = freq
- self._detune = detune
- self._bal = bal
- self._mul = mul
- self._add = add
- freq, detune, bal, mul, add, lmax = convertArgsToLists(freq, detune, bal, mul, add)
- self._base_objs = [SuperSaw_base(wrap(freq,i), wrap(detune,i), wrap(bal,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['freq', 'detune', 'bal', 'mul', 'add']
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDetune(self, x):
- """
- Replace the `detune` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `detune` attribute.
-
- """
- self._detune = x
- x, lmax = convertArgsToLists(x)
- [obj.setDetune(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setBal(self, x):
- """
- Replace the `bal` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `bal` attribute.
-
- """
- self._bal = x
- x, lmax = convertArgsToLists(x)
- [obj.setBal(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq),
- SLMap(0, 1, "lin", "detune", self._detune),
- SLMap(0, 1, "lin", "bal", self._bal), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def detune(self):
- """float or PyoObject. Depth of the detuning."""
- return self._detune
- @detune.setter
- def detune(self, x): self.setDetune(x)
-
- @property
- def bal(self):
- """float or PyoObject. Balance between central and sideband oscillators."""
- return self._bal
- @bal.setter
- def bal(self, x): self.setBal(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/matrix.py b/build/lib.linux-x86_64-2.7/pyolib/matrix.py
deleted file mode 100644
index 70efad0..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/matrix.py
+++ /dev/null
@@ -1,116 +0,0 @@
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-
-"""
-from _core import *
-from _maps import *
-
-######################################################################
-### Matrix
-######################################################################
-class NewMatrix(PyoMatrixObject):
- """
- Create a new matrix ready for recording.
-
- Optionally, the matrix can be filled with the contents of the
- `init` parameter.
-
- See `MatrixRec` to write samples in the matrix.
-
- Parentclass: PyoMatrixObject
-
- Parameters:
-
- width : int
- Desired matrix width in samples.
- height : int
- Desired matrix height in samples.
- init : list of list of floats, optional
- Initial matrix. Defaults to None.
-
- Methods:
-
- replace() : Replaces the actual matrix.
- getRate() : Returns the frequency (cycle per second) to give
- to an oscillator to read a row at its original pitch.
- genSineTerrain(freq, phase) : Generates a modulated sinusoidal terrain.
-
- See also: MatrixRec
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> SIZE = 256
- >>> mm = NewMatrix(SIZE, SIZE)
- >>> mm.genSineTerrain(freq=2, phase=16)
- >>> lfw = Sine([.1,.11], 0, .124, .25)
- >>> lfh = Sine([.15,.16], 0, .124, .25)
- >>> w = Sine(100, 0, lfw, .5)
- >>> h = Sine(10.5, 0, lfh, .5)
- >>> c = MatrixPointer(mm, w, h, mul=.2).out()
-
- """
- def __init__(self, width, height, init=None):
- PyoMatrixObject.__init__(self)
- self._size = (width, height)
- if init == None:
- self._base_objs = [NewMatrix_base(width, height)]
- else:
- self._base_objs = [NewMatrix_base(width, height, init)]
-
- def __dir__(self):
- return []
-
- def replace(self, x):
- """
- Replaces the actual matrix.
-
- Parameters:
-
- x : list of list of floats
- New matrix. Must be of the same size as the actual matrix.
-
- """
- [obj.setMatrix(x) for obj in self._base_objs]
-
- def getRate(self):
- """
- Returns the frequency (cycle per second) to give to an
- oscillator to read the sound at its original pitch.
-
- """
- return self._base_objs[0].getRate()
-
- def genSineTerrain(self, freq=1, phase=0.0625):
- """
- Generates a modulated sinusoidal terrain.
-
- Parameters:
-
- freq : float
- Frequency of sinusoids used to created the terrain.
- Defaults to 1.
- phase : float
- Phase deviation between rows of the terrain. Should be in
- the range 0 -> 1. Defaults to 0.0625.
-
- """
- [obj.genSineTerrain(freq, phase) for obj in self._base_objs]
-
diff --git a/build/lib.linux-x86_64-2.7/pyolib/matrixprocess.py b/build/lib.linux-x86_64-2.7/pyolib/matrixprocess.py
deleted file mode 100644
index 7788a47..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/matrixprocess.py
+++ /dev/null
@@ -1,560 +0,0 @@
-"""
-PyoObjects to perform operations on PyoMatrixObjects.
-
-PyoMatrixObjects are 2 dimensions table containers. They can be used
-to store audio samples or algorithmic sequences. Writing and reading
-are done by giving row and column positions.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-from types import SliceType
-
-class MatrixRec(PyoObject):
- """
- MatrixRec records samples into a previously created NewMatrix.
-
- See `NewMatrix` to create an empty matrix.
-
- The play method is not called at the object creation time. It starts
- the recording into the matrix, row after row, until the matrix is full.
- Calling the play method again restarts the recording and overwrites
- previously recorded samples.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal to write in the matrix.
- matrix : PyoMatrixObject
- The matrix where to write samples.
- fadetime : float, optional
- Fade time at the beginning and the end of the recording
- in seconds. Defaults to 0.
- delay : int, optional
- Delay time, in samples, before the recording begins.
- Available at initialization time only. Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMatrix(x) : Replace the `matrix` attribute.
- play() : Start the recording at the beginning of the matrix.
- stop() : Stop the recording. Otherwise, record through the
- end of the matrix.
-
- Attributes:
-
- input : PyoObject. Audio signal to write in the matrix.
- matrix : PyoMatrixObject. The matrix where to write samples.
-
- Notes:
-
- The out() method is bypassed. MatrixRec returns no signal.
-
- MatrixRec has no `mul` and `add` attributes.
-
- MatrixRec will sends a trigger signal at the end of the recording.
- User can retreive the trigger streams by calling obj['trig']. See
- `TableRec` documentation for an example.
-
- See also: NewMatrix
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> SIZE = 256
- >>> mm = NewMatrix(SIZE, SIZE)
- >>> fmind = Sine(.2, 0, 2, 2.5)
- >>> fmrat = Sine(.33, 0, .05, .5)
- >>> aa = FM(carrier=10, ratio=fmrat, index=fmind)
- >>> rec = MatrixRec(aa, mm, 0).play()
- >>> lfx = Sine(.1, 0, .24, .25)
- >>> lfy = Sine(.15, 0, .124, .25)
- >>> x = Sine([500,501], 0, lfx, .5)
- >>> y = Sine([10.5,10], 0, lfy, .5)
- >>> c = MatrixPointer(mm, x, y, .2).out()
-
- """
- def __init__(self, input, matrix, fadetime=0, delay=0):
- PyoObject.__init__(self)
- self._input = input
- self._matrix = matrix
- self._in_fader = InputFader(input)
- in_fader, matrix, fadetime, delay, lmax = convertArgsToLists(self._in_fader, matrix, fadetime, delay)
- self._base_objs = [MatrixRec_base(wrap(in_fader,i), wrap(matrix,i), wrap(fadetime,i), wrap(delay,i)) for i in range(len(matrix))]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
-
- def __dir__(self):
- return ['input', 'matrix']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMatrix(self, x):
- """
- Replace the `matrix` attribute.
-
- Parameters:
-
- x : NewMatrix
- new `matrix` attribute.
-
- """
- self._matrix = x
- x, lmax = convertArgsToLists(x)
- [obj.setMatrix(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Audio signal to record in the matrix."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def matrix(self):
- """PyoMatrixObject. The matrix where to write samples."""
- return self._matrix
- @matrix.setter
- def matrix(self, x): self.setMatrix(x)
-
-class MatrixRecLoop(PyoObject):
- """
- MatrixRecLoop records samples in loop into a previously created NewMatrix.
-
- See `NewMatrix` to create an empty matrix.
-
- MatrixRecLoop records samples into the matrix, row after row, until
- the matrix is full and then loop back to the beginning.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal to write in the matrix.
- matrix : PyoMatrixObject
- The matrix where to write samples.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMatrix(x) : Replace the `matrix` attribute.
-
- Attributes:
-
- input : PyoObject. Audio signal to write in the matrix.
- matrix : PyoMatrixObject. The matrix where to write samples.
-
- Notes:
-
- The out() method is bypassed. MatrixRecLoop returns no signal.
-
- MatrixRecLoop has no `mul` and `add` attributes.
-
- MatrixRecLoop will sends a trigger signal when reaching the end
- of the matrix. User can retreive the trigger streams by calling
- obj['trig']. See `TableRec` documentation for an example.
-
- See also: NewMatrix
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> env = CosTable([(0,0), (300,1), (1000,.4), (8191,0)])
- >>> matrix = NewMatrix(8192, 8)
- >>> src = SfPlayer(SNDS_PATH+'/transparent.aif', loop=True, mul=.3)
- >>> m_rec = MatrixRecLoop(src, matrix)
- >>> period = 8192 / s.getSamplingRate()
- >>> metro = Metro(time=period/2, poly=2).play()
- >>> x = TrigLinseg(metro, [(0,0), (period,1)])
- >>> y = TrigRandInt(metro, max=2, mul=0.125)
- >>> amp = TrigEnv(metro, table=env, dur=period)
- >>> out = MatrixPointer(matrix, x, y, amp).out()
-
- """
- def __init__(self, input, matrix):
- PyoObject.__init__(self)
- self._input = input
- self._matrix = matrix
- self._in_fader = InputFader(input)
- in_fader, matrix, lmax = convertArgsToLists(self._in_fader, matrix)
- self._base_objs = [MatrixRecLoop_base(wrap(in_fader,i), wrap(matrix,i)) for i in range(len(matrix))]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
-
- def __dir__(self):
- return ['input', 'matrix']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMatrix(self, x):
- """
- Replace the `matrix` attribute.
-
- Parameters:
-
- x : NewMatrix
- new `matrix` attribute.
-
- """
- self._matrix = x
- x, lmax = convertArgsToLists(x)
- [obj.setMatrix(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Audio signal to record in the matrix."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def matrix(self):
- """PyoMatrixObject. The matrix where to write samples."""
- return self._matrix
- @matrix.setter
- def matrix(self, x): self.setMatrix(x)
-
-class MatrixPointer(PyoObject):
- """
- Matrix reader with control on the 2D pointer position.
-
- Parentclass: PyoObject
-
- Parameters:
-
- matrix : PyoMatrixObject
- Matrix containing the waveform samples.
- x : PyoObject
- Normalized X position in the matrix between 0 and 1.
- y : PyoObject
- Normalized Y position in the matrix between 0 and 1.
-
- Methods:
-
- setMatrix(x) : Replace the `matrix` attribute.
- setX(x) : Replace the `x` attribute.
- setY(x) : Replace the `y` attribute
-
- Attributes:
-
- matrix : PyoMatrixObject. Matrix containing the waveform samples.
- x : PyoObject. X pointer position in the matrix.
- y : PyoObject. Y pointer position in the matrix.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> SIZE = 256
- >>> mm = NewMatrix(SIZE, SIZE)
- >>> fmind = Sine(.2, 0, 2, 2.5)
- >>> fmrat = Sine(.33, 0, .05, .5)
- >>> aa = FM(carrier=10, ratio=fmrat, index=fmind)
- >>> rec = MatrixRec(aa, mm, 0).play()
- >>> lfx = Sine(.1, 0, .24, .25)
- >>> lfy = Sine(.15, 0, .124, .25)
- >>> x = Sine([500,501], 0, lfx, .5)
- >>> y = Sine([10.5,10], 0, lfy, .5)
- >>> c = MatrixPointer(mm, x, y, .2).out()
-
- """
- def __init__(self, matrix, x, y, mul=1, add=0):
- PyoObject.__init__(self)
- self._matrix = matrix
- self._x = x
- self._y = y
- self._mul = mul
- self._add = add
- matrix, x, y, mul, add, lmax = convertArgsToLists(matrix, x, y, mul, add)
- self._base_objs = [MatrixPointer_base(wrap(matrix,i), wrap(x,i), wrap(y,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['matrix', 'x', 'y', 'mul', 'add']
-
- def setMatrix(self, x):
- """
- Replace the `matrix` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `matrix` attribute.
-
- """
- self._matrix = x
- x, lmax = convertArgsToLists(x)
- [obj.setMatrix(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX(self, x):
- """
- Replace the `x` attribute.
-
- Parameters:
-
- x : PyoObject
- new `x` attribute.
-
- """
- self._x = x
- x, lmax = convertArgsToLists(x)
- [obj.setX(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setY(self, x):
- """
- Replace the `y` attribute.
-
- Parameters:
-
- y : PyoObject
- new `y` attribute.
-
- """
- self._y = x
- x, lmax = convertArgsToLists(x)
- [obj.setY(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def matrix(self):
- """PyoMatrixObject. Matrix containing the samples."""
- return self._matrix
- @matrix.setter
- def matrix(self, x): self.setMatrix(x)
-
- @property
- def x(self):
- """PyoObject. Normalized X position in the matrix."""
- return self._x
- @x.setter
- def x(self, x): self.setX(x)
-
- @property
- def y(self):
- """PyoObject. Normalized Y position in the matrix."""
- return self._y
- @y.setter
- def y(self, x): self.setY(x)
-
-class MatrixMorph(PyoObject):
- """
- Morphs between multiple PyoMatrixObjects.
-
- Uses an index into a list of PyoMatrixObjects to morph between adjacent
- matrices in the list. The resulting morphed function is written into the
- `matrix` object at the beginning of each buffer size. The matrices in the
- list and the resulting matrix must be equal in size.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Morphing index between 0 and 1. 0 is the first matrix in the list
- and 1 is the last.
- matrix : NewMatrix
- The matrix where to write morphed function.
- sources : list of PyoMatrixObject
- List of matrices to interpolate from.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMatrix(x) : Replace the `matrix` attribute.
- setSources(x) : Replace the `sources` attribute.
-
- Attributes:
-
- input : PyoObject. Morphing index between 0 and 1.
- matrix : NewMatrix. The matrix where to write samples.
- sources : list of PyoMatrixObject. List of matrices to interpolate from.
-
- Notes:
-
- The out() method is bypassed. MatrixMorph returns no signal.
-
- MatrixMorph has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> m1 = NewMatrix(256, 256)
- >>> m1.genSineTerrain(1, 4)
- >>> m2 = NewMatrix(256, 256)
- >>> m2.genSineTerrain(2, 8)
- >>> mm = NewMatrix(256, 256)
- >>> inter = Sine(.2, 0, .5, .5)
- >>> morph = MatrixMorph(inter, mm, [m1,m2])
- >>> x = Sine([49,50], 0, .45, .5)
- >>> y = Sine([49.49,50.5], 0, .45, .5)
- >>> c = MatrixPointer(mm, x, y, .2).out()
-
- """
- def __init__(self, input, matrix, sources):
- PyoObject.__init__(self)
- self._input = input
- self._matrix = matrix
- self._sources = sources
- self._in_fader = InputFader(input)
- in_fader, matrix, lmax = convertArgsToLists(self._in_fader, matrix)
- self._base_sources = [source[0] for source in sources]
- self._base_objs = [MatrixMorph_base(wrap(in_fader,i), wrap(matrix,i), self._base_sources) for i in range(len(matrix))]
-
- def __dir__(self):
- return ['input', 'matrix', 'sources', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMatrix(self, x):
- """
- Replace the `matrix` attribute.
-
- Parameters:
-
- x : NewMatrix
- new `matrix` attribute.
-
- """
- self._matrix = x
- x, lmax = convertArgsToLists(x)
- [obj.setMatrix(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSources(self, x):
- """
- Replace the `sources` attribute.
-
- Parameters:
-
- x : list of PyoMatrixObject
- new `sources` attribute.
-
- """
- self._sources = x
- self._base_sources = [source[0] for source in x]
- [obj.setSources(self._base_sources) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Morphing index between 0 and 1."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def matrix(self):
- """NewMatrix. The matrix where to write samples."""
- return self._matrix
- @matrix.setter
- def matrix(self, x): self.setMatrix(x)
-
- @property
- def sources(self):
- """list of PyoMatrixObject. List of matrices to interpolate from."""
- return self._sources
- @sources.setter
- def sources(self, x): self.setSources(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/midi.py b/build/lib.linux-x86_64-2.7/pyolib/midi.py
deleted file mode 100644
index b302dc2..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/midi.py
+++ /dev/null
@@ -1,1354 +0,0 @@
-"""
-Objects to retrieve Midi informations for a specific Midi port and channel.
-
-Objects creates and returns audio streams from the value in their Midi input.
-
-The audio streams of these objects are essentially intended to be
-used as controls and can't be sent to the output soundcard.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-import sys
-from _core import *
-from _maps import *
-
-######################################################################
-### MIDI
-######################################################################
-class Midictl(PyoObject):
- """
- Get the current value of a Midi controller.
-
- Get the current value of a controller and optionally map it
- inside a specified range.
-
- Parentclass: PyoObject
-
- Parameters:
-
- ctlnumber : int
- Controller number.
- minscale : float, optional
- Low range value for mapping. Defaults to 0.
- maxscale : float, optional
- High range value for mapping. Defaults to 1.
- init : float, optional
- Initial value. Defaults to 0.
- channel : int, optional
- Midi channel. 0 means all channels. Defaults to 0.
-
- Methods:
-
- setCtlNumber(x) : Replace the `ctlnumber` attribute.
- setMinScale(x) : Replace the `minscale` attribute.
- setMaxScale(x) : Replace the `maxscale` attribute.
- setChannel(x) : Replace the `channel` attribute.
- setValue(x) : Reset audio stream to value in argument.
- setInterpolation(x) : Activate/Deactivate interpolation. Activated by default.
-
- Attributes:
-
- ctlnumber : Controller number.
- minscale : Minimum value for scaling.
- maxscale : Maximum value for scaling.
- channel : Midi channel. 0 means all channels.
-
- Notes:
-
- The out() method is bypassed. Midictl's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> m = Midictl(ctlnumber=[107,102], minscale=250, maxscale=1000)
- >>> p = Port(m, .02)
- >>> a = Sine(freq=p, mul=.3).out()
- >>> a1 = Sine(freq=p*1.25, mul=.3).out()
- >>> a2 = Sine(freq=p*1.5, mul=.3).out()
-
- """
- def __init__(self, ctlnumber, minscale=0, maxscale=1, init=0, channel=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._ctlnumber = ctlnumber
- self._minscale = minscale
- self._maxscale = maxscale
- self._channel = channel
- self._mul = mul
- self._add = add
- ctlnumber, minscale, maxscale, init, channel, mul, add, lmax = convertArgsToLists(ctlnumber, minscale, maxscale, init, channel, mul, add)
- self._base_objs = [Midictl_base(wrap(ctlnumber,i), wrap(minscale,i), wrap(maxscale,i), wrap(init,i), wrap(channel,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['ctlnumber', 'minscale', 'maxscale', 'channel', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setCtlNumber(self, x):
- """
- Replace the `ctlnumber` attribute.
-
- Parameters:
-
- x : int
- new `ctlnumber` attribute.
-
- """
- self._ctlnumber = x
- x, lmax = convertArgsToLists(x)
- [obj.setCtlNumber(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMinScale(self, x):
- """
- Replace the `minscale` attribute.
-
- Parameters:
-
- x : int
- new `minscale` attribute.
-
- """
- self._minscale = x
- x, lmax = convertArgsToLists(x)
- [obj.setMinScale(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMaxScale(self, x):
- """
- Replace the `maxscale` attribute.
-
- Parameters:
-
- x : int
- new `maxscale` attribute.
-
- """
- self._maxscale = x
- x, lmax = convertArgsToLists(x)
- [obj.setMaxScale(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setChannel(self, x):
- """
- Replace the `channel` attribute.
-
- Parameters:
-
- x : int
- new `channel` attribute.
-
- """
- self._channel = x
- x, lmax = convertArgsToLists(x)
- [obj.setChannel(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setValue(self, x):
- """
- Reset audio stream to value in argument.
-
- Parameters:
-
- x : float
- new current value.
-
- """
- x, lmax = convertArgsToLists(x)
- [obj.setValue(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInterpolation(self, x):
- """
- Activate/Deactivate interpolation. Activated by default.
-
- Parameters:
-
- x : boolean
- True activates the interpolation, False deactivates it.
-
- """
- x, lmax = convertArgsToLists(x)
- [obj.setInterpolation(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def ctlnumber(self): return self._ctlnumber
- @ctlnumber.setter
- def ctlnumber(self, x): self.setCtlNumber(x)
-
- @property
- def minscale(self): return self._minscale
- @minscale.setter
- def minscale(self, x): self.setMinScale(x)
-
- @property
- def maxscale(self): return self._maxscale
- @maxscale.setter
- def maxscale(self, x): self.setMaxScale(x)
-
- @property
- def channel(self): return self._channel
- @channel.setter
- def channel(self, x): self.setChannel(x)
-
-class CtlScan(PyoObject):
- """
- Scan the Midi controller's number in input.
-
- Scan the Midi controller's number in input and send it to
- a standard python `function`. Useful to implement a MidiLearn
- algorithm.
-
- Parentclass: PyoObject
-
- Parameters:
-
- function : Python function
- Function to be called. The function must be declared
- with an argument for the controller number in input. Ex.:
- def ctl_scan(ctlnum):
- print ctlnum
- toprint : boolean, optional
- If True, controller number and value will be print to
- the console.
-
- Methods:
-
- setFunction(x) : Replace the `function` attribute.
- setToprint(x) : Replace the `toprint` attribute.
-
- Attributes:
-
- function : Python function. Function to be called.
- toprint : boolean. If True, print values to the console.
-
- Notes:
-
- The out() method is bypassed. CtlScan's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server()
- >>> s.setMidiInputDevice(0) # enter your device number (see pm_list_devices())
- >>> s.boot()
- >>> s.start()
- >>> def ctl_scan(ctlnum):
- ... print ctlnum
- >>> a = CtlScan(ctl_scan)
-
- """
- def __init__(self, function, toprint=True):
- PyoObject.__init__(self)
- if not callable(function):
- print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
- exit()
- self._function = function
- self._toprint = toprint
- self._base_objs = [CtlScan_base(self._function, self._toprint)]
-
- def __dir__(self):
- return []
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setSub(self, x):
- pass
-
- def setDiv(self, x):
- pass
-
- def setFunction(self, x):
- """
- Replace the `function` attribute.
-
- Parameters:
-
- x : Python function
- new `function` attribute.
-
- """
- self._function = x
- x, lmax = convertArgsToLists(x)
- [obj.setFunction(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setToprint(self, x):
- """
- Replace the `toprint` attribute.
-
- Parameters:
-
- x : int
- new `toprint` attribute.
-
- """
- self._toprint = x
- x, lmax = convertArgsToLists(x)
- [obj.setToprint(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def function(self): return self._function
- @function.setter
- def function(self, x): self.setFunction(x)
- @property
- def toprint(self): return self._toprint
- @toprint.setter
- def toprint(self, x): self.setToprint(x)
-
-class CtlScan2(PyoObject):
- """
- Scan the Midi channel and controller number in input.
-
- Scan the Midi channel and controller number in input and send them
- to a standard python `function`. Useful to implement a MidiLearn
- algorithm.
-
- Parentclass: PyoObject
-
- Parameters:
-
- function : Python function
- Function to be called. The function must be declared
- with two arguments, one for the controller number and
- one for the midi channel. Ex.:
- def ctl_scan(ctlnum, midichnl):
- print ctlnum, midichnl
- toprint : boolean, optional
- If True, controller number and value will be print to
- the console.
-
- Methods:
-
- setFunction(x) : Replace the `function` attribute.
- setToprint(x) : Replace the `toprint` attribute.
-
- Attributes:
-
- function : Python function. Function to be called.
- toprint : boolean. If True, print values to the console.
-
- Notes:
-
- The out() method is bypassed. CtlScan2's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server()
- >>> s.setMidiInputDevice(0) # enter your device number (see pm_list_devices())
- >>> s.boot()
- >>> s.start()
- >>> def ctl_scan(ctlnum, midichnl):
- ... print ctlnum, midichnl
- >>> a = CtlScan2(ctl_scan)
-
- """
- def __init__(self, function, toprint=True):
- PyoObject.__init__(self)
- if not callable(function):
- print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
- exit()
- self._function = function
- self._toprint = toprint
- self._base_objs = [CtlScan2_base(self._function, self._toprint)]
-
- def __dir__(self):
- return []
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setSub(self, x):
- pass
-
- def setDiv(self, x):
- pass
-
- def setFunction(self, x):
- """
- Replace the `function` attribute.
-
- Parameters:
-
- x : Python function
- new `function` attribute.
-
- """
- self._function = x
- x, lmax = convertArgsToLists(x)
- [obj.setFunction(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setToprint(self, x):
- """
- Replace the `toprint` attribute.
-
- Parameters:
-
- x : int
- new `toprint` attribute.
-
- """
- self._toprint = x
- x, lmax = convertArgsToLists(x)
- [obj.setToprint(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def function(self): return self._function
- @function.setter
- def function(self, x): self.setFunction(x)
- @property
- def toprint(self): return self._toprint
- @toprint.setter
- def toprint(self, x): self.setToprint(x)
-
-class Notein(PyoObject):
- """
- Generates Midi note messages.
-
- From a Midi device, takes the notes in the range defined with
- `first` and `last` parameters, and outputs up to `poly`
- noteon - noteoff streams in the `scale` format (Midi, hertz
- or transpo).
-
- Parentclass: PyoObject
-
- Parameters:
-
- poly : int, optional
- Number of streams of polyphony generated. Defaults to 10.
- scale : int, optional
- Pitch output format. 0 = Midi, 1 = Hertz, 2 = transpo.
- In the transpo mode, the default central key (the key where
- there is no transposition) is (`first` + `last`) / 2. The
- central key can be changed with the setCentralKey method.
- first : int, optional
- Lowest Midi value. Defaults to 0.
- last : int, optional
- Highest Midi value. Defaults to 127.
- channel : int, optional
- Midi channel. 0 means all channels. Defaults to 0.
-
- Methods:
-
- setChannel(x) : Replace the `channel` attribute.
- setCentralKey(x) : Set the midi key where there is no transposition.
- get(identifier, all) : Return the first sample of the current
- buffer as a float.
-
- Attributes:
-
- channel : Midi channel. 0 means all channels.
-
- Notes:
-
- Pitch and velocity are two separated set of streams.
- The user should call :
-
- Notein['pitch'] to retrieve pitch streams.
- Notein['velocity'] to retrieve velocity streams.
-
- Velocity is automatically scaled between 0 and 1.
-
- The out() method is bypassed. Notein's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> notes = Notein(poly=10, scale=1, mul=.5)
- >>> p = Port(notes['velocity'], .001, .5)
- >>> b = Sine(freq=notes['pitch'], mul=p).out()
- >>> c = Sine(freq=notes['pitch'] * 0.997, mul=p).out()
- >>> d = Sine(freq=notes['pitch'] * 1.005, mul=p).out()
-
- """
- def __init__(self, poly=10, scale=0, first=0, last=127, channel=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._pitch_dummy = []
- self._velocity_dummy = []
- self._poly = poly
- self._scale = scale
- self._first = first
- self._last = last
- self._channel = channel
- self._mul = mul
- self._add = add
- mul, add, lmax = convertArgsToLists(mul, add)
- self._base_handler = MidiNote_base(self._poly, self._scale, self._first, self._last, self._channel)
- self._base_objs = []
- for i in range(lmax * poly):
- self._base_objs.append(Notein_base(self._base_handler, i, 0, 1, 0))
- self._base_objs.append(Notein_base(self._base_handler, i, 1, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['channel', 'mul', 'add']
-
- def __getitem__(self, str):
- if str == 'pitch':
- self._pitch_dummy.append(Dummy([self._base_objs[i*2] for i in range(self._poly)]))
- return self._pitch_dummy[-1]
- if str == 'velocity':
- self._velocity_dummy.append(Dummy([self._base_objs[i*2+1] for i in range(self._poly)]))
- return self._velocity_dummy[-1]
-
- def setChannel(self, x):
- """
- Replace the `channel` attribute.
-
- Parameters:
-
- x : int
- new `channel` attribute.
-
- """
- self._channel = x
- self._base_handler.setChannel(x)
-
- def setCentralKey(self, x):
- """
- Set the midi key where there is no transposition.
-
- Used for transpo conversion. This value must be greater than or
- equal to `first` and lower than or equal to `last`.
-
- Parameters:
-
- x : int
- new centralkey value.
-
- """
- self._base_handler.setCentralKey(x)
-
- def get(self, identifier="pitch", all=False):
- """
- Return the first sample of the current buffer as a float.
-
- Can be used to convert audio stream to usable Python data.
-
- "pitch" or "velocity" must be given to `identifier` to specify
- which stream to get value from.
-
- Parameters:
-
- identifier : string {"pitch", "velocity"}
- Address string parameter identifying audio stream.
- Defaults to "pitch".
- all : boolean, optional
- If True, the first value of each object's stream
- will be returned as a list. Otherwise, only the value
- of the first object's stream will be returned as a float.
- Defaults to False.
-
- """
- if not all:
- return self.__getitem__(identifier)[0]._getStream().getValue()
- else:
- return [obj._getStream().getValue() for obj in self.__getitem__(identifier).getBaseObjects()]
-
- def play(self, dur=0, delay=0):
- self._base_handler.play()
- return PyoObject.play(self, dur, delay)
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def stop(self):
- self._base_handler.stop()
- return PyoObject.stop(self)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def channel(self): return self._channel
- @channel.setter
- def channel(self, x): self.setChannel(x)
-
-class Bendin(PyoObject):
- """
- Get the current value of the pitch bend controller.
-
- Get the current value of the pitch bend controller and optionally
- maps it inside a specified range.
-
- Parentclass: PyoObject
-
- Parameters:
-
- brange : float, optional
- Bipolar range of the pitch bend in semitones. Defaults to 2.
- -brange <= value < brange.
- scale : int, optional
- Output format. 0 = Midi, 1 = transpo.
- The transpo mode is useful if you want to transpose values that
- are in a frequency (Hz) format. Defaults to 0.
- channel : int, optional
- Midi channel. 0 means all channels. Defaults to 0.
-
- Methods:
-
- setBrange(x) : Replace the `brange` attribute.
- setScale(x) : Replace the `scale` attribute.
- setChannel(x) : Replace the `channel` attribute.
-
- Attributes:
-
- brange : Bipolar range of the pitch bend in semitones.
- scale : Output format. 0 = Midi, 1 = transpo.
- channel : Midi channel. 0 means all channels.
-
- Notes:
-
- The out() method is bypassed. Bendin's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> notes = Notein(poly=10, scale=1, mul=.5)
- >>> bend = Bendin(brange=2, scale=1)
- >>> p = Port(notes['velocity'], .001, .5)
- >>> b = Sine(freq=notes['pitch'] * bend, mul=p).out()
- >>> c = Sine(freq=notes['pitch'] * bend * 0.997, mul=p).out()
- >>> d = Sine(freq=notes['pitch'] * bend * 1.005, mul=p).out()
-
- """
- def __init__(self, brange=2, scale=0, channel=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._brange = brange
- self._scale = scale
- self._channel = channel
- self._mul = mul
- self._add = add
- brange, scale, channel, mul, add, lmax = convertArgsToLists(brange, scale, channel, mul, add)
- self._base_objs = [Bendin_base(wrap(brange,i), wrap(scale,i), wrap(channel,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['brange', 'scale', 'channel', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setBrange(self, x):
- """
- Replace the `brange` attribute.
-
- Parameters:
-
- x : int
- new `brange` attribute.
-
- """
- self._brange = x
- x, lmax = convertArgsToLists(x)
- [obj.setBrange(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setScale(self, x):
- """
- Replace the `scale` attribute.
-
- Parameters:
-
- x : int
- new `scale` attribute.
-
- """
- self._scale = x
- x, lmax = convertArgsToLists(x)
- [obj.setScale(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setChannel(self, x):
- """
- Replace the `channel` attribute.
-
- Parameters:
-
- x : int
- new `channel` attribute.
-
- """
- self._channel = x
- x, lmax = convertArgsToLists(x)
- [obj.setChannel(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def brange(self):
- """float. Bipolar range of the pitch bend in semitones."""
- return self._brange
- @brange.setter
- def brange(self, x): self.setBrange(x)
-
- @property
- def scale(self):
- """int. Output format. 0 = Midi, 1 = transpo."""
- return self._scale
- @scale.setter
- def scale(self, x): self.setScale(x)
-
- @property
- def channel(self):
- """int. Midi channel. 0 means all channels."""
- return self._channel
- @channel.setter
- def channel(self, x): self.setChannel(x)
-
-class Touchin(PyoObject):
- """
- Get the current value of an after-touch Midi controller.
-
- Get the current value of an after-touch Midi controller and optionally
- maps it inside a specified range.
-
- Parentclass: PyoObject
-
- Parameters:
-
- minscale : float, optional
- Low range value for mapping. Defaults to 0.
- maxscale : float, optional
- High range value for mapping. Defaults to 1.
- init : float, optional
- Initial value. Defaults to 0.
- channel : int, optional
- Midi channel. 0 means all channels. Defaults to 0.
-
- Methods:
-
- setMinScale(x) : Replace the `minscale` attribute.
- setMaxScale(x) : Replace the `maxscale` attribute.
- setChannel(x) : Replace the `channel` attribute.
-
- Attributes:
-
- minscale : Minimum value for scaling.
- maxscale : Maximum value for scaling.
- channel : Midi channel. 0 means all channels.
-
- Notes:
-
- The out() method is bypassed. Touchin's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> notes = Notein(poly=10, scale=1, mul=.5)
- >>> touch = Touchin(minscale=1, maxscale=2, init=1)
- >>> p = Port(notes['velocity'], .001, .5)
- >>> b = Sine(freq=notes['pitch'] * touch, mul=p).out()
- >>> c = Sine(freq=notes['pitch'] * touch * 0.997, mul=p).out()
- >>> d = Sine(freq=notes['pitch'] * touch * 1.005, mul=p).out()
-
- """
- def __init__(self, minscale=0, maxscale=1, init=0, channel=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._minscale = minscale
- self._maxscale = maxscale
- self._channel = channel
- self._mul = mul
- self._add = add
- minscale, maxscale, init, channel, mul, add, lmax = convertArgsToLists(minscale, maxscale, init, channel, mul, add)
- self._base_objs = [Touchin_base(wrap(minscale,i), wrap(maxscale,i), wrap(init,i), wrap(channel,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['minscale', 'maxscale', 'channel', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMinScale(self, x):
- """
- Replace the `minscale` attribute.
-
- Parameters:
-
- x : int
- new `minscale` attribute.
-
- """
- self._minscale = x
- x, lmax = convertArgsToLists(x)
- [obj.setMinScale(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMaxScale(self, x):
- """
- Replace the `maxscale` attribute.
-
- Parameters:
-
- x : int
- new `maxscale` attribute.
-
- """
- self._maxscale = x
- x, lmax = convertArgsToLists(x)
- [obj.setMaxScale(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setChannel(self, x):
- """
- Replace the `channel` attribute.
-
- Parameters:
-
- x : int
- new `channel` attribute.
-
- """
- self._channel = x
- x, lmax = convertArgsToLists(x)
- [obj.setChannel(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def minscale(self): return self._minscale
- @minscale.setter
- def minscale(self, x): self.setMinScale(x)
-
- @property
- def maxscale(self): return self._maxscale
- @maxscale.setter
- def maxscale(self, x): self.setMaxScale(x)
-
- @property
- def channel(self): return self._channel
- @channel.setter
- def channel(self, x): self.setChannel(x)
-
-class Programin(PyoObject):
- """
- Get the current value of a program change Midi controller.
-
- Get the current value of a program change Midi controller.
-
- Parentclass: PyoObject
-
- Parameters:
-
- channel : int, optional
- Midi channel. 0 means all channels. Defaults to 0.
-
- Methods:
-
- setChannel(x) : Replace the `channel` attribute.
-
- Attributes:
-
- channel : Midi channel. 0 means all channels.
-
- Notes:
-
- The out() method is bypassed. Programin's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> notes = Notein(poly=10, scale=1, mul=.5)
- >>> pchg = Programin(mul=1./12, add=1)
- >>> p = Port(notes['velocity'], .001, .5)
- >>> b = Sine(freq=notes['pitch'] * pchg, mul=p).out()
- >>> c = Sine(freq=notes['pitch'] * pchg * 0.997, mul=p).out()
- >>> d = Sine(freq=notes['pitch'] * pchg * 1.005, mul=p).out()
-
- """
- def __init__(self, channel=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._channel = channel
- self._mul = mul
- self._add = add
- channel, mul, add, lmax = convertArgsToLists(channel, mul, add)
- self._base_objs = [Programin_base(wrap(channel,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['channel', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setChannel(self, x):
- """
- Replace the `channel` attribute.
-
- Parameters:
-
- x : int
- new `channel` attribute.
-
- """
- self._channel = x
- x, lmax = convertArgsToLists(x)
- [obj.setChannel(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def channel(self): return self._channel
- @channel.setter
- def channel(self, x): self.setChannel(x)
-
-class MidiAdsr(PyoObject):
- """
- Midi triggered ADSR envelope generator.
-
- Calculates the classical ADSR envelope using linear segments.
- The envelope starts when it receives a positive value in input,
- this value is used as the peak amplitude of the envelope. The
- `sustain` parameter is a fraction of the peak value and sets
- the real sustain value. A 0 in input (note off) starts the
- release part of the envelope.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal used to trigger the envelope. A positive value
- sets the peak amplitude and starts the envelope. A 0 starts
- the release part of the envelope.
- attack : float, optional
- Duration of the attack phase in seconds. Defaults to 0.01.
- decay : float, optional
- Duration of the decay phase in seconds. Defaults to 0.05.
- sustain : float, optional
- Amplitude of the sustain phase, as a fraction of the peak
- amplitude at the start of the envelope. Defaults to 0.7.
- release : float, optional
- Duration of the release phase in seconds. Defaults to 0.1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setAttack(x) : Replace the `attack` attribute.
- setDecay(x) : Replace the `decay` attribute.
- setSustain(x) : Replace the `sustain` attribute.
- setRelease(x) : Replace the `release` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal used to trigger the envelope.
- 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.
-
- Notes:
-
- The out() method is bypassed. MidiAdsr's signal can not be sent to audio outs.
-
- Shape of a classical Adsr:
-
- -
- - -
- - -
- - ------------------------
- - -
- - -
- - -
- att - dec - sustain - rel
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> mid = Notein(scale=1)
- >>> env = MidiAdsr(mid['velocity'], attack=.005, decay=.1, sustain=.4, release=1)
- >>> a = SineLoop(freq=mid['pitch'], feedback=.1, mul=env).out()
- >>> b = SineLoop(freq=mid['pitch']*1.005, feedback=.1, mul=env).out(1)
-
- """
- def __init__(self, input, attack=0.01, decay=0.05, sustain=0.7, release=0.1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._attack = attack
- self._decay = decay
- self._sustain = sustain
- self._release = release
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, attack, decay, sustain, release, mul, add, lmax = convertArgsToLists(self._in_fader, attack, decay, sustain, release, mul, add)
- self._base_objs = [MidiAdsr_base(wrap(in_fader,i), wrap(attack,i), wrap(decay,i), wrap(sustain,i), wrap(release,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'attack', 'decay', 'sustain', 'release', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, x, fadetime=0.05):
- """
- Replace the `input` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal used to trigger the envelope.
- fadetime : float, optional
- Crossfade time between old and new input. Defaults to 0.05.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setAttack(self, x):
- """
- Replace the `attack` attribute.
-
- Parameters:
-
- x : float
- new `attack` attribute.
-
- """
- self._attack = x
- x, lmax = convertArgsToLists(x)
- [obj.setAttack(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDecay(self, x):
- """
- Replace the `decay` attribute.
-
- Parameters:
-
- x : float
- new `decay` attribute.
-
- """
- self._decay = x
- x, lmax = convertArgsToLists(x)
- [obj.setDecay(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSustain(self, x):
- """
- Replace the `sustain` attribute.
-
- Parameters:
-
- x : float
- new `sustain` attribute.
-
- """
- self._sustain = x
- x, lmax = convertArgsToLists(x)
- [obj.setSustain(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRelease(self, x):
- """
- Replace the `sustain` attribute.
-
- Parameters:
-
- x : float
- new `sustain` attribute.
-
- """
- self._release = x
- x, lmax = convertArgsToLists(x)
- [obj.setRelease(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def attack(self):
- """float. Duration of the attack phase in seconds."""
- return self._attack
- @attack.setter
- def attack(self, x): self.setAttack(x)
-
- @property
- def decay(self):
- """float. Duration of the decay phase in seconds."""
- return self._decay
- @decay.setter
- def decay(self, x): self.setDecay(x)
-
- @property
- def sustain(self):
- """float. Amplitude of the sustain phase, as fraction of the peak amplitude."""
- return self._sustain
- @sustain.setter
- def sustain(self, x): self.setSustain(x)
-
- @property
- def release(self):
- """float. Duration of the release phase in seconds."""
- return self._release
- @release.setter
- def release(self, x): self.setRelease(x)
-
-class MidiDelAdsr(PyoObject):
- """
- Midi triggered ADSR envelope generator with pre-delay.
-
- Calculates the classical ADSR envelope using linear segments.
- The envelope starts after `delay` seconds when it receives a
- positive value in input, this value is used as the peak amplitude
- of the envelope. The `sustain` parameter is a fraction of the
- peak value and sets the real sustain value. A 0 in input (note off)
- starts the release part of the envelope.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal used to trigger the envelope. A positive value
- sets the peak amplitude and starts the envelope. A 0 starts
- the release part of the envelope.
- delay : float, optional
- Duration of the delay phase, before calling the envelope
- in seconds. Defaults to 0.
- attack : float, optional
- Duration of the attack phase in seconds. Defaults to 0.01.
- decay : float, optional
- Duration of the decay phase in seconds. Defaults to 0.05.
- sustain : float, optional
- Amplitude of the sustain phase, as a fraction of the peak
- amplitude at the start of the envelope. Defaults to 0.7.
- release : float, optional
- Duration of the release phase in seconds. Defaults to 0.1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setDelay(x) : Replace the `delay` attribute.
- setAttack(x) : Replace the `attack` attribute.
- setDecay(x) : Replace the `decay` attribute.
- setSustain(x) : Replace the `sustain` attribute.
- setRelease(x) : Replace the `release` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal used to trigger the envelope.
- delay : float. Duration of the delay phase in seconds.
- 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.
-
- Notes:
-
- The out() method is bypassed. MidiDelAdsr's signal can not be sent
- to audio outs.
-
- Shape of a DelAdsr envelope:
-
- -
- - -
- - -
- - ------------------------
- - -
- - -
- ------- -
- delay - att - dec - sustain - rel
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> mid = Notein(scale=1)
- >>> env = MidiDelAdsr(mid['velocity'], delay=.25, attack=.005, decay=.1, sustain=.4, release=1)
- >>> a = SineLoop(freq=mid['pitch'], feedback=.1, mul=env).out()
- >>> b = SineLoop(freq=mid['pitch']*1.005, feedback=.1, mul=env).out(1)
-
- """
- def __init__(self, input, delay=0, attack=0.01, decay=0.05, sustain=0.7, release=0.1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._delay = delay
- self._attack = attack
- self._decay = decay
- self._sustain = sustain
- self._release = release
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, delay, attack, decay, sustain, release, mul, add, lmax = convertArgsToLists(self._in_fader, delay, attack, decay, sustain, release, mul, add)
- self._base_objs = [MidiDelAdsr_base(wrap(in_fader,i), wrap(delay,i), wrap(attack,i), wrap(decay,i), wrap(sustain,i), wrap(release,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'delay', 'attack', 'decay', 'sustain', 'release', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, x, fadetime=0.05):
- """
- Replace the `input` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal used to trigger the envelope.
- fadetime : float, optional
- Crossfade time between old and new input. Defaults to 0.05.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setDelay(self, x):
- """
- Replace the `delay` attribute.
-
- Parameters:
-
- x : float
- new `delay` attribute.
-
- """
- self._delay = x
- x, lmax = convertArgsToLists(x)
- [obj.setDelay(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setAttack(self, x):
- """
- Replace the `attack` attribute.
-
- Parameters:
-
- x : float
- new `attack` attribute.
-
- """
- self._attack = x
- x, lmax = convertArgsToLists(x)
- [obj.setAttack(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDecay(self, x):
- """
- Replace the `decay` attribute.
-
- Parameters:
-
- x : float
- new `decay` attribute.
-
- """
- self._decay = x
- x, lmax = convertArgsToLists(x)
- [obj.setDecay(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSustain(self, x):
- """
- Replace the `sustain` attribute.
-
- Parameters:
-
- x : float
- new `sustain` attribute.
-
- """
- self._sustain = x
- x, lmax = convertArgsToLists(x)
- [obj.setSustain(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRelease(self, x):
- """
- Replace the `sustain` attribute.
-
- Parameters:
-
- x : float
- new `sustain` attribute.
-
- """
- self._release = x
- x, lmax = convertArgsToLists(x)
- [obj.setRelease(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def delay(self):
- """float. Duration of the delay phase in seconds."""
- return self._delay
- @delay.setter
- def delay(self, x): self.setDelay(x)
-
- @property
- def attack(self):
- """float. Duration of the attack phase in seconds."""
- return self._attack
- @attack.setter
- def attack(self, x): self.setAttack(x)
-
- @property
- def decay(self):
- """float. Duration of the decay phase in seconds."""
- return self._decay
- @decay.setter
- def decay(self, x): self.setDecay(x)
-
- @property
- def sustain(self):
- """float. Amplitude of the sustain phase, as fraction of the peak amplitude."""
- return self._sustain
- @sustain.setter
- def sustain(self, x): self.setSustain(x)
-
- @property
- def release(self):
- """float. Duration of the release phase in seconds."""
- return self._release
- @release.setter
- def release(self, x): self.setRelease(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/opensndctrl.py b/build/lib.linux-x86_64-2.7/pyolib/opensndctrl.py
deleted file mode 100644
index f367619..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/opensndctrl.py
+++ /dev/null
@@ -1,821 +0,0 @@
-"""
-Objects to manage values on an Open Sound Control port.
-
-OscSend takes the first value of each buffersize and send it on an
-OSC port.
-
-OscReceive creates and returns audio streams from the value in its
-input port.
-
-The audio streams of these objects are essentially intended to be
-controls and can't be sent to the output soundcard.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-import sys
-from _core import *
-from _maps import *
-from types import IntType, ListType
-
-######################################################################
-### Open Sound Control
-######################################################################
-class OscSend(PyoObject):
- """
- Sends values over a network via the Open Sound Control protocol.
-
- Uses the OSC protocol to share values to other softwares or other
- computers. Only the first value of each input buffersize will be
- sent on the OSC port.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal.
- port : int
- Port on which values are sent. Receiver should listen on the
- same port.
- address : string
- Address used on the port to identify values. Address is in
- the form of a Unix path (ex.: '/pitch').
- host : string, optional
- IP address of the target computer. The default, '127.0.0.1',
- is the localhost.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setBufferRate(x) : Sets how many buffers to wait before sending
- a new value.
-
- Notes:
-
- The out() method is bypassed. OscSend's signal can not be sent
- to audio outs.
-
- OscSend has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Sine(freq=[1,1.5], mul=[100,.1], add=[600, .1])
- >>> b = OscSend(a, port=10001, address=['/pitch','/amp'])
-
- """
- def __init__(self, input, port, address, host="127.0.0.1"):
- PyoObject.__init__(self)
- self._input = input
- self._in_fader = InputFader(input)
- in_fader, port, address, host, lmax = convertArgsToLists(self._in_fader, port, address, host)
- self._base_objs = [OscSend_base(wrap(in_fader,i), wrap(port,i), wrap(address,i), wrap(host,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setBufferRate(self, x):
- """
- Sets how many buffers to wait before sending a new value.
-
- Parameters:
-
- x : int
- Changes the data output frequency in multiples of the buffer size.
- Should be greater or equal to 1.
-
- """
- [obj.setBufferRate(x) for obj in self._base_objs]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class OscReceive(PyoObject):
- """
- Receives values over a network via the Open Sound Control protocol.
-
- Uses the OSC protocol to receive values from other softwares or
- other computers. Get a value at the beginning of each buffersize
- and fill its buffer with it.
-
- Parentclass: PyoObject
-
- Parameters:
-
- port : int
- Port on which values are received. Sender should output on
- the same port. Unlike OscSend object, there can be only one
- port per OscReceive object. Available at initialization time
- only.
- address : string
- Address used on the port to identify values. Address is in
- the form of a Unix path (ex.: '/pitch').
-
- Methods:
-
- get(identifier, all) : Return the first sample of the current
- buffer as a float.
- getAddresses() : Returns the addresses managed by the object.
- addAddress(path, mul, add) : Adds new address(es) to the object's handler.
- delAddress(path) : Removes address(es) from the object's handler.
- setInterpolation(x) : Activate/Deactivate interpolation. Activated by default.
- setValue(path, value) : Sets value for the specified address.
-
- Notes:
-
- Audio streams are accessed with the `address` string parameter.
- The user should call :
-
- OscReceive['/pitch'] to retreive stream named '/pitch'.
-
- The out() method is bypassed. OscReceive's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = OscReceive(port=10001, address=['/pitch', '/amp'])
- >>> b = Sine(freq=a['/pitch'], mul=a['/amp']).mix(2).out()
-
- """
-
- def __init__(self, port, address, mul=1, add=0):
- PyoObject.__init__(self)
- if type(port) != IntType:
- print >> sys.stderr, 'TypeError: "port" argument of %s must be an integer.\n' % self.__class__.__name__
- exit()
- self._mul = mul
- self._add = add
- address, mul, add, lmax = convertArgsToLists(address, mul, add)
- self._address = address
- self._mainReceiver = OscReceiver_base(port, address)
- self._base_objs = [OscReceive_base(self._mainReceiver, wrap(address,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['mul', 'add']
-
- def __getitem__(self, i):
- if type(i) == type(''):
- return self._base_objs[self._address.index(i)]
- elif i < len(self._base_objs):
- return self._base_objs[i]
- else:
- print "'i' too large!"
-
- def getAddresses(self):
- """
- Returns the addresses managed by the object.
-
- """
- return self._address
-
- def addAddress(self, path, mul=1, add=0):
- """
- Adds new address(es) to the object's handler.
-
- Parameters:
-
- path : string or list of strings
- New path(s) to receive from.
- mul : float or PyoObject
- Multiplication factor. Defaults to 1.
- add : float or PyoObject
- Addition factor. Defaults to 0.
-
- """
- path, lmax = convertArgsToLists(path)
- mul, add, lmax2 = convertArgsToLists(mul, add)
- for i, p in enumerate(path):
- if p not in self._address:
- self._mainReceiver.addAddress(p)
- self._address.append(p)
- self._base_objs.append(OscReceive_base(self._mainReceiver, p, wrap(mul,i), wrap(add,i)))
-
- def delAddress(self, path):
- """
- Removes address(es) from the object's handler.
-
- Parameters:
-
- path : string or list of strings
- Path(s) to remove.
-
- """
- path, lmax = convertArgsToLists(path)
- self._mainReceiver.delAddress(path)
- indexes = [self._address.index(p) for p in path]
- for ind in reversed(indexes):
- self._address.pop(ind)
- obj = self._base_objs.pop(ind)
-
- def setInterpolation(self, x):
- """
- Activate/Deactivate interpolation. Activated by default.
-
- Parameters:
-
- x : boolean
- True activates the interpolation, False deactivates it.
-
- """
- [obj.setInterpolation(x) for obj in self._base_objs]
-
- def setValue(self, path, value):
- """
- Sets value for a given address.
-
- Parameters:
-
- path : string
- Address to which the value should be attributed.
- value : float
- Value to attribute to the given address.
-
- """
- path, value, lmax = convertArgsToLists(path, value)
- for i in range(lmax):
- p = wrap(path,i)
- if p in self._address:
- self._mainReceiver.setValue(p, wrap(value,i))
- else:
- print 'Error: OscReceive.setValue, Illegal address "%s"' % p
-
- def get(self, identifier=None, all=False):
- """
- Return the first sample of the current buffer as a float.
-
- Can be used to convert audio stream to usable Python data.
-
- Address as string must be given to `identifier` to specify
- which stream to get value from.
-
- Parameters:
-
- identifier : string
- Address string parameter identifying audio stream.
- Defaults to None, useful when `all` is True to
- retreive all streams values.
- all : boolean, optional
- If True, the first value of each object's stream
- will be returned as a list. Otherwise, only the value
- of the first object's stream will be returned as a float.
- Defaults to False.
-
- """
- if not all:
- return self._base_objs[self._address.index(identifier)]._getStream().getValue()
- else:
- return [obj._getStream().getValue() for obj in self._base_objs]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class OscDataSend(PyoObject):
- """
- Sends data values over a network via the Open Sound Control protocol.
-
- Uses the OSC protocol to share values to other softwares or other
- computers. Values are sent on the form of a list containing `types`
- elements.
-
- Parentclass: PyoObject
-
- Parameters:
-
- types : str
- String specifying the types sequence of the message to be sent.
- Possible values are :
- integer : "i"
- long integer : "h"
- float : "f"
- double : "d"
- string : "s"
- The string "ssfi" indicates that the value to send will be a list
- containing two strings followed by a float and an integer.
- port : int
- Port on which values are sent. Receiver should listen on the
- same port.
- address : string
- Address used on the port to identify values. Address is in
- the form of a Unix path (ex.: '/pitch').
- host : string, optional
- IP address of the target computer. The default, '127.0.0.1',
- is the localhost.
-
- Methods:
-
- getAddresses() : Returns the addresses managed by the object.
- addAddress(types, port, address, host) : Adds new address(es) to the
- object's handler.
- delAddress(path) : Removes address(es) from the object's handler.
- send(msg, address=None) : Method used to send `msg` values (a list)
- at the `address` destination if specified. Otherwise, values will
- be sent to all destinations managed by the object. All destinations
- must have the same types.
-
- Notes:
-
- The out() method is bypassed. OscDataSend has no audio signal.
-
- OscDataSend has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = OscDataSend("fissif", 9900, "/data/test")
- >>> def pp(address, *args):
- ... print address
- ... print args
- >>> b = OscDataReceive(9900, "/data/test", pp)
- >>> msg = [3.14159, 1, "Hello", "world!", 2, 6.18]
- >>> a.send(msg)
-
- """
- def __init__(self, types, port, address, host="127.0.0.1"):
- PyoObject.__init__(self)
- types, port, address, host, lmax = convertArgsToLists(types, port, address, host)
- self._base_objs = [OscDataSend_base(wrap(types,i), wrap(port,i), wrap(address,i), wrap(host,i)) for i in range(lmax)]
- self._addresses = {}
- for i, adr in enumerate(address):
- self._addresses[adr] = self._base_objs[i]
-
- def __dir__(self):
- return []
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def getAddresses(self):
- """
- Returns the addresses managed by the object.
-
- """
- return self._addresses.keys()
-
- def addAddress(self, types, port, address, host="127.0.0.1"):
- """
- Adds new address(es) to the object's handler.
-
- Parameters:
-
- types : str
- String specifying the types sequence of the message to be sent.
- Possible values are :
- integer : "i"
- long integer : "h"
- float : "f"
- double : "d"
- string : "s"
- The string "ssfi" indicates that the value to send will be a list
- containing two strings followed by a float and an integer.
- port : int
- Port on which values are sent. Receiver should listen on the
- same port.
- address : string
- Address used on the port to identify values. Address is in
- the form of a Unix path (ex.: '/pitch').
- host : string, optional
- IP address of the target computer. The default, '127.0.0.1',
- is the localhost.
-
- """
- types, port, address, host, lmax = convertArgsToLists(types, port, address, host)
- objs = [OscDataSend_base(wrap(types,i), wrap(port,i), wrap(address,i), wrap(host,i)) for i in range(lmax)]
- self._base_objs.extend(objs)
- for i, adr in enumerate(address):
- self._addresses[adr] = objs[i]
-
- def delAddress(self, path):
- """
- Removes address(es) from the object's handler.
-
- Parameters:
-
- path : string or list of strings
- Path(s) to remove.
-
- """
- path, lmax = convertArgsToLists(path)
- for p in path:
- self._base_objs.remove(self._addresses[p])
- del self._addresses[p]
-
- def send(self, msg, address=None):
- """
- Method used to send `msg` values as a list.
-
- Parameters:
-
- msg : list
- List of values to send. Types of values in list
- must be of the kind defined of `types` argument
- given at the object's initialization.
- address : string, optional
- Address destination to send values. If None, values
- will be sent to all addresses managed by the object.
-
- """
- if address == None:
- [obj.send(msg) for obj in self._base_objs]
- else:
- self._addresses[address].send(msg)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class OscDataReceive(PyoObject):
- """
- Receives data values over a network via the Open Sound Control protocol.
-
- Uses the OSC protocol to receive data values from other softwares or
- other computers. When a message is received, the function given at the
- argument `function` is called with the current address destination in
- argument followed by a tuple of values.
-
- Parentclass: PyoObject
-
- Parameters:
-
- port : int
- Port on which values are received. Sender should output on
- the same port. Unlike OscDataSend object, there can be only
- one port per OscDataReceive object. Available at initialization
- time only.
- address : string
- Address used on the port to identify values. Address is in
- the form of a Unix path (ex.: '/pitch'). There can be as many
- addresses as needed on a single port.
- function : callable
- This function will be called whenever a message with a known
- address is received. there can be only one function per
- OscDataReceive object. Available at initialization time only.
-
- Methods:
-
- getAddresses() : Returns the addresses managed by the object.
- addAddress(path) : Adds new address(es) to the object's handler.
- delAddress(path) : Removes address(es) from the object's handler.
-
- Notes:
-
- The definition of function at `function` argument must be in this form :
-
- def my_func(address, *args):
- ...
-
- The out() method is bypassed. OscDataReceive has no audio signal.
-
- OscDataReceive has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = OscDataSend("fissif", 9900, "/data/test")
- >>> def pp(address, *args):
- ... print address
- ... print args
- >>> b = OscDataReceive(9900, "/data/test", pp)
- >>> msg = [3.14159, 1, "Hello", "world!", 2, 6.18]
- >>> a.send(msg)
-
- """
-
- def __init__(self, port, address, function, mul=1, add=0):
- PyoObject.__init__(self)
- if type(port) != IntType:
- print >> sys.stderr, 'TypeError: "port" argument of %s must be an integer.\n' % self.__class__.__name__
- exit()
- self._port = port
- if not callable(function):
- print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
- exit()
- self._function = function
- self._address, lmax = convertArgsToLists(address)
- # self._address is linked with list at C level
- self._base_objs = [OscDataReceive_base(port, self._address, function)]
-
- def __dir__(self):
- return []
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def getAddresses(self):
- """
- Returns the addresses managed by the object.
-
- """
- return self._address
-
- def addAddress(self, path):
- """
- Adds new address(es) to the object's handler.
-
- Parameters:
-
- path : string or list of strings
- New path(s) to receive from.
-
- """
- path, lmax = convertArgsToLists(path)
- for p in path:
- if p not in self._address:
- self._base_objs[0].addAddress(p)
-
- def delAddress(self, path):
- """
- Removes address(es) from the object's handler.
-
- Parameters:
-
- path : string or list of strings
- Path(s) to remove.
-
- """
- path, lmax = convertArgsToLists(path)
- for p in path:
- index = self._address.index(p)
- self._base_objs[0].delAddress(index)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class OscListReceive(PyoObject):
- """
- Receives list of values over a network via the Open Sound Control protocol.
-
- Uses the OSC protocol to receive list of floating-point values from other
- softwares or other computers. The list are converted into audio streams.
- Get values at the beginning of each buffersize and fill buffers with them.
-
- Parentclass: PyoObject
-
- Parameters:
-
- port : int
- Port on which values are received. Sender should output on
- the same port. Unlike OscSend object, there can be only one
- port per OscListReceive object. Available at initialization time
- only.
- address : string
- Address used on the port to identify values. Address is in
- the form of a Unix path (ex.: '/pitch').
- num : int, optional
- Length of the lists in input. The object will generate `num` audio
- streams per given address. Available at initialization time only.
- This value can't be a list. That means all addresses managed by an
- OscListReceive object are of the same length. Defaults to 8.
-
- Methods:
-
- get(identifier, all) : Return the first list of samples of the current
- buffer as a list of floats.
- getAddresses() : Returns the addresses managed by the object.
- addAddress(path, mul, add) : Adds new address(es) to the object's handler.
- delAddress(path) : Removes address(es) from the object's handler.
- setInterpolation(x) : Activate/Deactivate interpolation. Activated by default.
- setValue(path, value) : Sets value for the specified address.
-
- Notes:
-
- Audio streams are accessed with the `address` string parameter.
- The user should call :
-
- OscReceive['/pitch'] to retreive list of streams named '/pitch'.
-
- The out() method is bypassed. OscReceive's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # 8 oscillators
- >>> a = OscListReceive(port=10001, address=['/pitch', '/amp'], num=8)
- >>> b = Sine(freq=a['/pitch'], mul=a['/amp']).mix(2).out()
-
- """
-
- def __init__(self, port, address, num=8, mul=1, add=0):
- PyoObject.__init__(self)
- if type(port) != IntType:
- print >> sys.stderr, 'TypeError: "port" argument of %s must be an integer.\n' % self.__class__.__name__
- exit()
- if type(num) != IntType:
- print >> sys.stderr, 'TypeError: "num" argument of %s must be an integer.\n' % self.__class__.__name__
- exit()
- self._num = num
- self._op_duplicate = self._num
- self._mul = mul
- self._add = add
- address, mul, add, lmax = convertArgsToLists(address, mul, add)
- self._address = address
- self._mainReceiver = OscListReceiver_base(port, address, num)
- self._base_objs = [OscListReceive_base(self._mainReceiver, wrap(address,i), j, wrap(mul,i), wrap(add,i)) for i in range(lmax) for j in range(self._num)]
-
- def __dir__(self):
- return ['mul', 'add']
-
- def __getitem__(self, i):
- if type(i) == type(''):
- first = self._address.index(i) * self._num
- return self._base_objs[first:first+self._num]
- elif i < len(self._base_objs):
- first = i * self._num
- return self._base_objs[first:first+self._num]
- else:
- print "'i' too large!"
-
- def getAddresses(self):
- """
- Returns the addresses managed by the object.
-
- """
- return self._address
-
- def addAddress(self, path, mul=1, add=0):
- """
- Adds new address(es) to the object's handler.
-
- Parameters:
-
- path : string or list of strings
- New path(s) to receive from.
- mul : float or PyoObject
- Multiplication factor. Defaults to 1.
- add : float or PyoObject
- Addition factor. Defaults to 0.
-
- """
- path, lmax = convertArgsToLists(path)
- mul, add, lmax2 = convertArgsToLists(mul, add)
- for i, p in enumerate(path):
- if p not in self._address:
- self._mainReceiver.addAddress(p)
- self._address.append(p)
- self._base_objs.extend([OscListReceive_base(self._mainReceiver, p, j, wrap(mul,i), wrap(add,i)) for j in range(self._num)])
-
- def delAddress(self, path):
- """
- Removes address(es) from the object's handler.
-
- Parameters:
-
- path : string or list of strings
- Path(s) to remove.
-
- """
- path, lmax = convertArgsToLists(path)
- self._mainReceiver.delAddress(path)
- indexes = [self._address.index(p) for p in path]
- for ind in reversed(indexes):
- self._address.pop(ind)
- first = ind * self._num
- for i in reversed(range(first, first+self._num)):
- obj = self._base_objs.pop(i)
-
- def setInterpolation(self, x):
- """
- Activate/Deactivate interpolation. Activated by default.
-
- Parameters:
-
- x : boolean
- True activates the interpolation, False deactivates it.
-
- """
- [obj.setInterpolation(x) for obj in self._base_objs]
-
- def setValue(self, path, value):
- """
- Sets value for a given address.
-
- Parameters:
-
- path : string
- Address to which the value should be attributed.
- value : list of floats
- List of values to attribute to the given address.
-
- """
- path, lmax = convertArgsToLists(path)
- for i in range(lmax):
- p = wrap(path,i)
- if p in self._address:
- if type(value[0]) == ListType:
- val = wrap(value,i)
- else:
- val = value
- if len(val) == self._num:
- self._mainReceiver.setValue(p, val)
- else:
- print 'Error: OscListReceive.setValue, value must be of the same length as the `num` attribute.'
- else:
- print 'Error: OscListReceive.setValue, Illegal address "%s"' % p
-
- def get(self, identifier=None, all=False):
- """
- Return the first list of samples of the current buffer as floats.
-
- Can be used to convert audio stream to usable Python data.
-
- Address as string must be given to `identifier` to specify
- which stream to get value from.
-
- Parameters:
-
- identifier : string
- Address string parameter identifying audio stream.
- Defaults to None, useful when `all` is True to
- retreive all streams values.
- all : boolean, optional
- If True, the first list of values of each object's stream
- will be returned as a list of lists. Otherwise, only the
- the list of the object's identifier will be returned as a
- list of floats. Defaults to False.
-
- """
- if not all:
- first = self._address.index(identifier) * self._num
- return [obj._getStream().getValue() for obj in self._base_objs[first:first+self._num]]
- else:
- outlist = []
- for add in self._address:
- first = self._address.index(add) * self._num
- l = [obj._getStream().getValue() for obj in self._base_objs[first:first+self._num]]
- outlist.append(l)
- return outlist
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/pan.py b/build/lib.linux-x86_64-2.7/pyolib/pan.py
deleted file mode 100644
index cbce444..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/pan.py
+++ /dev/null
@@ -1,795 +0,0 @@
-"""
-Set of objects to manage audio voice routing and spread of a sound
-signal into a new stereo or multi-channel sound field.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-import sys, random
-from _core import *
-from _maps import *
-from types import SliceType, IntType
-
-class Pan(PyoObject):
- """
- Cosinus panner with control on the spread factor.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- outs : int, optional
- Number of channels on the panning circle. Defaults to 2.
- pan : float or PyoObject
- Position of the sound on the panning circle, between 0 and 1.
- Defaults to 0.5.
- spread : float or PyoObject
- Amount of sound leaking to the surrounding channels,
- between 0 and 1. Defaults to 0.5.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setPan(x) : Replace the `pan` attribute.
- setSpread(x) : Replace the `spread` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- pan : float or PyoObject. Position of the sound on the panning circle.
- spread : float or PyoObject. Amount of sound leaking to the
- surrounding channels.
-
- Examples:
-
- >>> s = Server(nchnls=2).boot()
- >>> s.start()
- >>> a = Noise(mul=.2)
- >>> lfo = Sine(freq=1, mul=.5, add=.5)
- >>> p = Pan(a, outs=2, pan=lfo).out()
-
- """
- def __init__(self, input, outs=2, pan=0.5, spread=0.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._pan = pan
- self._outs = outs
- self._spread = spread
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, pan, spread, mul, add, lmax = convertArgsToLists(self._in_fader, pan, spread, mul, add)
- self._base_players = [Panner_base(wrap(in_fader,i), outs, wrap(pan,i), wrap(spread,i)) for i in range(lmax)]
- self._base_objs = []
- for i in range(lmax):
- for j in range(outs):
- self._base_objs.append(Pan_base(wrap(self._base_players,i), j, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['input', 'pan', 'spread', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setPan(self, x):
- """
- Replace the `pan` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `pan` attribute.
-
- """
- self._pan = x
- x, lmax = convertArgsToLists(x)
- [obj.setPan(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setSpread(self, x):
- """
- Replace the `spread` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `spread` attribute.
-
- """
- self._spread = x
- x, lmax = convertArgsToLists(x)
- [obj.setSpread(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapPan(self._pan),
- SLMap(0., 1., 'lin', 'spread', self._spread),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def pan(self):
- """float or PyoObject. Position of the sound on the panning circle."""
- return self._pan
- @pan.setter
- def pan(self, x): self.setPan(x)
-
- @property
- def spread(self):
- """float or PyoObject. Amount of sound leaking to the surrounding channels."""
- return self._spread
- @spread.setter
- def spread(self, x): self.setSpread(x)
-
-class SPan(PyoObject):
- """
- Simple equal power panner.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- outs : int, optional
- Number of channels on the panning circle. Defaults to 2.
- pan : float or PyoObject
- Position of the sound on the panning circle, between 0 and 1.
- Defaults to 0.5.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setPan(x) : Replace the `pan` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- pan : float or PyoObject. Position of the sound on the panning circle.
-
- Examples:
-
- >>> s = Server(nchnls=2).boot()
- >>> s.start()
- >>> a = Noise(mul=.2)
- >>> lfo = Sine(freq=1, mul=.5, add=.5)
- >>> p = SPan(a, outs=2, pan=lfo).out()
-
- """
- def __init__(self, input, outs=2, pan=0.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._outs = outs
- self._pan = pan
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, pan, mul, add, lmax = convertArgsToLists(self._in_fader, pan, mul, add)
- self._base_players = [SPanner_base(wrap(in_fader,i), outs, wrap(pan,i)) for i in range(lmax)]
- self._base_objs = []
- for i in range(lmax):
- for j in range(outs):
- self._base_objs.append(SPan_base(wrap(self._base_players,i), j, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['input', 'pan', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setPan(self, x):
- """
- Replace the `pan` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `pan` attribute.
-
- """
- self._pan = x
- x, lmax = convertArgsToLists(x)
- [obj.setPan(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapPan(self._pan), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def pan(self):
- """float or PyoObject. Position of the sound on the panning circle."""
- return self._pan
- @pan.setter
- def pan(self, x): self.setPan(x)
-
-class Switch(PyoObject):
- """
- Audio switcher.
-
- Switch takes an audio input and interpolates between multiple outputs.
-
- User can retrieve the different streams by calling the output number
- between brackets. obj[0] retrieve the first stream, obj[outs-1] the
- last one.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- outs : int, optional
- Number of outputs. Defaults to 2.
- voice : float or PyoObject
- Voice position pointer, between 0 and (outs-1) / len(input).
- Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setVoice(x) : Replace the `voice` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- voice : float or PyoObject. Voice position pointer.
-
- Examples:
-
- >>> s = Server(nchnls=2).boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", speed=[.999,1], loop=True, mul=.3)
- >>> lf = Sine(freq=.25, mul=1, add=1)
- >>> b = Switch(a, outs=6, voice=lf)
- >>> c = WGVerb(b[0:2], feedback=.8).out()
- >>> d = Disto(b[2:4], drive=.9, mul=.1).out()
- >>> e = Delay(b[4:6], delay=.2, feedback=.6).out()
-
- """
- def __init__(self, input, outs=2, voice=0., mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._outs = outs
- self._voice = voice
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, voice, mul, add, lmax = convertArgsToLists(self._in_fader, voice, mul, add)
- self._base_players = [Switcher_base(wrap(in_fader,i), outs, wrap(voice,i)) for i in range(lmax)]
- self._base_objs = []
- for j in range(outs):
- for i in range(lmax):
- self._base_objs.append(Switch_base(wrap(self._base_players,i), j, wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['input', 'voice', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setVoice(self, x):
- """
- Replace the `voice` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `voice` attribute.
-
- """
- self._voice = x
- x, lmax = convertArgsToLists(x)
- [obj.setVoice(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0, self._outs-1, "lin", "voice", self._voice), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def voice(self):
- """float or PyoObject. Voice position pointer."""
- return self._voice
- @voice.setter
- def voice(self, x): self.setVoice(x)
-
-class Selector(PyoObject):
- """
- Audio selector.
-
- Selector takes multiple PyoObjects in input and interpolates between
- them to generate a single output.
-
- Parentclass: PyoObject
-
- Parameters:
-
- inputs : list of PyoObject
- Audio objects to interpolate from.
- voice : float or PyoObject, optional
- Voice position pointer, between 0 and len(inputs)-1.
- Defaults to 0.
-
- Methods:
-
- setInputs(x) : Replace the `inputs` attribute.
- setVoice(x) : Replace the `voice` attribute.
-
- Attributes:
-
- inputs : list of PyoObject. Audio objects to interpolate from.
- voice : float or PyoObject. Voice position pointer.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + "/transparent.aif", speed=[.999,1], loop=True, mul=.3)
- >>> b = Noise(mul=.1)
- >>> c = SfPlayer(SNDS_PATH + "/accord.aif", speed=[.999,1], loop=True, mul=.5)
- >>> lf = Sine(freq=.1, add=1)
- >>> d = Selector(inputs=[a,b,c], voice=lf).out()
-
- """
- def __init__(self, inputs, voice=0., mul=1, add=0):
- PyoObject.__init__(self)
- self._inputs = inputs
- self._voice = voice
- self._mul = mul
- self._add = add
- voice, mul, add, self._lmax = convertArgsToLists(voice, mul, add)
- self._length = 1
- for obj in self._inputs:
- try:
- if len(obj) > self._length: self._length = len(obj)
- except:
- pass
- self._base_objs = []
- for i in range(self._lmax):
- for j in range(self._length):
- choice = []
- for obj in self._inputs:
- try:
- choice.append(obj[j%len(obj)])
- except:
- choice.append(obj)
- self._base_objs.append(Selector_base(choice, wrap(voice,i), wrap(mul,i), wrap(add,i)))
-
- def __dir__(self):
- return ['inputs', 'voice', 'mul', 'add']
-
- def setInputs(self, x):
- """
- Replace the `inputs` attribute.
-
- Parameters:
-
- x : list of PyoObject
- new `inputs` attribute.
-
- """
- self._inputs = x
- for i in range(self._lmax):
- for j in range(self._length):
- choice = []
- for obj in self._inputs:
- try:
- choice.append(obj[j%len(obj)])
- except:
- choice.append(obj)
- self._base_objs[i+j*self._lmax].setInputs(choice)
-
- def setVoice(self, x):
- """
- Replace the `voice` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `voice` attribute.
-
- """
- self._voice = x
- x, lmax = convertArgsToLists(x)
- for i, obj in enumerate(self._base_objs):
- obj.setVoice(wrap(x, i/self._length))
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0, len(self._inputs)-1, "lin", "voice", self._voice), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def inputs(self): return self._inputs
- @inputs.setter
- def inputs(self, x): self.setInputs(x)
- @property
- def voice(self): return self._voice
- @voice.setter
- def voice(self, x): self.setVoice(x)
-
-class VoiceManager(PyoObject):
- """
- Polyphony voice manager.
-
- A trigger in input ask the object for a voice number and the object returns
- the first free one. The voice number is then disable until a trig comes at
- the same position in the list of triggers given at the argument `triggers`.
-
- Usually, the trigger enabling the voice number will come from the process
- started with the object output. So, it's common to leave the `triggers`
- argument to None and set the list of triggers afterward with the `setTriggers`
- method. The maximum number of voices generated by the object is the length
- of the trigger list.
-
- If there is no free voice, the object outputs -1.0 continuously.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Trigger stream asking for new voice numbers.
- triggers : PyoObject or list of PyoObject, optional
- List of mono PyoObject sending triggers. Can be a multi-streams
- PyoObject but not a mix of both. Ordering in the list corresponds
- to voice numbers. Defaults to None.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setTriggers(x) : Replace the `triggers` attribute.
-
- Attributes:
-
- input : PyoObject. Trigger stream asking for new voice numbers.
- triggers : list of PyoObject. Trigger streams enabling voices.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> env = CosTable([(0,0),(100,1),(500,.5),(8192,0)])
- >>> delta = RandDur(min=.05, max=.1)
- >>> vm = VoiceManager(Change(delta))
- >>> sel = Select(vm, value=[0,1,2,3])
- >>> pit = TrigChoice(sel, choice=[midiToHz(x) for x in [60,63,67,70,72]])
- >>> amp = TrigEnv(sel, table=env, dur=.5, mul=.25)
- >>> synth1 = SineLoop(pit, feedback=.07, mul=amp).out()
- >>> vm.setTriggers(amp["trig"])
-
- """
- def __init__(self, input, triggers=None, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._triggers = triggers
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- if triggers != None:
- if type(triggers) == ListType:
- try:
- t_streams = [obj[0] for obj in triggers]
- except TypeError:
- t_streams = triggers
- elif isinstance(triggers, PyoObject):
- t_streams = triggers.getBaseObjects()
- else:
- t_streams = None
- else:
- t_streams = None
- self._base_objs = [VoiceManager_base(wrap(in_fader,i), t_streams, wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'triggers', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setTriggers(self, x):
- """
- Replace the `triggers` attribute.
-
- Parameters:
-
- x : PyoObject or list of PyoObject
- New `triggers` attribute.
-
- """
- self._triggers = x
- if x != None:
- if type(x) == ListType:
- try:
- t_streams = [obj[0] for obj in x]
- except TypeError:
- t_streams = x
- elif isinstance(x, PyoObject):
- t_streams = x.getBaseObjects()
- else:
- t_streams = None
- [obj.setTriggers(t_streams) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Trigger stream asking for new voice numbers."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def triggers(self): return self._triggers
- @triggers.setter
- def triggers(self, x): self.setTriggers(x)
-
-class Mixer(PyoObject):
- """
- Audio mixer.
-
- Mixer mixes multiple inputs to an arbitrary number of outputs
- with independant amplitude values per mixing channel and a
- user defined portamento applied on amplitude changes.
-
- Parentclass: PyoObject
-
- Parameters:
-
- outs : int, optional
- Number of outputs of the mixer. Available at initialization
- time only. Defaults to 2.
- chnls : int, optional
- Number of channels per output. Available at initialization
- time only. Defaults to 1.
- time : float, optional
- Duration, in seconds, of a portamento applied on
- a new amplitude value for a mixing channel.
- Defaults to 0.025.
-
- Methods:
-
- setTime(x) : Sets the portamento duration in seconds.
- addInput(voice, input) : Adds a new input to the mixer.
- delInput(voice) : Removes an input from the mixer.
- setAmp(vin, vout, amp) : Sets the amplitude of a mixing channel.
- getChannels() : Returns the Mixer's channels dictionary.
- getKeys() : Returns the list of current keys in the Mixer's channels dictionary.
-
- Attributes:
-
- time : float. Portamento applied on amplitude changes.
-
- Notes:
-
- User can retrieve each of the output channels by calling the Mixer
- object with the desired channel between square brackets (see example).
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH+"/transparent.aif", loop=True, mul=.2)
- >>> b = FM(carrier=200, ratio=[.5013,.4998], index=6, mul=.2)
- >>> mm = Mixer(outs=3, chnls=2, time=.025)
- >>> fx1 = Disto(mm[0], drive=.9, slope=.9, mul=.1).out()
- >>> fx2 = Freeverb(mm[1], size=.8, damp=.8, mul=.5).out()
- >>> fx3 = Harmonizer(mm[2], transpo=1, feedback=.75, mul=.5).out()
- >>> mm.addInput(0, a)
- >>> mm.addInput(1, b)
- >>> mm.setAmp(0,0,.5)
- >>> mm.setAmp(0,1,.5)
- >>> mm.setAmp(1,2,.5)
- >>> mm.setAmp(1,1,.5)
-
- """
- def __init__(self, outs=2, chnls=1, time=0.025, mul=1, add=0):
- PyoObject.__init__(self)
- if type(outs) != IntType:
- print >> sys.stderr, 'TypeError: "outs" argument of %s must be an integer.\n' % self.__class__.__name__
- exit()
- if type(chnls) != IntType:
- print >> sys.stderr, 'TypeError: "chnls" argument of %s must be an integer.\n' % self.__class__.__name__
- exit()
- self._outs = outs
- self._chnls = chnls
- self._time = time
- self._mul = mul
- self._add = add
- self._inputs = {}
- time, mul, add, lmax = convertArgsToLists(time, mul, add)
- self._base_players = [Mixer_base(outs, wrap(time,i)) for i in range(chnls)]
- self._base_objs = [MixerVoice_base(self._base_players[j], i, wrap(mul,i), wrap(add,i)) for i in range(outs) for j in range(chnls)]
-
- def __dir__(self):
- return ["time", "mul", "add"]
-
- def __getitem__(self, x):
- if type(x) == SliceType:
- return [self._base_objs[j*self._chnls+i] for j in range(x.start or 0, x.stop or sys.maxint, x.step or 1) for i in range(self._chnls)]
- elif x < len(self._base_objs):
- return [self._base_objs[x*self._chnls+i] for i in range(self._chnls)]
- else:
- print "'x' too large!"
-
- def setTime(self, x):
- """
- Sets the portamento duration in seconds.
-
- Parameters:
-
- x : float
- New portamento duration.
-
- """
- self._time = x
- x, lmax = convertArgsToLists(x)
- [obj.setTime(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def addInput(self, voice, input):
- """
- Adds an audio object in the mixer's inputs.
-
- This method returns the key (voice argument or generated key if voice=None).
-
- Parameters:
-
- voice : int or string
- Key in the mixer dictionary for this input. If None, a unique key
- between 0 and 32767 will be automatically generated.
- input : PyoObject
- Audio object to add to the mixer.
-
- """
- if voice == None:
- voice = random.randint(0, 32767)
- while self._inputs.has_key(voice):
- voice = random.randint(0, 32767)
- if self._inputs.has_key(voice):
- print >> sys.stderr, "Mixer has already a key named %s" % voice
- return
- self._inputs[voice] = input
- [obj.addInput(str(voice), wrap(input,i)) for i, obj in enumerate(self._base_players)]
- return voice
-
- def delInput(self, voice):
- """
- Removes an audio object from the mixer's inputs.
-
- Parameters:
-
- voice : int or string
- Key in the mixer dictionary assigned to the input to remove.
-
- """
- if self._inputs.has_key(voice):
- del self._inputs[voice]
- [obj.delInput(str(voice)) for i, obj in enumerate(self._base_players)]
-
- def setAmp(self, vin, vout, amp):
- """
- Sets the amplitude of a mixing channel.
-
- Parameters:
-
- vin : int or string
- Key in the mixer dictionary of the desired input.
- vout : int
- Ouput channel where to send the signal.
- amp : float
- Amplitude value for this mixing channel.
-
- """
- if self._inputs.has_key(vin) and vout < self._outs:
- [obj.setAmp(str(vin), vout, amp) for i, obj in enumerate(self._base_players)]
-
- def getChannels(self):
- """
- Returns the Mixer's channels dictionary.
-
- """
- return self._inputs
-
- def getKeys(self):
- """
- Returns the list of current keys in the Mixer's channels dictionary.
-
- """
- return self._inputs.keys()
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def time(self):
- """float. Portamento."""
- return self._time
- @time.setter
- def time(self, x): self.setTime(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/pattern.py b/build/lib.linux-x86_64-2.7/pyolib/pattern.py
deleted file mode 100644
index d4155ec..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/pattern.py
+++ /dev/null
@@ -1,325 +0,0 @@
-"""
-Set of objects that call Python functions from triggers or number counts.
-Useful for event sequencing.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-import sys
-from _core import *
-from _maps import *
-from types import ListType, TupleType
-
-class Pattern(PyoObject):
- """
- Periodically calls a Python function.
-
- The play() method starts the pattern timer and is not called
- at the object creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- function : Python function
- Python function to be called periodically.
- 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,251], mul=.2).out()
- >>> def pat():
- ... f = random.randrange(200, 401, 25)
- ... a.freq = [f, f+1]
- >>> p = Pattern(pat, .125)
- >>> p.play()
-
- """
- def __init__(self, function, time=1):
- PyoObject.__init__(self)
- if type(function) == ListType or type(function) == TupleType:
- if not callable(function[0]):
- print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
- exit()
- else:
- if not callable(function):
- print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
- exit()
- self._function = function
- self._time = time
- function, time, lmax = convertArgsToLists(function, time)
- self._base_objs = [Pattern_base(wrap(function,i), wrap(time,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['function', 'time']
-
- def setFunction(self, x):
- """
- Replace the `function` attribute.
-
- Parameters:
-
- x : Python function
- new `function` attribute.
-
- """
- self._function = x
- x, lmax = convertArgsToLists(x)
- [obj.setFunction(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setTime(self, x):
- """
- Replace the `time` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `time` attribute.
-
- """
- self._time = x
- x, lmax = convertArgsToLists(x)
- [obj.setTime(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def out(self, x=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setSub(self, x):
- pass
-
- def setDiv(self, x):
- pass
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0.125, 4., 'lin', 'time', self._time)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def function(self):
- """Python function. Function to be called."""
- return self._function
- @function.setter
- def function(self, x):
- self.setFunction(x)
- @property
- def time(self):
- """float or PyoObject. Time, in seconds, between each call."""
- return self._time
- @time.setter
- def time(self, x): self.setTime(x)
-
-class Score(PyoObject):
- """
- Calls functions by incrementation of a preformatted name.
-
- Score takes audio stream containning integers in input and calls
- a function whose name is the concatenation of `fname` and the changing
- integer.
-
- Can be used to sequence events, first by creating functions p0, p1,
- p2, etc. and then, by passing a counter to a Score object with "p"
- as `fname` argument. Functions are called without parameters.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal. Must contains integer numbers. Integer must change
- before calling its function again.
- fname : string, optional
- Name of the functions to be called. Defaults to "event_", meaning
- that the object will call the function "event_0", "event_1", "event_2",
- and so on... Available at initialization time only.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Audio signal sending integer numbers.
-
- Notes:
-
- The out() method is bypassed. Score's signal can not be sent
- to audio outs.
-
- Score has no `mul` and `add` attributes.
-
- See also: Pattern, TrigFunc
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SineLoop(freq=[200,300,400,500], feedback=0.05, mul=.1).out()
- >>> def event_0():
- ... a.freq=[200,300,400,500]
- >>> def event_1():
- ... a.freq=[300,400,450,600]
- >>> def event_2():
- ... a.freq=[150,375,450,525]
- >>> m = Metro(1).play()
- >>> c = Counter(m, min=0, max=3)
- >>> sc = Score(c)
-
- """
- def __init__(self, input, fname="event_"):
- PyoObject.__init__(self)
- self._input = input
- self._fname = fname
- self._in_fader = InputFader(input)
- in_fader, fname, lmax = convertArgsToLists(self._in_fader, fname)
- self._base_objs = [Score_base(wrap(in_fader,i), wrap(fname,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class CallAfter(PyoObject):
- """
- Calls a Python function after a given time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- function : Python function
- Python callable execute after `time` seconds.
- time : float, optional
- Time, in seconds, before the call. Default to 1.
- arg : any Python object, optional
- Argument sent to the called function. Default to None.
-
- Notes:
-
- The out() method is bypassed. CallAfter doesn't return signal.
-
- CallAfter has no `mul` and `add` attributes.
-
- The object is not deleted after the call. The User must delete it himself.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Start an oscillator with a frequency of 250 Hz
- >>> syn = SineLoop(freq=[250,251], feedback=.07, mul=.2).out()
- >>> def callback(arg):
- ... # Change the oscillator's frequency to 300 Hz after 2 seconds
- ... syn.freq = arg
- >>> a = CallAfter(callback, 2, [300,301])
-
- """
- def __init__(self, function, time=1, arg=None):
- PyoObject.__init__(self)
- if type(function) == ListType or type(function) == TupleType:
- if not callable(function[0]):
- print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
- exit()
- else:
- if not callable(function):
- print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
- exit()
- self._function = function
- function, time, arg, lmax = convertArgsToLists(function, time, arg)
- self._base_objs = [CallAfter_base(wrap(function,i), wrap(time,i), wrap(arg,i)) for i in range(lmax)]
-
- def __dir__(self):
- return []
-
- def out(self, x=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setSub(self, x):
- pass
-
- def setDiv(self, x):
- pass
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/players.py b/build/lib.linux-x86_64-2.7/pyolib/players.py
deleted file mode 100644
index 88d9558..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/players.py
+++ /dev/null
@@ -1,568 +0,0 @@
-"""
-Play soundfiles from the disk.
-
-SfMarkerXXX objects use markers features (store in the header) from
-an AIFF file to create more specific reading patterns.
-
-"""
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-import aifc
-from types import ListType
-
-class SfPlayer(PyoObject):
- """
- Soundfile player.
-
- Reads audio data from a file using one of several available interpolation
- types. User can alter its pitch with the `speed` attribute. The object
- takes care of sampling rate conversion to match the Server sampling
- rate setting.
-
- Parentclass: PyoObject
-
- Parameters:
-
- path : string
- Full path name of the sound to read.
- speed : float or PyoObject, optional
- Transpose the pitch of input sound by this factor. 1 is the
- original pitch, lower values play sound slower, and higher
- values play sound faster. Negative values results in playing
- sound backward. Although the `speed` attribute accepts audio
- rate signal, its value is updated only once per buffer size.
- Defaults to 1.
- loop : bool, optional
- If set to True, sound will play in loop. Defaults to False.
- offset : float, optional
- Time in seconds of input sound to be skipped, assuming speed = 1.
- Defaults to 0.
- interp : int, optional
- Interpolation type. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
-
- Methods:
-
- setPath(path) : Replace the `path` attribute.
- setSound(path) : Replace the `path` attribute.
- setSpeed(x) : Replace the `speed` attribute.
- setLoop(x) : Replace the `loop` attribute.
- setOffset(x) : Replace the `offset` attribute.
- setInterp(x) : Replace the `interp` attribute.
-
- Attributes:
-
- path : string, Full path of the sound.
- sound : alias to the `path` attribute.
- speed : float or PyoObject, Transposition factor.
- loop : bool, Looping mode.
- offset : float, Time, in seconds, of the first sample to read.
- interp : int {1, 2, 3, 4}, Interpolation method.
-
- Notes:
-
- SfPlayer will sends a trigger signal at the end of the playback if
- loop is off or any time it wraps around if loop is on. User can
- retrieve the trigger streams by calling obj['trig']:
-
- >>> sf = SfPlayer(SNDS_PATH + "/transparent.aif").out()
- >>> trig = TrigRand(sf['trig'])
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> snd = SNDS_PATH + "/transparent.aif"
- >>> sf = SfPlayer(snd, speed=[.75,.8], loop=True, mul=.3).out()
-
- """
- def __init__(self, path, speed=1, loop=False, offset=0, interp=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._path = path
- self._speed = speed
- self._loop = loop
- self._offset = offset
- self._interp = interp
- self._mul = mul
- self._add = add
- path, speed, loop, offset, interp, mul, add, lmax = convertArgsToLists(path, speed, loop, offset, interp, mul, add)
- self._base_players = []
- self._base_objs = []
- _trig_objs_tmp = []
- for i in range(lmax):
- _snd_size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(path[0])
- self._base_players.append(SfPlayer_base(wrap(path,i), wrap(speed,i), wrap(loop,i), wrap(offset,i), wrap(interp,i)))
- for j in range(_snd_chnls):
- self._base_objs.append(SfPlay_base(self._base_players[-1], j, wrap(mul,i), wrap(add,i)))
- _trig_objs_tmp.append(TriggerDummy_base(self._base_players[-1]))
- self._trig_objs = Dummy(_trig_objs_tmp)
-
- def __dir__(self):
- return ['path', 'speed', 'loop', 'offset', 'interp', 'mul', 'add']
-
- def setPath(self, path):
- """
- Sets a new sound to read.
-
- The number of channels of the new sound must match those
- of the sound loaded at initialization time.
-
- Parameters:
-
- path : string
- Full path of the new sound.
-
- """
- if type(self._path) == ListType:
- curNchnls = sndinfo(self._path[0])[3]
- else:
- curNchnls = sndinfo(self._path)[3]
- if type(path) == ListType:
- p = path[0]
- else:
- p = path
- try:
- _snd_size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(p)
- except:
- return
- if _snd_chnls != curNchnls:
- print "Soundfile must contains exactly %d channels." % curNchnls
- return
-
- self._path = path
- path, lmax = convertArgsToLists(path)
- [obj.setSound(wrap(path,i)) for i, obj in enumerate(self._base_players)]
-
- def setSound(self, path):
- """
- Sets a new sound to read.
-
- The number of channels of the new sound must match those
- of the sound loaded at initialization time.
-
- Parameters:
-
- path : string
- Full path of the new sound.
-
- """
- self.setPath(path)
-
- def setSpeed(self, x):
- """
- Replace the `speed` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `speed` attribute.
-
- """
- self._speed = x
- x, lmax = convertArgsToLists(x)
- [obj.setSpeed(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setLoop(self, x):
- """
- Replace the `loop` attribute.
-
- Parameters:
-
- x : bool {True, False}
- new `loop` attribute.
-
- """
- self._loop = x
- x, lmax = convertArgsToLists(x)
- for i, obj in enumerate(self._base_players):
- if wrap(x,i): obj.setLoop(1)
- else: obj.setLoop(0)
-
- def setOffset(self, x):
- """
- Replace the `offset` attribute.
-
- Parameters:
-
- x : float
- new `offset` attribute.
-
- """
- self._offset = x
- x, lmax = convertArgsToLists(x)
- [obj.setOffset(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int {1, 2, 3, 4}
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(-2., 2., 'lin', 'speed', self._speed), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def path(self):
- """string. Full path of the sound."""
- return self._path
- @path.setter
- def path(self, x): self.setPath(x)
-
- @property
- def sound(self):
- """string. Alias to the `path` attribute."""
- return self._path
- @sound.setter
- def sound(self, x): self.setPath(x)
-
- @property
- def speed(self):
- """float or PyoObject. Transposition factor."""
- return self._speed
- @speed.setter
- def speed(self, x): self.setSpeed(x)
-
- @property
- def loop(self):
- """bool. Looping mode."""
- return self._loop
- @loop.setter
- def loop(self, x): self.setLoop(x)
-
- @property
- def offset(self):
- """float. Time, in seconds, of the first sample to read."""
- return self._offset
- @offset.setter
- def offset(self, x): self.setOffset(x)
-
- @property
- def interp(self):
- """int {1, 2, 3, 4}. Interpolation method."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
-class SfMarkerShuffler(PyoObject):
- """
- AIFF with markers soundfile shuffler.
-
- Reads audio data from a AIFF file using one of several available
- interpolation types. User can alter its pitch with the `speed`
- attribute. The object takes care of sampling rate conversion to
- match the Server sampling rate setting.
-
- The reading pointer randomly choose a marker (from the MARK chunk
- in the header of the AIFF file) as its starting point and reads
- the samples until it reaches the following marker. Then, it choose
- another marker and reads from the new position and so on...
-
- Parentclass: PyoObject
-
- Parameters:
-
- path : string
- Full path name of the sound to read. Can't e changed after
- initialization.
- speed : float or PyoObject, optional
- Transpose the pitch of input sound by this factor. 1 is the
- original pitch, lower values play sound slower, and higher
- values play sound faster. Negative values results in playing
- sound backward. Although the `speed` attribute accepts audio
- rate signal, its value is updated only once per buffer size.
- Defaults to 1.
- interp : int, optional
- Choice of the interpolation method. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
-
- Methods:
-
- setSpeed(x) : Replace the `speed` attribute.
- setInterp(x) : Replace the `interp` attribute.
- getMarkers() : Returns a list of marker time values in samples.
-
- Attributes:
-
- speed : float or PyoObject, Transposition factor.
- interp : int {1, 2, 3, 4}, Interpolation method.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfMarkerShuffler(SNDS_PATH + "/transparent.aif", speed=[1,1], mul=.3).out()
-
- """
- def __init__(self, path, speed=1, interp=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._speed = speed
- self._interp = interp
- self._mul = mul
- self._add = add
- path, speed, interp, mul, add, lmax = convertArgsToLists(path, speed, interp, mul, add)
- self._base_players = []
- self._base_objs = []
- self._snd_size, self._dur, self._snd_sr, self._snd_chnls, _format, _type = sndinfo(path[0])
- for i in range(lmax):
- try:
- sf = aifc.open(wrap(path,i))
- markerstmp = sf.getmarkers()
- sf.close()
- self._markers = [m[1] for m in markerstmp]
- except:
- self._markers = []
- self._base_players.append(SfMarkerShuffler_base(wrap(path,i), self._markers, wrap(speed,i), wrap(interp,i)))
- for i in range(lmax * self._snd_chnls):
- j = i / self._snd_chnls
- self._base_objs.append(SfMarkerShuffle_base(wrap(self._base_players,j), i % self._snd_chnls, wrap(mul,j), wrap(add,j)))
-
- def __dir__(self):
- return ['speed', 'interp', 'mul', 'add']
-
- def setSpeed(self, x):
- """
- Replace the `speed` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `speed` attribute.
-
- """
- self._speed = x
- x, lmax = convertArgsToLists(x)
- [obj.setSpeed(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int {1, 2, 3, 4}
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def getMarkers(self):
- """
- Returns a list of marker time values in samples.
-
- """
- return self._markers
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0.01, 2., 'lin', 'speed', self._speed), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def speed(self):
- """float or PyoObject. Transposition factor."""
- return self._speed
- @speed.setter
- def speed(self, x): self.setSpeed(x)
-
- @property
- def interp(self):
- """int {1, 2, 3, 4}. Interpolation method."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
-class SfMarkerLooper(PyoObject):
- """
- AIFF with markers soundfile looper.
-
- Reads audio data from a AIFF file using one of several available
- interpolation types. User can alter its pitch with the `speed`
- attribute. The object takes care of sampling rate conversion to
- match the Server sampling rate setting.
-
- The reading pointer loops a specific marker (from the MARK chunk
- in the header of the AIFF file) until it received a new integer
- in the `mark` attribute.
-
- Parentclass: PyoObject
-
- Parameters:
-
- path : string
- Full path name of the sound to read.
- speed : float or PyoObject, optional
- Transpose the pitch of input sound by this factor. 1 is the
- original pitch, lower values play sound slower, and higher
- values play sound faster. Negative values results in playing
- sound backward. Although the `speed` attribute accepts audio
- rate signal, its value is updated only once per buffer size.
- Defaults to 1.
- mark : float or PyoObject, optional
- Integer denoting the marker to loop, in the range
- 0 -> len(getMarkers()). Defaults to 0.
- interp : int, optional
- Choice of the interpolation method. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
-
- Methods:
-
- setSpeed(x) : Replace the `speed` attribute.
- setInterp(x) : Replace the `interp` attribute.
- setMark(x) : Replace the `mark` attribute.
- getMarkers() : Returns a list of marker time values in samples.
-
- Attributes:
-
- speed : float or PyoObject, Transposition factor.
- mark : float or PyoObject, Marker to loop.
- interp : int {1, 2, 3, 4}, Interpolation method.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfMarkerLooper(SNDS_PATH + '/transparent.aif', speed=[.999,1], mul=.3).out()
- >>> rnd = RandInt(len(a.getMarkers()), 2)
- >>> a.mark = rnd
-
- """
- def __init__(self, path, speed=1, mark=0, interp=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._speed = speed
- self._mark = mark
- self._interp = interp
- self._mul = mul
- self._add = add
- path, speed, mark, interp, mul, add, lmax = convertArgsToLists(path, speed, mark, interp, mul, add)
- self._base_players = []
- self._base_objs = []
- self._snd_size, self._dur, self._snd_sr, self._snd_chnls, _format, _type = sndinfo(path[0])
- for i in range(lmax):
- try:
- sf = aifc.open(wrap(path,i))
- markerstmp = sf.getmarkers()
- sf.close()
- self._markers = [m[1] for m in markerstmp]
- except:
- self._markers = []
- self._base_players.append(SfMarkerLooper_base(wrap(path,i), self._markers, wrap(speed,i), wrap(mark,i), wrap(interp,i)))
- for i in range(lmax * self._snd_chnls):
- j = i / self._snd_chnls
- self._base_objs.append(SfMarkerLoop_base(wrap(self._base_players,j), i % self._snd_chnls, wrap(mul,j), wrap(add,j)))
-
- def __dir__(self):
- return ['speed', 'mark', 'interp', 'mul', 'add']
-
- def setSpeed(self, x):
- """
- Replace the `speed` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `speed` attribute.
-
- """
- self._speed = x
- x, lmax = convertArgsToLists(x)
- [obj.setSpeed(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setMark(self, x):
- """
- Replace the `mark` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `mark` attribute.
-
- """
- self._mark = x
- x, lmax = convertArgsToLists(x)
- [obj.setMark(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int {1, 2, 3, 4}
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def getMarkers(self):
- """
- Returns a list of marker time values in samples.
-
- """
- return self._markers
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0.01, 2., 'lin', 'speed', self._speed),
- SLMap(0, len(self._markers)-1, 'lin', 'mark', self._mark, 'int'),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def speed(self):
- """float or PyoObject. Transposition factor."""
- return self._speed
- @speed.setter
- def speed(self, x): self.setSpeed(x)
-
- @property
- def mark(self):
- """float or PyoObject. Marker to loop."""
- return self._marker
- @mark.setter
- def mark(self, x): self.setMark(x)
-
- @property
- def interp(self):
- """int {1, 2, 3, 4}. Interpolation method."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/randoms.py b/build/lib.linux-x86_64-2.7/pyolib/randoms.py
deleted file mode 100644
index 25f964b..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/randoms.py
+++ /dev/null
@@ -1,1305 +0,0 @@
-"""
-Set of objects that implement different kinds of random noise generators.
-
-"""
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-import sys
-from _core import *
-from _maps import *
-from types import StringType, ListType
-
-class Randi(PyoObject):
- """
- Periodic pseudo-random generator with interpolation.
-
- Randi generates a pseudo-random number between `min` and `max`
- values at a frequency specified by `freq` parameter. Randi will
- produce straight-line interpolation between current number and the next.
-
- Parentclass: PyoObject
-
- Parameters:
-
- min : float or PyoObject, optional
- Minimum value for the random generation. Defaults to 0.
- max : float or PyoObject, optional
- Maximum value for the random generation. Defaults to 1.
- freq : float or PyoObject, optional
- Polling frequency. Defaults to 1.
-
- Methods:
-
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
- setFreq(x) : Replace the `freq` attribute.
-
- Attributes:
-
- min : float or PyoObject. Minimum value.
- max : float or PyoObject. Maximum value.
- freq : float or PyoObject. Polling frequency.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> freq = Randi(500, 3000, 4)
- >>> noze = Noise().mix(2)
- >>> a = Biquad(noze, freq=freq, q=5, type=2, mul=.5).out()
-
- """
- def __init__(self, min=0., max=1., freq=1., mul=1, add=0):
- PyoObject.__init__(self)
- self._min = min
- self._max = max
- self._freq = freq
- self._mul = mul
- self._add = add
- min, max, freq, mul, add, lmax = convertArgsToLists(min, max, freq, mul, add)
- self._base_objs = [Randi_base(wrap(min,i), wrap(max,i), wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['min', 'max', 'freq', 'mul', 'add']
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._port = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(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', 'min', self._min),
- SLMap(1., 2., 'lin', 'max', self._max),
- SLMap(0.1, 20., 'lin', 'freq', self._freq),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def min(self): return self._min
- @min.setter
- def min(self, x): self.setMin(x)
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
- @property
- def freq(self): return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
-class Randh(PyoObject):
- """
- Periodic pseudo-random generator.
-
- Randh generates a pseudo-random number between `min` and `max`
- values at a frequency specified by `freq` parameter. Randh will
- hold generated value until next generation.
-
- Parentclass: PyoObject
-
- Parameters:
-
- min : float or PyoObject, optional
- Minimum value for the random generation. Defaults to 0.
- max : float or PyoObject, optional
- Maximum value for the random generation. Defaults to 1.
- freq : float or PyoObject, optional
- Polling frequency. Defaults to 1.
-
- Methods:
-
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
- setFreq(x) : Replace the `freq` attribute.
-
- Attributes:
-
- min : float or PyoObject. Minimum value.
- max : float or PyoObject. Maximum value.
- freq : float or PyoObject. Polling frequency.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> freq = Randh(500, 3000, 4)
- >>> noze = Noise().mix(2)
- >>> a = Biquad(noze, freq=freq, q=5, type=2, mul=.5).out()
-
- """
- def __init__(self, min=0., max=1., freq=1., mul=1, add=0):
- PyoObject.__init__(self)
- self._min = min
- self._max = max
- self._freq = freq
- self._mul = mul
- self._add = add
- min, max, freq, mul, add, lmax = convertArgsToLists(min, max, freq, mul, add)
- self._base_objs = [Randh_base(wrap(min,i), wrap(max,i), wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['min', 'max', 'freq', 'mul', 'add']
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._port = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(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', 'min', self._min),
- SLMap(1., 2., 'lin', 'max', self._max),
- SLMap(0.1, 20., 'lin', 'freq', self._freq),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def min(self): return self._min
- @min.setter
- def min(self, x): self.setMin(x)
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
- @property
- def freq(self): return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
-class Choice(PyoObject):
- """
- Periodically choose a new value from a user list.
-
- Choice chooses a new value from a predefined list of floats `choice`
- at a frequency specified by `freq` parameter. Choice will
- hold choosen value until next generation.
-
- Parentclass: PyoObject
-
- Parameters:
-
- choice : list of floats or list of lists of floats
- Possible values for the random generation.
- freq : float or PyoObject, optional
- Polling frequency. Defaults to 1.
-
- Methods:
-
- setChoice(x) : Replace the `choice` attribute.
- setFreq(x) : Replace the `freq` attribute.
-
- Attributes:
-
- choice : list of floats or list of lists of floats. Possible choices.
- freq : float or PyoObject. Polling frequency.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> freqs = midiToHz([60,62,64,65,67,69,71,72])
- >>> rnd = Choice(choice=freqs, freq=[3,4])
- >>> a = SineLoop(rnd, feedback=0.05, mul=.2).out()
-
- """
- def __init__(self, choice, freq=1., mul=1, add=0):
- PyoObject.__init__(self)
- if type(choice) != ListType:
- print >> sys.stderr, 'TypeError: "choice" argument of %s must be a list.\n' % self.__class__.__name__
- exit()
- self._choice = choice
- self._freq = freq
- self._mul = mul
- self._add = add
- freq, mul, add, lmax = convertArgsToLists(freq, mul, add)
- if type(choice[0]) != ListType:
- self._base_objs = [Choice_base(choice, wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- else:
- choicelen = len(choice)
- lmax = max(choicelen, lmax)
- self._base_objs = [Choice_base(wrap(choice,i), wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['choice', 'freq', 'mul', 'add']
-
- def setChoice(self, x):
- """
- Replace the `choice` attribute.
-
- Parameters:
-
- x : list of floats or list of lists of floats
- new `choice` attribute.
-
- """
- self._choice = x
- if type(x[0]) != ListType:
- [obj.setChoice(self._choice) for i, obj in enumerate(self._base_objs)]
- else:
- [obj.setChoice(wrap(self._choice,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(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, 20., 'lin', 'freq', self._freq), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def choice(self): return self._choice
- @choice.setter
- def choice(self, x): self.setChoice(x)
- @property
- def freq(self): return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
-class RandInt(PyoObject):
- """
- Periodic pseudo-random integer generator.
-
- RandInt generates a pseudo-random integer number between 0 and `max`
- values at a frequency specified by `freq` parameter. RandInt will
- hold generated value until the next generation.
-
- Parentclass: PyoObject
-
- Parameters:
-
- max : float or PyoObject, optional
- Maximum value for the random generation. Defaults to 100.
- freq : float or PyoObject, optional
- Polling frequency. Defaults to 1.
-
- Methods:
-
- setMax(x) : Replace the `max` attribute.
- setFreq(x) : Replace the `freq` attribute.
-
- Attributes:
-
- max : float or PyoObject. Maximum value.
- freq : float or PyoObject. Polling frequency.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> freq = RandInt(max=10, freq=5, mul=100, add=500)
- >>> jit = Randi(min=0.99, max=1.01, freq=[2.33,3.41])
- >>> a = SineLoop(freq*jit, feedback=0.03, mul=.2).out()
-
- """
- def __init__(self, max=100, freq=1., mul=1, add=0):
- PyoObject.__init__(self)
- self._max = max
- self._freq = freq
- self._mul = mul
- self._add = add
- max, freq, mul, add, lmax = convertArgsToLists(max, freq, mul, add)
- self._base_objs = [RandInt_base(wrap(max,i), wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['max', 'freq', 'mul', 'add']
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(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(1., 2., 'lin', 'max', self._max),
- SLMap(0.1, 20., 'lin', 'freq', self._freq),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
- @property
- def freq(self): return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
-class RandDur(PyoObject):
- """
- Recursive time varying pseudo-random generator.
-
- RandDur generates a pseudo-random number between `min` and `max`
- arguments and uses that number to set the delay time before the next
- generation. RandDur will hold the generated value until next generation.
-
- Parentclass: PyoObject
-
- Parameters:
-
- min : float or PyoObject, optional
- Minimum value for the random generation. Defaults to 0.
- max : float or PyoObject, optional
- Maximum value for the random generation. Defaults to 1.
-
- Methods:
-
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
-
- Attributes:
-
- min : float or PyoObject. Minimum value.
- max : float or PyoObject. Maximum value.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> dur = RandDur(min=[.05,0.1], max=[.4,.5])
- >>> trig = Change(dur)
- >>> amp = TrigEnv(trig, table=HannTable(), dur=dur, mul=.2)
- >>> freqs = midiToHz([60,63,67,70,72])
- >>> freq = TrigChoice(trig, choice=freqs)
- >>> a = LFO(freq=freq, type=2, mul=amp).out()
-
- """
- def __init__(self, min=0., max=1., mul=1, add=0):
- PyoObject.__init__(self)
- self._min = min
- self._max = max
- self._mul = mul
- self._add = add
- min, max, mul, add, lmax = convertArgsToLists(min, max, mul, add)
- self._base_objs = [RandDur_base(wrap(min,i), wrap(max,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['min', 'max', 'mul', 'add']
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(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', 'min', self._min),
- SLMap(1., 2., 'lin', 'max', self._max),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def min(self): return self._min
- @min.setter
- def min(self, x): self.setMin(x)
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
-
-class Xnoise(PyoObject):
- """
- X-class pseudo-random generator.
-
- Xnoise implements a few of the most common noise distributions.
- Each distribution generates values in the range 0 and 1.
-
- Parentclass: PyoObject
-
- Notes:
-
- Available distributions are:
- - uniform
- - linear minimum
- - linear maximum
- - triangular
- - exponential minimum
- - exponential maximum
- - double (bi)exponential
- - cauchy
- - weibull
- - gaussian
- - poisson
- - walker (drunk)
- - loopseg (drunk with looped segments)
-
- Depending on the distribution, `x1` and `x2` parameters are applied
- as follow (names as string, or associated number can be used as `dist`
- parameter):
- 0 - uniform
- no parameter
- 1 - linear_min
- no parameter
- 2 - linear_max
- no parameter
- 3 - triangle
- no parameter
- 4 - expon_min
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 5 - expon_max
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 6 - biexpon
- x1 : bandwidth {0 = huge bandwidth -> 10 = narrow bandwidth}
- 7 - cauchy
- x1 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 8 - weibull
- x1 : mean location {0 -> 1}
- x2 : shape {0.5 = linear min, 1.5 = expon min, 3.5 = gaussian}
- 9 - gaussian
- x1 : mean location {0 -> 1}
- x2 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 10 - poisson
- x1 : gravity center {0 = low values -> 10 = high values}
- x2 : compress/expand range {0.1 = full compress -> 4 full expand}
- 11 - walker
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
- 12 - loopseg
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
-
- Parameters:
-
- dist : string or int, optional
- Distribution type. Defaults to 0.
- freq : float or PyoObject, optional
- Polling frequency. Defaults to 1.
- x1 : float or PyoObject, optional
- First parameter. Defaults to 0.5.
- x2 : float or PyoObject, optional
- Second parameter. Defaults to 0.5.
-
- Methods:
-
- setDist(x) : Replace the `dist` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setX1(x) : Replace the `x1` attribute.
- setX2(x) : Replace the `x2` attribute.
-
- Attributes:
-
- dist : string or int. Distribution type.
- freq : float or PyoObject. Polling frequency.
- x1 : float or PyoObject. First parameter.
- x2 : float or PyoObject. Second parameter.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> lfo = Phasor(.1, 0, .5, .15)
- >>> freq = Xnoise(dist=12, freq=8, x1=1, x2=lfo, mul=1000, add=500)
- >>> jit = Randi(min=0.99, max=1.01, freq=[2.33,3.41])
- >>> a = SineLoop(freq*jit, feedback=0.03, mul=.2).out()
-
- """
- def __init__(self, dist=0, freq=1., x1=0.5, x2=0.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._dist = dist
- self._freq = freq
- self._x1 = x1
- self._x2 = x2
- self._mul = mul
- self._add = add
- dist, freq, x1, x2, mul, add, lmax = convertArgsToLists(dist, freq, x1, x2, mul, add)
- for i, t in enumerate(dist):
- if type(t) == StringType: dist[i] = XNOISE_DICT.get(t, 0)
- self._base_objs = [Xnoise_base(wrap(dist,i), wrap(freq,i), wrap(x1,i), wrap(x2,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['dist', 'freq', 'x1', 'x2', 'mul', 'add']
-
- def setDist(self, x):
- """
- Replace the `dist` attribute.
-
- Parameters:
-
- x : int
- new `dist` attribute.
-
- """
- self._dist = x
- x, lmax = convertArgsToLists(x)
- for i, t in enumerate(x):
- if type(t) == StringType: x[i] = XNOISE_DICT.get(t, 0)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX1(self, x):
- """
- Replace the `x1` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x1` attribute.
-
- """
- self._x1 = x
- x, lmax = convertArgsToLists(x)
- [obj.setX1(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX2(self, x):
- """
- Replace the `x2` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x2` attribute.
-
- """
- self._x2= x
- x, lmax = convertArgsToLists(x)
- [obj.setX2(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._port = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def dist(self): return self._dist
- @dist.setter
- def dist(self, x): self.setDist(x)
- @property
- def freq(self): return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
- @property
- def x1(self): return self._x1
- @x1.setter
- def x1(self, x): self.setX1(x)
- @property
- def x2(self): return self._x2
- @x2.setter
- def x2(self, x): self.setX2(x)
-
-class XnoiseMidi(PyoObject):
- """
- X-class midi notes pseudo-random generator.
-
- XnoiseMidi implements a few of the most common noise distributions.
- Each distribution generates integer values in the range defined with
- `mrange` parameter and output can be scaled on midi notes, hertz or
- transposition factor.
-
- Parentclass: PyoObject
-
- Notes:
-
- Available distributions are:
- - uniform
- - linear minimum
- - linear maximum
- - triangular
- - exponential minimum
- - exponential maximum
- - double (bi)exponential
- - cauchy
- - weibull
- - gaussian
- - poisson
- - walker (drunk)
- - loopseg (drunk with looped segments)
-
- Depending on the distribution, `x1` and `x2` parameters are applied
- as follow (names as string, or associated number can be used as `dist`
- parameter):
- 0 - uniform
- no parameter
- 1 - linear_min
- no parameter
- 2 - linear_max
- no parameter
- 3 - triangle
- no parameter
- 4 - expon_min
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 5 - expon_max
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 6 - biexpon
- x1 : bandwidth {0 = huge bandwidth -> 10 = narrow bandwidth}
- 7 - cauchy
- x1 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 8 - weibull
- x1 : mean location {0 -> 1}
- x2 : shape {0.5 = linear min, 1.5 = expon min, 3.5 = gaussian}
- 9 - gaussian
- x1 : mean location {0 -> 1}
- x2 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 10 - poisson
- x1 : gravity center {0 = low values -> 10 = high values}
- x2 : compress/expand range {0.1 = full compress -> 4 full expand}
- 11 - walker
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
- 12 - loopseg
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
-
- Parameters:
-
- dist : string or int, optional
- Distribution type. Defaults to 0.
- freq : float or PyoObject, optional
- Polling frequency. Defaults to 1.
- x1 : float or PyoObject, optional
- First parameter. Defaults to 0.5.
- x2 : float or PyoObject, optional
- Second parameter. Defaults to 0.5.
- scale : int {0, 1, 2}, optional
- Output format. 0 = Midi, 1 = Hertz, 2 = transposition factor.
- In the transposition mode, the central key (the key where there
- is no transposition) is (`minrange` + `maxrange`) / 2. Defaults
- to 0.
- mrange : tuple of int, optional
- Minimum and maximum possible values, in Midi notes. Available
- only at initialization time. Defaults to (0, 127).
-
- Methods:
-
- setDist(x) : Replace the `dist` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setX1(x) : Replace the `x1` attribute.
- setX2(x) : Replace the `x2` attribute.
- setScale(x) : Replace the `scale` attribute.
- setRange(x, y) : Changes min and max range values and centralkey.
-
- Attributes:
-
- dist : string or int. Distribution type.
- freq : float or PyoObject. Polling frequency.
- x1 : float or PyoObject. First parameter.
- x2 : float or PyoObject. Second parameter.
- scale : int. Output format.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> l = Phasor(.4)
- >>> rnd = XnoiseMidi('loopseg', freq=8, x1=1, x2=l, scale=0, mrange=(60,96))
- >>> freq = Snap(rnd, choice=[0, 2, 3, 5, 7, 8, 11], scale=1)
- >>> jit = Randi(min=0.99, max=1.01, freq=[2.33,3.41])
- >>> a = SineLoop(freq*jit, feedback=0.03, mul=.2).out()
-
- """
- def __init__(self, dist=0, freq=1., x1=0.5, x2=0.5, scale=0, mrange=(0,127), mul=1, add=0):
- PyoObject.__init__(self)
- self._dist = dist
- self._freq = freq
- self._x1 = x1
- self._x2 = x2
- self._scale = scale
- self._mrange = mrange
- self._mul = mul
- self._add = add
- dist, freq, x1, x2, scale, mrange, mul, add, lmax = convertArgsToLists(dist, freq, x1, x2, scale, mrange, mul, add)
- for i, t in enumerate(dist):
- if type(t) == StringType: dist[i] = XNOISE_DICT.get(t, 0)
- self._base_objs = [XnoiseMidi_base(wrap(dist,i), wrap(freq,i), wrap(x1,i), wrap(x2,i), wrap(scale,i), wrap(mrange,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['dist', 'freq', 'x1', 'x2', 'scale', 'mul', 'add']
-
- def setDist(self, x):
- """
- Replace the `dist` attribute.
-
- Parameters:
-
- x : string or int
- new `dist` attribute.
-
- """
- self._dist = x
- x, lmax = convertArgsToLists(x)
- for i, t in enumerate(x):
- if type(t) == StringType: x[i] = XNOISE_DICT.get(t, 0)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setScale(self, x):
- """
- Replace the `scale` attribute.
-
- Possible values are:
- 0 -> Midi notes
- 1 -> Hertz
- 2 -> transposition factor
- (centralkey is (`minrange` + `maxrange`) / 2
-
- Parameters:
-
- x : int {0, 1, 2}
- new `scale` attribute.
-
- """
- self._scale = x
- x, lmax = convertArgsToLists(x)
- [obj.setScale(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRange(self, mini, maxi):
- """
- Replace the `mrange` attribute.
-
- Parameters:
-
- mini : int
- minimum output midi range.
- maxi : int
- maximum output midi range.
-
- """
- self._mrange = (mini, maxi)
- mini, maxi, lmax = convertArgsToLists(mini, maxi)
- [obj.setRange(wrap(mini,i), wrap(maxi,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX1(self, x):
- """
- Replace the `x1` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x1` attribute.
-
- """
- self._x1 = x
- x, lmax = convertArgsToLists(x)
- [obj.setX1(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX2(self, x):
- """
- Replace the `x2` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x2` attribute.
-
- """
- self._x2= x
- x, lmax = convertArgsToLists(x)
- [obj.setX2(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._port = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def dist(self): return self._dist
- @dist.setter
- def dist(self, x): self.setDist(x)
- @property
- def scale(self): return self._scale
- @scale.setter
- def scale(self, x): self.setScale(x)
- @property
- def freq(self): return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
- @property
- def x1(self): return self._x1
- @x1.setter
- def x1(self, x): self.setX1(x)
- @property
- def x2(self): return self._x2
- @x2.setter
- def x2(self, x): self.setX2(x)
-
-class XnoiseDur(PyoObject):
- """
- Recursive time varying X-class pseudo-random generator.
-
- Xnoise implements a few of the most common noise distributions.
- Each distribution generates values in the range 0 to 1, which are
- then rescaled between `min` and `max` arguments. The object uses
- the generated value to set the delay time before the next generation.
- XnoiseDur will hold the value until next generation.
-
- Parentclass: PyoObject
-
- Notes:
-
- Available distributions are:
- - uniform
- - linear minimum
- - linear maximum
- - triangular
- - exponential minimum
- - exponential maximum
- - double (bi)exponential
- - cauchy
- - weibull
- - gaussian
- - poisson
- - walker (drunk)
- - loopseg (drunk with looped segments)
-
- Depending on the distribution, `x1` and `x2` parameters are applied
- as follow (names as string, or associated number can be used as `dist`
- parameter):
- 0 - uniform
- no parameter
- 1 - linear_min
- no parameter
- 2 - linear_max
- no parameter
- 3 - triangle
- no parameter
- 4 - expon_min
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 5 - expon_max
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 6 - biexpon
- x1 : bandwidth {0 = huge bandwidth -> 10 = narrow bandwidth}
- 7 - cauchy
- x1 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 8 - weibull
- x1 : mean location {0 -> 1}
- x2 : shape {0.5 = linear min, 1.5 = expon min, 3.5 = gaussian}
- 9 - gaussian
- x1 : mean location {0 -> 1}
- x2 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 10 - poisson
- x1 : gravity center {0 = low values -> 10 = high values}
- x2 : compress/expand range {0.1 = full compress -> 4 full expand}
- 11 - walker
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
- 12 - loopseg
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
-
- Parameters:
-
- dist : string or int, optional
- Distribution type. Can be the name of the distribution as a string
- or its associated number. Defaults to 0.
- min : float or PyoObject, optional
- Minimum value for the random generation. Defaults to 0.
- max : float or PyoObject, optional
- Maximum value for the random generation. Defaults to 1.
- x1 : float or PyoObject, optional
- First parameter. Defaults to 0.5.
- x2 : float or PyoObject, optional
- Second parameter. Defaults to 0.5.
-
- Methods:
-
- setDist(x) : Replace the `dist` attribute.
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
- setX1(x) : Replace the `x1` attribute.
- setX2(x) : Replace the `x2` attribute.
-
- Attributes:
-
- dist : string or int. Distribution type.
- min : float or PyoObject. Minimum value.
- max : float or PyoObject. Maximum value.
- x1 : float or PyoObject. First parameter.
- x2 : float or PyoObject. Second parameter.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> dur = XnoiseDur(dist="expon_min", min=[.05,0.1], max=[.4,.5], x1=3)
- >>> trig = Change(dur)
- >>> amp = TrigEnv(trig, table=HannTable(), dur=dur, mul=.2)
- >>> freqs = midiToHz([60,63,67,70,72])
- >>> freq = TrigChoice(trig, choice=freqs)
- >>> a = LFO(freq=freq, type=2, mul=amp).out()
-
- """
- def __init__(self, dist=0, min=0., max=1., x1=0.5, x2=0.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._dist = dist
- self._min = min
- self._max = max
- self._x1 = x1
- self._x2 = x2
- self._mul = mul
- self._add = add
- dist, min, max, x1, x2, mul, add, lmax = convertArgsToLists(dist, min, max, x1, x2, mul, add)
- for i, t in enumerate(dist):
- if type(t) == StringType: dist[i] = XNOISE_DICT.get(t, 0)
- self._base_objs = [XnoiseDur_base(wrap(dist,i), wrap(min,i), wrap(max,i), wrap(x1,i), wrap(x2,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['dist', 'min', 'max', 'x1', 'x2', 'mul', 'add']
-
- def setDist(self, x):
- """
- Replace the `dist` attribute.
-
- Parameters:
-
- x : int
- new `dist` attribute.
-
- """
- self._dist = x
- x, lmax = convertArgsToLists(x)
- for i, t in enumerate(x):
- if type(t) == StringType: x[i] = XNOISE_DICT.get(t, 0)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX1(self, x):
- """
- Replace the `x1` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x1` attribute.
-
- """
- self._x1 = x
- x, lmax = convertArgsToLists(x)
- [obj.setX1(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX2(self, x):
- """
- Replace the `x2` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x2` attribute.
-
- """
- self._x2= x
- x, lmax = convertArgsToLists(x)
- [obj.setX2(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def dist(self): return self._dist
- @dist.setter
- def dist(self, x): self.setDist(x)
- @property
- def min(self): return self._min
- @min.setter
- def min(self, x): self.setMin(x)
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
- @property
- def x1(self): return self._x1
- @x1.setter
- def x1(self, x): self.setX1(x)
- @property
- def x2(self): return self._x2
- @x2.setter
- def x2(self, x): self.setX2(x)
-
-class Urn(PyoObject):
- """
- Periodic pseudo-random integer generator without duplicates.
-
- Urn generates a pseudo-random integer number between 0 and `max`
- values at a frequency specified by `freq` parameter. Urn will
- hold generated value until the next generation. Urn works like RandInt,
- except that it keeps track of each number which has been generated. After
- all numbers have been outputed, the pool is reseted and the object send
- a trigger signal.
-
- Parentclass: PyoObject
-
- Parameters:
-
- max : int, optional
- Maximum value for the random generation. Defaults to 100.
- freq : float or PyoObject, optional
- Polling frequency. Defaults to 1.
-
- Methods:
-
- setMax(x) : Replace the `max` attribute.
- setFreq(x) : Replace the `freq` attribute.
-
- Attributes:
-
- max : int. Maximum value.
- freq : float or PyoObject. Polling frequency.
-
- Notes:
-
- Urn will sends a trigger signal when the pool is empty.
- User can retreive the trigger streams by calling obj['trig'].
- Useful to synchronize other processes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> mid = Urn(max=12, freq=10, add=60)
- >>> fr = MToF(mid)
- >>> sigL = SineLoop(freq=fr, feedback=.08, mul=0.3).out()
- >>> amp = TrigExpseg(mid["trig"], [(0,0),(.01,.25),(1,0)])
- >>> sigR = SineLoop(midiToHz(84), feedback=0.05, mul=amp).out(1)
-
- """
- def __init__(self, max=100, freq=1., mul=1, add=0):
- PyoObject.__init__(self)
- self._max = max
- self._freq = freq
- self._mul = mul
- self._add = add
- max, freq, mul, add, lmax = convertArgsToLists(max, freq, mul, add)
- self._base_objs = [Urn_base(wrap(max,i), wrap(freq,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
-
- def __dir__(self):
- return ['max', 'freq', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : int
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(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(1., 2., 'lin', 'max', self._max),
- SLMap(0.1, 20., 'lin', 'freq', self._freq),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
- @property
- def freq(self): return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/server.py b/build/lib.linux-x86_64-2.7/pyolib/server.py
deleted file mode 100644
index a63282a..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/server.py
+++ /dev/null
@@ -1,557 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-import os
-from _core import *
-from _widgets import createServerGUI
-
-######################################################################
-### Proxy of Server object
-######################################################################
-class Server(object):
- """
- Main processing audio loop callback handler.
-
- The Server object handles all communications with Portaudio and
- Portmidi. It keeps track of all audio streams created as well as
- connections between them.
-
- An instance of the Server must be booted before defining any
- signal processing chain.
-
- Parameters:
-
- sr : int, optional
- Sampling rate used by Portaudio and the Server to compute samples.
- Defaults to 44100.
- nchnls : int, optional
- Number of input and output channels. Defaults to 2.
- buffersize : int, optional
- Number of samples that Portaudio will request from the callback loop.
- This value has an impact on CPU use (a small buffer size is harder
- to compute) and on the latency of the system. Latency is
- `buffer size / sampling rate` in seconds. Defaults to 256.
- duplex : int {0, 1}, optional
- Input - output mode. 0 is output only and 1 is both ways.
- Defaults to 1.
- audio : string {'portaudio', 'pa', 'jack', 'coreaudio', 'offline', 'offline_nb}, optional
- Audio backend to use. 'pa' is equivalent to 'portaudio'.
- 'offline' save the audio output in a soundfile as fast as possible in blocking mode,
- ie. the main program doesn't respond until the end of the computation.
- 'offline_nb' save the audio output in a soundfile as fast as possible in non-blocking
- mode, ie. the computation is executed in a separated thread, allowing the program to
- respond while the computation goes on. It is the responsibility of the user to make
- sure that the program doesn't exit before the computation is done.
- Default is 'portaudio'.
- jackname : string, optional
- Name of jack client. Defaults to 'pyo'
-
- Methods:
-
- setAmp(x) : Set the overall amplitude.
- boot() : Boot the server. Must be called before defining any signal
- processing chain.
- shutdown() : Shut down and clear the server.
- setStartOffset(x) : Set the starting time of the real-time processing.
- setGlobalSeed(x) : Set the server's global seed used by random objects.
- start() : Start the audio callback loop.
- stop() : Stop the audio callback loop.
- gui(locals, meter, timer) : Show the server's user interface.
- recordOptions(dur, filename, fileformat, sampletype) : Rendering settings.
- recstart(str) : Begins recording of the sound sent to output.
- This method creates a file called `pyo_rec.aif` in the
- user's home directory if a path is not supplied.
- recstop() : Stops previously started recording.
- getSamplingRate() : Returns the current sampling rate.
- getNchnls() : Returns the current number of channels.
- getBufferSize() : Returns the current buffer size.
- getGlobalSeed() : Returns the server's global seed.
- getIsStarted() : Returns 1 if the server is started, otherwise returns 0.
- getMidiActive() : Returns 1 if Midi callback is active, otherwise returns 0.
- getStreams() : Returns the list of Stream objects currently in the Server memory.
- getNumberOfStreams() : Returns the number of streams currently in the Server memory.
-
- The next methods must be called before booting the server
-
- setInOutDevice(x) : Set both input and output devices. See `pa_list_devices()`.
- setInputDevice(x) : Set the audio input device number. See `pa_list_devices()`.
- setOutputDevice(x) : Set the audio output device number. See `pa_list_devices()`.
- setMidiInputDevice(x) : Set the MIDI input device number. See `pm_list_devices()`.
- setSamplingRate(x) : Set the sampling rate used by the server.
- setBufferSize(x) : Set the buffer size used by the server.
- setNchnls(x) : Set the number of channels used by the server.
- setDuplex(x) : Set the duplex mode used by the server.
- setVerbosity(x) : Set the server's verbosity.
- reinit(sr, nchnls, buffersize, duplex, audio, jackname) : Reinit the server's settings.
-
- Attributes:
-
- amp : Overall amplitude of the Server. This value is applied on any
- stream sent to the soundcard.
- verbosity : Control the messages printed by the server. It is a sum of
- values to display different levels: 1 = error, 2 = message,
- 4 = warning , 8 = debug.
- startoffset : Starting time of the real-time processing.
- globalseed : Global seed used by random objects. Defaults to 0 (means always seed from the system clock).
-
- Examples:
-
- >>> # For an 8 channels server in duplex mode with
- >>> # a sampling rate of 48000 Hz and buffer size of 512
- >>> s = Server(sr=48000, nchnls=8, buffersize=512, duplex=1).boot()
- >>> s.start()
-
- """
- def __init__(self, sr=44100, nchnls=2, buffersize=256, duplex=1, audio='portaudio', jackname='pyo'):
- if os.environ.has_key("PYO_SERVER_AUDIO"):
- audio = os.environ["PYO_SERVER_AUDIO"]
- self._nchnls = nchnls
- self._amp = 1.
- self._verbosity = 7
- self._startoffset = 0
- self._dur = -1
- self._filename = None
- self._fileformat = 0
- self._sampletype = 0
- self._server = Server_base(sr, nchnls, buffersize, duplex, audio, jackname)
-
- def reinit(self, sr=44100, nchnls=2, buffersize=256, duplex=1, audio='portaudio', jackname='pyo'):
- """
- Reinit the server'settings. Useful to alternate between real-time and offline server.
-
- Parameters:
-
- Same as in the __init__ method.
-
- """
- self._nchnls = nchnls
- self._amp = 1.
- self._verbosity = 7
- self._startoffset = 0
- self._dur = -1
- self._filename = None
- self._fileformat = 0
- self._sampletype = 0
- self._globalseed = 0
- self._server.__init__(sr, nchnls, buffersize, duplex, audio, jackname)
-
- def gui(self, locals=None, meter=True, timer=True):
- """
- Show the server's user interface.
-
- Parameters:
-
- locals : locals namespace {locals(), None}, optional
- If locals() is given, the interface will show an interpreter extension,
- giving a way to interact with the running script. Defaults to None.
- meter : boolean, optinal
- If True, the interface will show a vumeter of the global output signal.
- Defaults to True.
- timer : boolean, optional
- If True, the interface will show a clock of the current time.
- Defaults to True.
-
- """
- f, win = createServerGUI(self._nchnls, self.start, self.stop, self.recstart, self.recstop,
- self.setAmp, self.getIsStarted(), locals, self.shutdown, meter, timer, self._amp)
- if meter:
- self._server.setAmpCallable(f)
- if timer:
- self._server.setTimeCallable(f)
- try:
- win.mainloop()
- except:
- if win != None:
- win.MainLoop()
-
- def setTimeCallable(self, func):
- self.setTime = func
- self._server.setTimeCallable(self)
-
- def setInOutDevice(self, x):
- """
- Set both input and output audio devices. See `pa_list_devices()`.
-
- Parameters:
-
- x : int
- Number of the audio input and output devices.
-
- """
- self._server.setInOutDevice(x)
-
- def setInputDevice(self, x):
- """
- Set the audio input device number. See `pa_list_devices()`.
-
- Parameters:
-
- x : int
- Number of the audio device listed by Portaudio.
-
- """
- self._server.setInputDevice(x)
-
- def setOutputDevice(self, x):
- """
- Set the audio output device number. See `pa_list_devices()`.
-
- Parameters:
-
- x : int
- Number of the audio device listed by Portaudio.
-
- """
- self._server.setOutputDevice(x)
-
- def setMidiInputDevice(self, x):
- """
- Set the Midi input device number. See `pm_list_devices()`.
-
- Parameters:
-
- x : int
- Number of the Midi device listed by Portmidi.
-
- """
- self._server.setMidiInputDevice(x)
-
- def setSamplingRate(self, x):
- """
- Set the sampling rate used by the server.
-
- Parameters:
-
- x : int
- New sampling rate, must be supported by the soundcard.
-
- """
- self._server.setSamplingRate(x)
-
- def setBufferSize(self, x):
- """
- Set the buffer size used by the server.
-
- Parameters:
-
- x : int
- New buffer size.
-
- """
- self._server.setBufferSize(x)
-
- def setNchnls(self, x):
- """
- Set the number of channels used by the server.
-
- Parameters:
-
- x : int
- New number of channels.
-
- """
- self._nchnls = x
- self._server.setNchnls(x)
-
- def setDuplex(self, x):
- """
- Set the duplex mode used by the server.
-
- Parameters:
-
- x : int {0 or 1}
- New mode. 0 is output only, 1 is both ways.
-
- """
- self._server.setDuplex(x)
-
- def setVerbosity(self, x):
- """
- Set the server's verbosity.
-
- Parameters:
-
- x : int
- A sum of values to display different levels: 1 = error, 2 = message,
- 4 = warning , 8 = debug.
- """
- self._verbosity = x
- self._server.setVerbosity(x)
-
- def setGlobalSeed(self, x):
- """
- Set the server's global seed used by random objects.
-
- Parameters:
-
- x : int
- A positive integer that will be used as the seed by random objects.
- If zero, randoms will be seeded with the system clock current value.
-
- """
- self._globalseed = x
- self._server.setGlobalSeed(x)
-
- def setStartOffset(self, x):
- """
- Set the server's starting time offset. First `x` seconds will be rendered
- offline as fast as possible.
-
- Parameters:
-
- x : float
- Starting time of the real-time processing.
-
- """
- self._startoffset = x
- self._server.setStartOffset(x)
-
- def setAmp(self, x):
- """
- Set the overall amplitude.
-
- Parameters:
-
- x : float
- New amplitude.
-
- """
- self._amp = x
- self._server.setAmp(x)
-
- def shutdown(self):
- """
- Shut down and clear the server. This method will erase all objects
- from the callback loop. This method need to be called before changing
- server's parameters like `samplingrate`, `buffersize`, `nchnls`, ...
-
- """
- self._server.shutdown()
-
- def boot(self):
- """
- Boot the server. Must be called before defining any signal processing
- chain. Server's parameters like `samplingrate`, `buffersize` or
- `nchnls` will be effective after a call to this method.
-
- """
- self._server.boot()
- return self
-
- def start(self):
- """
- Start the audio callback loop and begin processing.
-
- """
- self._server.start()
- return self
-
- def stop(self):
- """
- Stop the audio callback loop.
-
- """
- self._server.stop()
-
- def recordOptions(self, dur=-1, filename=None, fileformat=0, sampletype=0):
- """
- Sets options for soundfile created by offline rendering or global recording.
-
- Parameters:
-
- dur : float
- Duration, in seconds, of the recorded file. Only used by
- offline rendering. Must be positive. Defaults to -1.
- filename : string
- Full path of the file to create. If None, a file called
- `pyo_rec.wav` will be created in the user's home directory.
- Defaults to None.
- fileformat : int, optional
- Format type of the audio file. This function will first try to
- set the format from the filename extension. If it's not possible,
- it uses the fileformat parameter. Defaults to 0.
- Supported formats are:
- 0 : WAV - Microsoft WAV format (little endian) {.wav, .wave}
- 1 : AIFF - Apple/SGI AIFF format (big endian) {.aif, .aiff}
- sampletype : int, optional
- Bit depth encoding of the audio file. Defaults to 0.
- Supported types are:
- 0 : 16 bits int
- 1 : 24 bits int
- 2 : 32 bits int
- 3 : 32 bits float
- 4 : 64 bits float
-
- """
-
- FORMATS = {'wav': 0, 'wave': 0, 'aif': 1, 'aiff': 1}
- self._dur = dur
- if filename == None:
- filename = os.path.join(os.path.expanduser("~"), "pyo_rec.wav")
- self._filename = filename
- ext = filename.rsplit('.')
- if len(ext) >= 2:
- ext = ext[-1].lower()
- if FORMATS.has_key(ext):
- fileformat = FORMATS[ext]
- else:
- print 'Warning: Unknown file extension. Using fileformat value.'
- else:
- print 'Warning: Filename has no extension. Using fileformat value.'
- self._fileformat = fileformat
- self._sampletype = sampletype
- self._server.recordOptions(dur, filename, fileformat, sampletype)
-
- def recstart(self, filename=None):
- """
- Begins a default recording of the sound that is sent to the
- soundcard. This will create a file called `pyo_rec.wav` in
- the user's home directory if no path is supplied or defined
- with recordOptions method. Uses file format and sample type
- defined with recordOptions method.
-
- Parameters:
-
- filename : string, optional
- Name of the file to be created. Defaults to None.
-
- """
- FORMATS = {'wav': 0, 'wave': 0, 'aif': 1, 'aiff': 1}
- if filename == None:
- if self._filename != None:
- filename = self._filename
- else:
- filename = os.path.join(os.path.expanduser("~"), "pyo_rec.wav")
- ext = filename.rsplit('.')
- if len(ext) >= 2:
- ext = ext[-1].lower()
- if FORMATS.has_key(ext):
- fileformat = FORMATS[ext]
- if fileformat != self._fileformat:
- self._fileformat = fileformat
- self._server.recordOptions(self._dur, filename, self._fileformat, self._sampletype)
-
- self._server.recstart(filename)
-
- def recstop(self):
- """
- Stop the previously started recording.
-
- """
- self._server.recstop()
-
- def getStreams(self):
- """
- Return the list of streams loaded in the server.
-
- """
- return self._server.getStreams()
-
- def getSamplingRate(self):
- """
- Return the current sampling rate.
-
- """
- return self._server.getSamplingRate()
-
- def getNchnls(self):
- """
- Return the current number of channels.
-
- """
- return self._server.getNchnls()
-
- def getBufferSize(self):
- """
- Return the current buffer size.
-
- """
- return self._server.getBufferSize()
-
- def getGlobalSeed(self):
- """
- Return the current global seed.
-
- """
- return self._server.getGlobalSeed()
-
- def getIsStarted(self):
- """
- Returns 1 if the server is started, otherwise returns 0.
-
- """
- return self._server.getIsStarted()
-
- def getMidiActive(self):
- """
- Returns 1 if Midi callback is active, otherwise returns 0.
-
- """
- return self._server.getMidiActive()
-
- def getStreams(self):
- """
- Returns the list of Stream objects currently in the Server memory.
-
- """
- return self._server.getStreams()
-
- def getNumberOfStreams(self):
- """
- Returns the number of streams currently in the Server memory.
-
- """
- return len(self._server.getStreams())
-
- @property
- def amp(self):
- """float. Overall amplitude."""
- return self._amp
- @amp.setter
- def amp(self, x): self.setAmp(x)
-
- @property
- def startoffset(self):
- """float. Starting time of the real-time processing."""
- return self._startoffset
- @startoffset.setter
- def startoffset(self, x): self.setStartOffset(x)
-
- @property
- def verbosity(self):
- """int. Server verbosity."""
- return self._verbosity
- @verbosity.setter
- def verbosity(self, x):
- if (type(x) == int):
- self.setVerbosity(x)
- else:
- raise Exception("verbosity must be an integer")
-
- @property
- def globalseed(self):
- """int. Server global seed."""
- return self._globalseed
- @globalseed.setter
- def globalseed(self, x):
- if (type(x) == int):
- self.setGlobalSeed(x)
- else:
- raise Exception("global seed must be an integer")
diff --git a/build/lib.linux-x86_64-2.7/pyolib/snds/__init__.py b/build/lib.linux-x86_64-2.7/pyolib/snds/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/build/lib.linux-x86_64-2.7/pyolib/tableprocess.py b/build/lib.linux-x86_64-2.7/pyolib/tableprocess.py
deleted file mode 100644
index 3d150ff..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/tableprocess.py
+++ /dev/null
@@ -1,2630 +0,0 @@
-"""
-Set of objects to perform operations on PyoTableObjects.
-
-PyoTableObjects are 1 dimension containers. They can be used to
-store audio samples or algorithmic sequences for future uses.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-from types import SliceType
-
-class Osc(PyoObject):
- """
- A simple oscillator reading a waveform table.
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the waveform samples.
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 1000.
- phase : float or PyoObject, optional
- Phase of sampling, expressed as a fraction of a cycle (0 to 1).
- Defaults to 0.
- interp : int, optional
- Choice of the interpolation method. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setPhase(x) : Replace the `phase` attribute.
- setInterp(x) : Replace the `interp` attribute.
- reset() : Resets the reading pointer to 0.
-
- Attributes:
-
- table : PyoTableObject. Table containing the waveform samples.
- freq : float or PyoObject, Frequency in cycles per second.
- phase : float or PyoObject, Phase of sampling (0 -> 1).
- interp : int {1, 2, 3, 4}, Interpolation method.
-
- See also: Phasor, Sine
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = HarmTable([1,0,.33,0,.2,0,.143,0,.111,0,.091])
- >>> a = Osc(table=t, freq=[100,99.2], mul=.2).out()
-
- """
- def __init__(self, table, freq=1000, phase=0, interp=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._freq = freq
- self._phase = phase
- self._interp = interp
- self._mul = mul
- self._add = add
- table, freq, phase, interp, mul, add, lmax = convertArgsToLists(table, freq, phase, interp, mul, add)
- self._base_objs = [Osc_base(wrap(table,i), wrap(freq,i), wrap(phase,i), wrap(interp,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'freq', 'phase', 'interp', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPhase(self, x):
- """
- Replace the `phase` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `phase` attribute.
-
- """
- self._phase = x
- x, lmax = convertArgsToLists(x)
- [obj.setPhase(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int {1, 2, 3, 4}
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self):
- """
- Resets current phase to 0.
-
- """
- [obj.reset() for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq),
- SLMapPhase(self._phase),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the waveform samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def phase(self):
- """float or PyoObject. Phase of sampling."""
- return self._phase
- @phase.setter
- def phase(self, x): self.setPhase(x)
-
- @property
- def interp(self):
- """int {1, 2, 3, 4}. Interpolation method."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
-class OscLoop(PyoObject):
- """
- A simple oscillator with feedback reading a waveform table.
-
- OscLoop reads a waveform table with linear interpolation and feedback control.
- The oscillator output, multiplied by `feedback`, is added to the position
- increment and can be used to control the brightness of the oscillator.
-
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the waveform samples.
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 1000.
- feedback : float or PyoObject, optional
- Amount of the output signal added to position increment, between 0 and 1.
- Controls the brightness. Defaults to 0.
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setFeedback(x) : Replace the `feedback` attribute.
-
- Attributes:
-
- table : PyoTableObject. Table containing the waveform samples.
- freq : float or PyoObject, Frequency in cycles per second.
- feedback : float or PyoObject, Brightness control.
-
- See also: Osc, SineLoop
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = HarmTable([1,0,.33,0,.2,0,.143])
- >>> lfo = Sine(.5, 0, .05, .05)
- >>> a = OscLoop(table=t, freq=[100,99.3], feedback=lfo, mul=.2).out()
-
- """
- def __init__(self, table, freq=1000, feedback=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._freq = freq
- self._feedback = feedback
- self._mul = mul
- self._add = add
- table, freq, feedback, mul, add, lmax = convertArgsToLists(table, freq, feedback, mul, add)
- self._base_objs = [OscLoop_base(wrap(table,i), wrap(freq,i), wrap(feedback,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'freq', 'feedback', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFeedback(self, x):
- """
- Replace the `feedback` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `feedback` attribute.
-
- """
- self._feedback = x
- x, lmax = convertArgsToLists(x)
- [obj.setFeedback(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq),
- SLMap(0, 1, "lin", "feedback", self._feedback),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the waveform samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def feedback(self):
- """float or PyoObject. Brightness control."""
- return self._feedback
- @feedback.setter
- def feedback(self, x): self.setFeedback(x)
-
-class OscTrig(PyoObject):
- """
- An oscillator reading a waveform table with sample accurate reset signal.
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the waveform samples.
- trig : PyoObject
- Trigger signal. Reset the table pointer position to zero on
- each trig.
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 1000.
- phase : float or PyoObject, optional
- Phase of sampling, expressed as a fraction of a cycle (0 to 1).
- Defaults to 0.
- interp : int, optional
- Choice of the interpolation method. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setTrig(x) : Replace the `trig` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setPhase(x) : Replace the `phase` attribute.
- setInterp(x) : Replace the `interp` attribute.
- reset() : Resets the reading pointer to 0.
-
- Attributes:
-
- table : PyoTableObject. Table containing the waveform samples.
- trig : PyoObject, Trigger signal, reset pointer position to zero.
- freq : float or PyoObject, Frequency in cycles per second.
- phase : float or PyoObject, Phase of sampling (0 -> 1).
- interp : int {1, 2, 3, 4}, Interpolation method.
-
- See also: Osc, Phasor, Sine
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> tab = SndTable(SNDS_PATH+"/transparent.aif")
- >>> tim = Phasor([-0.2,-0.25], mul=tab.getDur()-0.005, add=0.005)
- >>> rst = Metro(tim).play()
- >>> a = OscTrig(tab, rst, freq=tab.getRate(), mul=.4).out()
-
- """
- def __init__(self, table, trig, freq=1000, phase=0, interp=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._trig = trig
- self._freq = freq
- self._phase = phase
- self._interp = interp
- self._mul = mul
- self._add = add
- table, trig, freq, phase, interp, mul, add, lmax = convertArgsToLists(table, trig, freq, phase, interp, mul, add)
- self._base_objs = [OscTrig_base(wrap(table,i), wrap(trig,i), wrap(freq,i), wrap(phase,i), wrap(interp,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'trig', 'freq', 'phase', 'interp', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setTrig(self, x):
- """
- Replace the `trig` attribute.
-
- Parameters:
-
- x : PyoObject
- new `trig` attribute.
-
- """
- self._trig = x
- x, lmax = convertArgsToLists(x)
- [obj.setTrig(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPhase(self, x):
- """
- Replace the `phase` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `phase` attribute.
-
- """
- self._phase = x
- x, lmax = convertArgsToLists(x)
- [obj.setPhase(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int {1, 2, 3, 4}
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self):
- """
- Resets current phase to 0.
-
- """
- [obj.reset() for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq),
- SLMapPhase(self._phase),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the waveform samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def trig(self):
- """PyoObject. Trigger signal. Reset pointer position to zero"""
- return self._trig
- @trig.setter
- def trig(self, x): self.setTrig(x)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def phase(self):
- """float or PyoObject. Phase of sampling."""
- return self._phase
- @phase.setter
- def phase(self, x): self.setPhase(x)
-
- @property
- def interp(self):
- """int {1, 2, 3, 4}. Interpolation method."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
-class OscBank(PyoObject):
- """
- Any number of oscillators reading a waveform table.
-
- OscBank mixes the output of any number of oscillators. The frequencies
- of each oscillator is controlled with two parameters, the base frequency
- `freq` and a coefficient of expansion `spread`. Frequencies are computed
- with the following formula (`n` is the order of the partial):
-
- f_n = freq + freq * spread * n
-
- The frequencies and amplitudes can be modulated by two random generators
- with interpolation (each partial have a different set of randoms).
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the waveform samples.
- freq : float or PyoObject, optional
- Base frequency in cycles per second. Defaults to 100.
- spread : float or PyoObject, optional
- Coefficient of expansion used to compute partial frequencies.
- If `spread` is 0, all partials will be at the base frequency.
- A value of 1 will generate integer harmonics, a value of 2
- will skip even harmonics and non-integer values will generate
- different series of inharmonic frequencies. Defaults to 1.
- slope : float or PyoObject, optional
- specifies the multiplier in the series of amplitude coefficients.
- This is a power series: the nth partial will have an amplitude of
- (slope ** n), i.e. strength values trace an exponential curve.
- Defaults to 1.
- frndf : float or PyoObject, optional
- Frequency, in cycle per second, of the frequency modulations.
- Defaults to 1.
- frnda : float or PyoObject, optional
- Maximum frequency deviation (positive and negative) in portion of
- the partial frequency. A value of 1 means that the frequency can
- drift from 0 Hz to twice the partial frequency. A value of 0
- deactivates the frequency deviations. Defaults to 0.
- arndf : float or PyoObject, optional
- Frequency, in cycle per second, of the amplitude modulations.
- Defaults to 1.
- arnda : float or PyoObject, optional
- Amount of amplitude deviation. 0 deactivates the amplitude
- modulations and 1 gives full amplitude modulations.
- Defaults to 0.
- num : int, optional
- Number of oscillators. Available at initialization only.
- Defaults to 24.
- fjit : boolean, optional
- If True, a small jitter is added to the frequency of each partial.
- For a large number of oscillators and a very small `spread`, the
- periodicity between partial frequencies can cause very strange
- artefact. Adding a jitter breaks the periodicity. Defaults to False.
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setSpread(x) : Replace the `spread` attribute.
- setSlope(x) : Replace the `slope` attribute.
- setFrndf(x) : Replace the `frndf` attribute.
- setFrnda(x) : Replace the `frnda` attribute.
- setArndf(x) : Replace the `arndf` attribute.
- setArnda(x) : Replace the `arnda` attribute.
- setFjit(x) : Replace the `fjit` attribute.
-
- Attributes:
-
- table : PyoTableObject. Table containing the waveform samples.
- freq : float or PyoObject, Base frequency in cycles per second.
- spread : float or PyoObject, Coefficient of expansion.
- slope : float or PyoObject, Multiplier in the series of amplitudes.
- frndf : float or PyoObject, Frequency of the frequency modulations.
- frnda : float or PyoObject, Maximum frequency deviation from 0 to 1.
- arndf : float or PyoObject, Frequency of the amplitude modulations.
- arnda : float or PyoObject, Amount of amplitude deviation from 0 to 1.
- fjit : boolean, Jitter added to the parial frequencies.
-
- See also: Osc
-
- Notes:
-
- Altough parameters can be audio signals, values are sampled only once
- per buffer size. To avoid artefacts, it is recommended to keep variations
- at low rate (< 20 Hz).
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> ta = HarmTable([1,.3,.2])
- >>> tb = HarmTable([1])
- >>> f = Fader(fadein=.1).play()
- >>> a = OscBank(ta,100,spread=0,frndf=.25,frnda=.01,num=[10,10],fjit=True,mul=f*0.5).out()
- >>> b = OscBank(tb,250,spread=.25,slope=.8,arndf=4,arnda=1,num=[10,10],mul=f*0.4).out()
-
- """
- def __init__(self, table, freq=100, spread=1, slope=.9, frndf=1, frnda=0, arndf=1, arnda=0, num=24, fjit=False, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._freq = freq
- self._spread = spread
- self._slope = slope
- self._frndf = frndf
- self._frnda = frnda
- self._arndf = arndf
- self._arnda = arnda
- self._fjit = fjit
- self._num = num
- self._mul = mul
- self._add = add
- table, freq, spread, slope, frndf, frnda, arndf, arnda, num, fjit, mul, add, lmax = convertArgsToLists(table, freq, spread, slope, frndf, frnda, arndf, arnda, num, fjit, mul, add)
- self._base_objs = [OscBank_base(wrap(table,i), wrap(freq,i), wrap(spread,i), wrap(slope,i), wrap(frndf,i), wrap(frnda,i), wrap(arndf,i), wrap(arnda,i), wrap(num,i), wrap(fjit,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'freq', 'spread', 'slope', 'frndf', 'frnda', 'arndf', 'arnda', 'fjit', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSpread(self, x):
- """
- Replace the `spread` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `spread` attribute.
-
- """
- self._spread = x
- x, lmax = convertArgsToLists(x)
- [obj.setSpread(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSlope(self, x):
- """
- Replace the `slope` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `slope` attribute.
-
- """
- self._slope = x
- x, lmax = convertArgsToLists(x)
- [obj.setSlope(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFrndf(self, x):
- """
- Replace the `frndf` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `frndf` attribute.
-
- """
- self._frndf = x
- x, lmax = convertArgsToLists(x)
- [obj.setFrndf(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFrnda(self, x):
- """
- Replace the `frnda` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `frnda` attribute.
-
- """
- self._frnda = x
- x, lmax = convertArgsToLists(x)
- [obj.setFrnda(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setArndf(self, x):
- """
- Replace the `arndf` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `arndf` attribute.
-
- """
- self._arndf = x
- x, lmax = convertArgsToLists(x)
- [obj.setArndf(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setArnda(self, x):
- """
- Replace the `arnda` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `arnda` attribute.
-
- """
- self._arnda = x
- x, lmax = convertArgsToLists(x)
- [obj.setArnda(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFjit(self, x):
- """
- Replace the `fjit` attribute.
-
- Parameters:
-
- x : boolean
- new `fjit` attribute.
-
- """
- self._fjit = x
- x, lmax = convertArgsToLists(x)
- [obj.setFjit(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.001, 15000, "log", "freq", self._freq),
- SLMap(0.001, 2, "log", "spread", self._spread),
- SLMap(0, 1, "lin", "slope", self._slope),
- SLMap(0.001, 20, "log", "frndf", self._frndf),
- SLMap(0, 1, "lin", "frnda", self._frnda),
- SLMap(0.001, 20, "log", "arndf", self._arndf),
- SLMap(0, 1, "lin", "arnda", self._arnda),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the waveform samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def spread(self):
- """float or PyoObject. Frequency expansion factor."""
- return self._spread
- @spread.setter
- def spread(self, x): self.setSpread(x)
-
- @property
- def slope(self):
- """float or PyoObject. Multiplier in the series of amplitudes."""
- return self._slope
- @slope.setter
- def slope(self, x): self.setSlope(x)
-
- @property
- def frndf(self):
- """float or PyoObject. Frequency of the frequency modulations."""
- return self._frndf
- @frndf.setter
- def frndf(self, x): self.setFrndf(x)
-
- @property
- def frnda(self):
- """float or PyoObject. Maximum frequency deviation from 0 to 1."""
- return self._frnda
- @frnda.setter
- def frnda(self, x): self.setFrnda(x)
-
- @property
- def arndf(self):
- """float or PyoObject. Frequency of the amplitude modulations."""
- return self._arndf
- @arndf.setter
- def arndf(self, x): self.setArndf(x)
-
- @property
- def arnda(self):
- """float or PyoObject. Amount of amplitude deviation from 0 to 1."""
- return self._arnda
- @arnda.setter
- def arnda(self, x): self.setArnda(x)
-
- @property
- def fjit(self):
- """boolean. Jitter added to the parial frequencies."""
- return self._fjit
- @fjit.setter
- def fjit(self, x): self.setFjit(x)
-
-class TableRead(PyoObject):
- """
- Simple waveform table reader.
-
- Read sampled sound from a table, with optional looping mode.
-
- The play() method starts the playback and is not called at the
- object creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the waveform samples.
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 1.
- loop : int {0, 1}, optional
- Looping mode, 0 means off, 1 means on.
- Defaults to 0.
- interp : int, optional
- Choice of the interpolation method. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setLoop(x) : Replace the `loop` attribute.
- setInterp(x) : Replace the `interp` attribute.
- reset() : Resets the reading pointer to 0.
-
- Attributes:
-
- table : PyoTableObject. Table containing the waveform samples.
- freq : float or PyoObject, Frequency in cycles per second.
- loop : int, Looping mode.
- interp : int {1, 2, 3, 4}, Interpolation method.
-
- Notes:
-
- TableRead will sends a trigger signal at the end of the playback if
- loop is off or any time it wraps around if loop is on. User can
- retreive the trigger streams by calling obj['trig']:
-
- >>> tabr = TableRead(SNDS_PATH + "/transparent.aif").out()
- >>> trig = TrigRand(tab['trig'])
-
- See also: Osc
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> snd = SndTable(SNDS_PATH + '/transparent.aif')
- >>> freq = snd.getRate()
- >>> a = TableRead(table=snd, freq=[freq,freq*.99], loop=True, mul=.3).out()
-
- """
- def __init__(self, table, freq=1, loop=0, interp=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._freq = freq
- self._loop = loop
- self._interp = interp
- self._mul = mul
- self._add = add
- table, freq, loop, interp, mul, add, lmax = convertArgsToLists(table, freq, loop, interp, mul, add)
- self._base_objs = [TableRead_base(wrap(table,i), wrap(freq,i), wrap(loop,i), wrap(interp,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
-
- def __dir__(self):
- return ['table', 'freq', 'loop', 'interp', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setLoop(self, x):
- """
- Replace the `loop` attribute.
-
- Parameters:
-
- x : int {0, 1}
- new `loop` attribute.
-
- """
- self._loop = x
- x, lmax = convertArgsToLists(x)
- [obj.setLoop(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int {1, 2, 3, 4}
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self):
- """
- Resets current phase to 0.
-
- """
- [obj.reset() for i, obj in enumerate(self._base_objs)]
-
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the waveform samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def loop(self):
- """int. Looping mode."""
- return self._loop
- @loop.setter
- def loop(self, x): self.setLoop(x)
-
- @property
- def interp(self):
- """int {1, 2, 3, 4}. Interpolation method."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
-class Pulsar(PyoObject):
- """
- Pulsar synthesis oscillator.
-
- Pulsar synthesis produces a train of sound particles called pulsars
- that can make rhythms or tones, depending on the fundamental frequency
- of the train. Varying the `frac` parameter changes the portion of the
- period assigned to the waveform and the portion of the period assigned
- to its following silence, but maintain the overall pulsar period. This
- results in an effect much like a sweeping band-pass filter.
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the waveform samples.
- env : PyoTableObject
- Table containing the envelope samples.
- freq : float or PyoObject, optional
- Frequency in cycles per second. Defaults to 100.
- frac : float or PyoObject, optional
- Fraction of the whole period (0 -> 1) given to the waveform.
- The rest will be filled with zeros. Defaults to 0.5.
- phase : float or PyoObject, optional
- Phase of sampling, expressed as a fraction of a cycle (0 to 1).
- Defaults to 0.
- interp : int, optional
- Choice of the interpolation method. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setEnv(x) : Replace the `emv` attribute.
- setFreq(x) : Replace the `freq` attribute.
- setFrac(x) : Replace the `frac` attribute.
- setPhase(x) : Replace the `phase` attribute.
- setInterp(x) : Replace the `interp` attribute.
-
- Attributes:
-
- table : PyoTableObject. Table containing the waveform samples.
- env : PyoTableObject. Table containing the envelope samples.
- freq : float or PyoObject, Frequency in cycles per second.
- frac : float or PyoObject, Fraction of the period assigned to waveform.
- phase : float or PyoObject, Phase of sampling (0 -> 1).
- interp : int {1, 2, 3, 4}, Interpolation method.
-
- See also: Osc
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> w = HarmTable([1,0,.33,0,2,0,.143,0,.111])
- >>> e = HannTable()
- >>> lfo = Sine([.1,.15], mul=.2, add=.5)
- >>> a = Pulsar(table=w, env=e, freq=80, frac=lfo, mul=.08).out()
-
- """
- def __init__(self, table, env, freq=100, frac=0.5, phase=0, interp=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._env = env
- self._freq = freq
- self._frac = frac
- self._phase = phase
- self._interp = interp
- self._mul = mul
- self._add = add
- table, env, freq, frac, phase, interp, mul, add, lmax = convertArgsToLists(table, env, freq, frac, phase, interp, mul, add)
- self._base_objs = [Pulsar_base(wrap(table,i), wrap(env,i), wrap(freq,i), wrap(frac,i), wrap(phase,i), wrap(interp,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'env', 'freq', 'frac', 'phase', 'interp', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setEnv(self, x):
- """
- Replace the `env` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `env` attribute.
-
- """
- self._env = x
- x, lmax = convertArgsToLists(x)
- [obj.setEnv(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFreq(self, x):
- """
- Replace the `freq` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `freq` attribute.
-
- """
- self._freq = x
- x, lmax = convertArgsToLists(x)
- [obj.setFreq(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFrac(self, x):
- """
- Replace the `frac` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `frac` attribute.
-
- """
- self._frac = x
- x, lmax = convertArgsToLists(x)
- [obj.setFrac(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPhase(self, x):
- """
- Replace the `phase` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `phase` attribute.
-
- """
- self._phase = x
- x, lmax = convertArgsToLists(x)
- [obj.setPhase(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int {1, 2, 3, 4}
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapFreq(self._freq),
- SLMap(0., 1., 'lin', 'frac', self._frac),
- SLMapPhase(self._phase),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the waveform samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def env(self):
- """PyoTableObject. Table containing the envelope samples."""
- return self._env
- @env.setter
- def env(self, x): self.setEnv(x)
-
- @property
- def freq(self):
- """float or PyoObject. Frequency in cycles per second."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
-
- @property
- def frac(self):
- """float or PyoObject. Fraction of the period assigned to waveform."""
- return self._frac
- @frac.setter
- def frac(self, x): self.setFrac(x)
-
- @property
- def phase(self):
- """float or PyoObject. Phase of sampling."""
- return self._phase
- @phase.setter
- def phase(self, x): self.setPhase(x)
-
- @property
- def interp(self):
- """int {1, 2, 3, 4}. Interpolation method."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
-class Pointer(PyoObject):
- """
- Table reader with control on the pointer position.
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the waveform samples.
- index : PyoObject
- Normalized position in the table between 0 and 1.
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setIndex(x) : Replace the `index` attribute.
-
- Attributes:
-
- table : PyoTableObject. Table containing the waveform samples.
- index : PyoObject. Pointer position in the table.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = SndTable(SNDS_PATH + '/transparent.aif')
- >>> freq = t.getRate()
- >>> p = Phasor(freq=[freq*0.5, freq*0.45])
- >>> a = Pointer(table=t, index=p, mul=.3).out()
-
- """
- def __init__(self, table, index, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._index = index
- self._mul = mul
- self._add = add
- table, index, mul, add, lmax = convertArgsToLists(table, index, mul, add)
- self._base_objs = [Pointer_base(wrap(table,i), wrap(index,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'index', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setIndex(self, x):
- """
- Replace the `index` attribute.
-
- Parameters:
-
- x : PyoObject
- new `index` attribute.
-
- """
- self._index = x
- x, lmax = convertArgsToLists(x)
- [obj.setIndex(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the waveform samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def index(self):
- """PyoObject. Index pointer position in the table."""
- return self._index
- @index.setter
- def index(self, x): self.setIndex(x)
-
-class TableIndex(PyoObject):
- """
- Table reader by sample position without interpolation.
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the samples.
- index : PyoObject
- Position in the table, as integer audio stream,
- between 0 and table's size - 1.
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setIndex(x) : Replace the `index` attribute.
-
- Attributes:
-
- table : PyoTableObject. Table containing the waveform samples.
- index : PyoObject. Position in the table.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> import random
- >>> notes = [midiToHz(random.randint(60,84)) for i in range(10)]
- >>> tab = DataTable(size=10, init=notes)
- >>> ind = RandInt(10, [4,8])
- >>> pit = TableIndex(tab, ind)
- >>> a = SineLoop(freq=pit, feedback = 0.05, mul=.2).out()
-
- """
- def __init__(self, table, index, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._index = index
- self._mul = mul
- self._add = add
- table, index, mul, add, lmax = convertArgsToLists(table, index, mul, add)
- self._base_objs = [TableIndex_base(wrap(table,i), wrap(index,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'index', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setIndex(self, x):
- """
- Replace the `index` attribute.
-
- Parameters:
-
- x : PyoObject
- new `index` attribute.
-
- """
- self._index = x
- x, lmax = convertArgsToLists(x)
- [obj.setIndex(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def index(self):
- """PyoObject. Position in the table."""
- return self._index
- @index.setter
- def index(self, x): self.setIndex(x)
-
-class Lookup(PyoObject):
- """
- Uses table to do waveshaping on an audio signal.
-
- Lookup uses a table to apply waveshaping on an input signal
- `index`. The index must be between -1 and 1, it is automatically
- scaled between 0 and len(table)-1 and is used as a position
- pointer in the table.
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the transfert function.
- index : PyoObject
- Audio signal, between -1 and 1, internally converted to be
- used as the index position in the table.
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setIndex(x) : Replace the `index` attribute.
-
- table : PyoTableObject. Table containing the transfert function.
- index : PyoObject. Audio input used as the table index.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> lfo = Sine(freq=[.15,.2], mul=.2, add=.25)
- >>> a = Sine(freq=[100,150], mul=lfo)
- >>> t = CosTable([(0,-1),(3072,-0.85),(4096,0),(5520,.85),(8192,1)])
- >>> b = Lookup(table=t, index=a, mul=.5-lfo).out()
-
- """
- def __init__(self, table, index, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._index = index
- self._mul = mul
- self._add = add
- table, index, mul, add, lmax = convertArgsToLists(table, index, mul, add)
- self._base_objs = [Lookup_base(wrap(table,i), wrap(index,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'index', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setIndex(self, x):
- """
- Replace the `index` attribute.
-
- Parameters:
-
- x : PyoObject
- new `index` attribute.
-
- """
- self._index = x
- x, lmax = convertArgsToLists(x)
- [obj.setIndex(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the transfert function."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def index(self):
- """PyoObject. Audio input used as the table index."""
- return self._index
- @index.setter
- def index(self, x): self.setIndex(x)
-
-class TableRec(PyoObject):
- """
- TableRec is for writing samples into a previously created NewTable.
-
- See `NewTable` to create an empty table.
-
- The play method is not called at the object creation time. It starts
- the recording into the table until the table is full. Calling the
- play method again restarts the recording and overwrites previously
- recorded samples.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal to write in the table.
- table : NewTable
- The table where to write samples.
- fadetime : float, optional
- Fade time at the beginning and the end of the recording
- in seconds. Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setTable(x) : Replace the `table` attribute.
- play() : Start the recording at the beginning of the table.
- stop() : Stop the recording. Otherwise, record through the
- end of the table.
-
- Attributes:
-
- input : PyoObject. Audio signal to write in the table.
- table : NewTable. The table where to write samples.
-
- Notes:
-
- The out() method is bypassed. TableRec returns no signal.
-
- TableRec has no `mul` and `add` attributes.
-
- TableRec will sends a trigger signal at the end of the recording.
- User can retrieve the trigger streams by calling obj['trig']. In
- this example, the recorded table will be read automatically after
- a recording:
-
- >>> a = Input(0)
- >>> t = NewTable(length=1, chnls=1)
- >>> rec = TableRec(a, table=t, fadetime=0.01)
- >>> tr = TrigEnv(rec['trig'], table=t, dur=1).out()
-
- obj['time'] outputs an audio stream of the current recording time,
- in samples.
-
- See also: NewTable, TrigTableRec
-
- Examples:
-
- >>> s = Server(duplex=1).boot()
- >>> s.start()
- >>> t = NewTable(length=2, chnls=1)
- >>> a = Input(0)
- >>> b = TableRec(a, t, .01)
- >>> amp = Iter(b["trig"], [.5])
- >>> freq = t.getRate()
- >>> c = Osc(t, [freq, freq*.99], mul=amp).out()
- >>> # to record in the empty table, call:
- >>> # b.play()
-
- """
- def __init__(self, input, table, fadetime=0):
- PyoObject.__init__(self)
- self._time_dummy = []
- self._input = input
- self._table = table
- self._in_fader = InputFader(input)
- in_fader, table, fadetime, lmax = convertArgsToLists(self._in_fader, table, fadetime)
- self._base_objs = [TableRec_base(wrap(in_fader,i), wrap(table,i), wrap(fadetime,i)) for i in range(len(table))]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
- self._time_objs = [TableRecTimeStream_base(obj) for obj in self._base_objs]
-
- def __dir__(self):
- return ['input', 'table']
-
- def __getitem__(self, i):
- if i == 'time':
- self._time_dummy.append(Dummy([obj for obj in self._time_objs]))
- return self._time_dummy[-1]
- return PyoObject.__getitem__(self, i)
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : NewTable
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Audio signal to write in the table."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def table(self):
- """NewTable. The table where to write samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
-class TableMorph(PyoObject):
- """
- Morphs between multiple PyoTableObjects.
-
- Uses an index into a list of PyoTableObjects to morph between adjacent
- tables in the list. The resulting morphed function is written into the
- `table` object at the beginning of each buffer size. The tables in the
- list and the resulting table must be equal in size.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Morphing index between 0 and 1. 0 is the first table in the list
- and 1 is the last.
- table : NewTable
- The table where to write morphed waveform.
- sources : list of PyoTableObject
- List of tables to interpolate from.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setTable(x) : Replace the `table` attribute.
- setSources(x) : Replace the `sources` attribute.
-
- Attributes:
-
- input : PyoObject. Morphing index between 0 and 1.
- table : NewTable. The table where to write samples.
- sources : list of PyoTableObject. List of tables to interpolate from.
-
- Notes:
-
- The out() method is bypassed. TableMorph returns no signal.
-
- TableMorph has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server(duplex=1).boot()
- >>> s.start()
- >>> t1 = HarmTable([1,.5,.33,.25,.2,.167,.143,.125,.111,.1,.091])
- >>> t2 = HarmTable([1,0,.33,0,.2,0,.143,0,.111,0,.091])
- >>> t3 = NewTable(length=8192./s.getSamplingRate(), chnls=1)
- >>> lfo = Sine(.25, 0, .5, .5)
- >>> mor = TableMorph(lfo, t3, [t1,t2])
- >>> osc = Osc(t3, freq=[199.5,200], mul=.08).out()
-
- """
- def __init__(self, input, table, sources):
- PyoObject.__init__(self)
- self._input = input
- self._table = table
- self._sources = sources
- self._in_fader = InputFader(input)
- in_fader, table, lmax = convertArgsToLists(self._in_fader, table)
- self._base_sources = [source[0] for source in sources]
- self._base_objs = [TableMorph_base(wrap(in_fader,i), wrap(table,i), self._base_sources) for i in range(len(table))]
-
- def __dir__(self):
- return ['input', 'table', 'sources', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : NewTable
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setSources(self, x):
- """
- Replace the `sources` attribute.
-
- Parameters:
-
- x : list of PyoTableObject
- new `sources` attribute.
-
- """
- self._sources = x
- self._base_sources = [source[0] for source in x]
- [obj.setSources(self._base_sources) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Morphing index between 0 and 1."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def table(self):
- """NewTable. The table where to write samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def sources(self):
- """list of PyoTableObject. List of tables to interpolate from."""
- return self._sources
- @sources.setter
- def sources(self, x): self.setSources(x)
-
-class Granulator(PyoObject):
- """
- Granular synthesis generator.
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the waveform samples.
- env : PyoTableObject
- Table containing the grain envelope.
- pitch : float or PyoObject, optional
- Overall pitch of the granulator. This value transpose the
- pitch of all grains. Defaults to 1.
- pos : float or PyoObject, optional
- Pointer position, in samples, in the waveform table. Each
- grain sampled the current value of this stream at the beginning
- of its envelope and hold it until the end of the grain.
- Defaults to 0.
- dur : float or PyoObject, optional
- Duration, in seconds, of the grain. Each grain sampled the
- current value of this stream at the beginning of its envelope
- and hold it until the end of the grain. Defaults to 0.1.
- grains : int, optional
- Number of grains. Defaults to 8.
- basedur : float, optional
- Base duration used to calculate the speed of the pointer to
- read the grain at its original pitch. By changing the value of
- the `dur` parameter, transposition per grain can be generated.
- Defaults to 0.1.
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setEnv(x) : Replace the `env` attribute.
- setPitch(x) : Replace the `pitch` attribute.
- setPos(x) : Replace the `pos` attribute.
- setDur(x) : Replace the `dur` attribute.
- setGrains(x) : Replace the `grains` attribute.
- setBaseDur(x) : Replace the `basedur` attribute.
-
- Attributes:
-
- table : PyoTableObject. The table where to write samples.
- env : PyoTableObject. Table containing the grain envelope.
- pitch : float or PyoObject. Overall pitch of the granulator.
- pos : float or PyoObject. Position of the pointer in the sound table.
- dur : float or PyoObject. Duration, in seconds, of the grain.
- grains : int. Number of grains.
- basedur : float. Duration to read the grain at its original pitch.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> snd = SndTable(SNDS_PATH + "/transparent.aif")
- >>> env = HannTable()
- >>> pos = Phasor(snd.getRate()*.25, 0, snd.getSize())
- >>> dur = Noise(.001, .1)
- >>> g = Granulator(snd, env, [1, 1.001], pos, dur, 24, mul=.1).out()
-
- """
- def __init__(self, table, env, pitch=1, pos=0, dur=.1, grains=8, basedur=.1, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._env = env
- self._pitch = pitch
- self._pos = pos
- self._dur = dur
- self._grains = grains
- self._basedur = basedur
- self._mul = mul
- self._add = add
- table, env, pitch, pos, dur, grains, basedur, mul, add, lmax = convertArgsToLists(table, env, pitch,
- pos, dur, grains, basedur, mul, add)
- self._base_objs = [Granulator_base(wrap(table,i), wrap(env,i), wrap(pitch,i), wrap(pos,i), wrap(dur,i),
- wrap(grains,i), wrap(basedur,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'env', 'pitch', 'pos', 'dur', 'grains', 'basedur', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setEnv(self, x):
- """
- Replace the `env` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `env` attribute.
-
- """
- self._env = x
- x, lmax = convertArgsToLists(x)
- [obj.setEnv(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPitch(self, x):
- """
- Replace the `pitch` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `pitch` attribute.
-
- """
- self._pitch = x
- x, lmax = convertArgsToLists(x)
- [obj.setPitch(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPos(self, x):
- """
- Replace the `pos` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `pos` attribute.
-
- """
- self._pos = x
- x, lmax = convertArgsToLists(x)
- [obj.setPos(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDur(self, x):
- """
- Replace the `dur` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `dur` attribute.
-
- """
- self._dur = x
- x, lmax = convertArgsToLists(x)
- [obj.setDur(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setGrains(self, x):
- """
- Replace the `grains` attribute.
-
- Parameters:
-
- x : int
- new `grains` attribute.
-
- """
- self._grains = x
- x, lmax = convertArgsToLists(x)
- [obj.setGrains(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setBaseDur(self, x):
- """
- Replace the `basedur` attribute.
-
- Parameters:
-
- x : float
- new `basedur` attribute.
-
- """
- self._basedur = x
- x, lmax = convertArgsToLists(x)
- [obj.setBaseDur(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, 2., 'lin', 'pitch', self._pitch),
- SLMap(0.01, 1., 'lin', 'dur', self._dur),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. The table where to write samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def env(self):
- """PyoTableObject. Table containing the grain envelope."""
- return self._env
- @env.setter
- def env(self, x): self.setEnv(x)
-
- @property
- def pitch(self):
- """float or PyoObject. Overall pitch of the granulator."""
- return self._pitch
- @pitch.setter
- def pitch(self, x): self.setPitch(x)
-
- @property
- def pos(self):
- """float or PyoObject. Position of the pointer in the sound table."""
- return self._pos
- @pos.setter
- def pos(self, x): self.setPos(x)
-
- @property
- def dur(self):
- """float or PyoObject. Duration, in seconds, of the grain."""
- return self._dur
- @dur.setter
- def dur(self, x): self.setDur(x)
-
- @property
- def grains(self):
- """int. Number of grains."""
- return self._grains
- @grains.setter
- def grains(self, x): self.setGrains(x)
-
- @property
- def basedur(self):
- """float. Duration to read the grain at its original pitch."""
- return self._basedur
- @basedur.setter
- def basedur(self, x): self.setBaseDur(x)
-
-class TrigTableRec(PyoObject):
- """
- TrigTableRec is for writing samples into a previously created NewTable.
-
- See `NewTable` to create an empty table.
-
- Each time a "trigger" is received in the `trig` input, TrigTableRec
- starts the recording into the table until the table is full.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal to write in the table.
- trig : PyoObject
- Audio signal sending triggers.
- table : NewTable
- The table where to write samples.
- fadetime : float, optional
- Fade time at the beginning and the end of the recording
- in seconds. Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setTrig(x, fadetime) : Replace the `trig` attribute.
- setTable(x) : Replace the `table` attribute.
-
- Attributes:
-
- input : PyoObject. Audio signal to write in the table.
- trig : PyoObject. Audio signal sending triggers.
- table : NewTable. The table where to write samples.
-
- Notes:
-
- The out() method is bypassed. TrigTableRec returns no signal.
-
- TrigTableRec has no `mul` and `add` attributes.
-
- TrigTableRec will sends a trigger signal at the end of the recording.
- User can retrieve the trigger streams by calling obj['trig'].
-
- obj['time'] outputs an audio stream of the current recording time,
- in samples.
-
- See also: NewTable, TableRec
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> snd = SNDS_PATH + '/transparent.aif'
- >>> dur = sndinfo(snd)[1]
- >>> t = NewTable(length=dur)
- >>> src = SfPlayer(snd, mul=.3).out()
- >>> trec = TrigTableRec(src, trig=Trig().play(), table=t)
- >>> rep = TrigEnv(trec["trig"], table=t, dur=dur).out(1)
-
- """
- def __init__(self, input, trig, table, fadetime=0):
- PyoObject.__init__(self)
- self._time_dummy = []
- self._input = input
- self._trig = trig
- self._table = table
- self._in_fader = InputFader(input)
- self._in_fader2 = InputFader(trig)
- in_fader, in_fader2, table, fadetime, lmax = convertArgsToLists(self._in_fader, self._in_fader2, table, fadetime)
- self._base_objs = [TrigTableRec_base(wrap(in_fader,i), wrap(in_fader2,i), wrap(table,i), wrap(fadetime,i)) for i in range(len(table))]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
- self._time_objs = [TrigTableRecTimeStream_base(obj) for obj in self._base_objs]
-
- def __dir__(self):
- return ['input', 'trig', 'table']
-
- def __getitem__(self, i):
- if i == 'time':
- self._time_dummy.append(Dummy([obj for obj in self._time_objs]))
- return self._time_dummy[-1]
- return PyoObject.__getitem__(self, i)
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setTrig(self, x, fadetime=0.05):
- """
- Replace the `trig` attribute.
-
- Parameters:
-
- x : PyoObject
- New trigger signal.
- fadetime : float, optional
- Crossfade time between old and new input. Defaults to 0.05.
-
- """
- self._trig = x
- self._in_fader2.setInput(x, fadetime)
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : NewTable
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Audio signal to write in the table."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def trig(self):
- """PyoObject. Audio signal sending triggers."""
- return self._trig
- @trig.setter
- def trig(self, x): self.setTrig(x)
-
- @property
- def table(self):
- """NewTable. The table where to write samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
-class Looper(PyoObject):
- """
- Crossfading looper.
-
- Looper reads audio from a PyoTableObject and plays it back in a loop with
- user-defined pitch, start time, duration and crossfade time. The `mode`
- argument allows the user to choose different looping modes.
-
- Parentclass: PyoObject
-
- Parameters:
-
- table : PyoTableObject
- Table containing the waveform samples.
- pitch : float or PyoObject, optional
- Transposition factor. 1 is normal pitch, 0.5 is one octave lower, 2 is
- one octave higher. Negative values are not allowed. Defaults to 1.
- start : float or PyoObject, optional
- Starting point, in seconds, of the loop, updated only once per loop cycle.
- Defaults to 0.
- dur : float or PyoObject, optional
- Duration, in seconds, of the loop, updated only once per loop cycle.
- Defaults to 1.
- xfade : float or PyoObject {0 -> 50}, optional
- Percent of the loop time used to crossfade readers, updated only once per
- loop cycle and clipped between 0 and 50. Defaults to 20.
- mode : int {0, 1, 2, 3}, optional
- Loop modes. Defaults to 1.
- 0 : no loop
- 1 : forward
- 2 : backward
- 3 : back-and-forth
- xfadeshape : int {0, 1, 2}, optional
- Crossfade envelope shape. Defaults to 0.
- 0 : linear
- 1 : equal power
- 2 : sigmoid
- startfromloop : boolean, optional
- If True, reading will begin directly at the loop start point. Otherwise, it
- begins at the beginning of the table. Defaults to False.
- interp : int {1, 2, 3, 4}, optional
- Choice of the interpolation method. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
- autosmooth : boolean, optional
- If True, a lowpass filter, following the pitch, is applied on the output signal
- to reduce the quantization noise produced by very low transpositions.
- Defaults to False.
-
- Methods:
-
- setTable(x) : Replace the `table` attribute.
- setPitch(x) : Replace the `pitch` attribute.
- setStart(x) : Replace the `start` attribute.
- setDur(x) : Replace the `dur` attribute.
- setXfade(x) : Replace the `xfade` attribute.
- setMode(x) : Replace the `mode` attribute.
- setXfadeShape(x) : Replace the `xfadeshape` attribute.
- setStartFromLoop(x) : Replace the `startfromloop` attribute.
- setInterp(x) : Replace the `interp` attribute.
- setAutoSmooth(x) : Replace the `autosmooth` attribute.
-
- Attributes:
-
- table : PyoTableObject. Table containing the waveform samples.
- pitch : float or PyoObject, Transposition factor.
- start : float or PyoObject, Loop start position in seconds.
- dur : float or PyoObject, Loop duration in seconds.
- xfade : float or PyoObject, Crossfade duration in percent.
- mode : int, Looping mode.
- xfadeshape : int, Crossfade envelope.
- startfromloop : boolean, Init starting point.
- interp : int, Interpolation method.
- autosmooth : boolean, Automatic lowpass filter.
-
- See also: Granulator, Pointer
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> tab = SndTable(SNDS_PATH + '/transparent.aif')
- >>> pit = Choice(choice=[.5,.75,1,1.25,1.5], freq=[3,4])
- >>> start = Phasor(freq=.2, mul=tab.getDur())
- >>> dur = Choice(choice=[.0625,.125,.125,.25,.33], freq=4)
- >>> a = Looper(table=tab, pitch=pit, start=start, dur=dur, startfromloop=True, mul=.25).out()
-
- """
- def __init__(self, table, pitch=1, start=0, dur=1., xfade=20, mode=1, xfadeshape=0, startfromloop=False, interp=2, autosmooth=False, mul=1, add=0):
- PyoObject.__init__(self)
- self._table = table
- self._pitch = pitch
- self._start = start
- self._dur = dur
- self._xfade = xfade
- self._mode = mode
- self._xfadeshape = xfadeshape
- self._startfromloop = startfromloop
- self._interp = interp
- self._autosmooth = autosmooth
- self._mul = mul
- self._add = add
- table, pitch, start, dur, xfade, mode, xfadeshape, startfromloop, interp, autosmooth, mul, add, lmax = convertArgsToLists(
- table, pitch, start, dur, xfade, mode, xfadeshape, startfromloop, interp, autosmooth, mul, add)
- self._base_objs = [Looper_base(wrap(table,i), wrap(pitch,i), wrap(start,i), wrap(dur,i), wrap(xfade,i), wrap(mode,i),
- wrap(xfadeshape,i), wrap(startfromloop,i), wrap(interp,i), wrap(autosmooth,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['table', 'pitch', 'start', 'dur', 'xfade', 'mode', 'xfadeshape', 'startfromloop', 'interp', 'autosmooth', 'mul', 'add']
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPitch(self, x):
- """
- Replace the `pitch` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `pitch` attribute.
-
- """
- self._pitch = x
- x, lmax = convertArgsToLists(x)
- [obj.setPitch(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setStart(self, x):
- """
- Replace the `start` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `start` attribute.
-
- """
- self._start = x
- x, lmax = convertArgsToLists(x)
- [obj.setStart(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDur(self, x):
- """
- Replace the `dur` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `dur` attribute.
-
- """
- self._dur = x
- x, lmax = convertArgsToLists(x)
- [obj.setDur(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setXfade(self, x):
- """
- Replace the `xfade` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `xfade` attribute.
-
- """
- self._xfade = x
- x, lmax = convertArgsToLists(x)
- [obj.setXfade(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setXfadeShape(self, x):
- """
- Replace the `xfadeshape` attribute.
-
- Parameters:
-
- x : int
- new `xfadeshape` attribute.
-
- """
- self._xfadeshape = x
- x, lmax = convertArgsToLists(x)
- [obj.setXfadeShape(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setStartFromLoop(self, x):
- """
- Replace the `startfromloop` attribute.
-
- Parameters:
-
- x : boolean
- new `startfromloop` attribute.
-
- """
- self._startfromloop = x
- x, lmax = convertArgsToLists(x)
- [obj.setStartFromLoop(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMode(self, x):
- """
- Replace the `mode` attribute.
-
- Parameters:
-
- x : int
- new `mode` attribute.
-
- """
- self._mode = x
- x, lmax = convertArgsToLists(x)
- [obj.setMode(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setAutoSmooth(self, x):
- """
- Replace the `autosmooth` attribute.
-
- Parameters:
-
- x : boolean
- new `autosmooth` attribute.
-
- """
- self._autosmooth = x
- x, lmax = convertArgsToLists(x)
- [obj.setAutoSmooth(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, 2., 'lin', 'pitch', self._pitch),
- SLMap(0., self._table.getDur(), 'lin', 'start', self._start),
- SLMap(0.01, 1., 'lin', 'dur', self._dur),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def table(self):
- """PyoTableObject. Table containing the waveform samples."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
- @property
- def pitch(self):
- """float or PyoObject. Transposition factor."""
- return self._pitch
- @pitch.setter
- def pitch(self, x): self.setPitch(x)
-
- @property
- def start(self):
- """float or PyoObject. Loop start position in seconds."""
- return self._start
- @start.setter
- def start(self, x): self.setStart(x)
-
- @property
- def dur(self):
- """float or PyoObject. Loop duration in seconds."""
- return self._dur
- @dur.setter
- def dur(self, x): self.setDur(x)
-
- @property
- def xfade(self):
- """float or PyoObject. Crossfade duration in percent."""
- return self._xfade
- @xfade.setter
- def xfade(self, x): self.setXfade(x)
-
- @property
- def xfadeshape(self):
- """int. Crossfade envelope."""
- return self._xfadeshape
- @xfadeshape.setter
- def xfadeshape(self, x): self.setXfadeShape(x)
-
- @property
- def startfromloop(self):
- """boolean. Starts from loop point if True, otherwise starts from beginning of the sound."""
- return self._startfromloop
- @startfromloop.setter
- def startfromloop(self, x): self.setStartFromLoop(x)
-
- @property
- def mode(self):
- """int. Looping mode."""
- return self._mode
- @mode.setter
- def mode(self, x): self.setMode(x)
-
- @property
- def interp(self):
- """int. Interpolation method."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
- @property
- def autosmooth(self):
- """boolean. Activates a lowpass filter applied on output signal."""
- return self._autosmooth
- @autosmooth.setter
- def autosmooth(self, x): self.setAutoSmooth(x)
-
-class TablePut(PyoObject):
- """
- Writes values, without repetitions, from an audio stream into a DataTable.
-
- See `DataTable` to create an empty table.
-
- TablePut takes an audio input and writes values into a DataTable but
- only when value changes. This allow to record only new values, without
- repetitions.
-
- The play method is not called at the object creation time. It starts
- the recording into the table until the table is full. Calling the
- play method again restarts the recording and overwrites previously
- recorded values.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal to write in the table.
- table : DataTable
- The table where to write values.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setTable(x) : Replace the `table` attribute.
- play() : Start the recording at the beginning of the table.
- stop() : Stop the recording. Otherwise, record through the
- end of the table.
-
- Attributes:
-
- input : PyoObject. Audio signal to write in the table.
- table : DataTable. The table where to write values.
-
- Notes:
-
- The out() method is bypassed. TablePut returns no signal.
-
- TablePut has no `mul` and `add` attributes.
-
- TablePut will sends a trigger signal at the end of the recording.
- User can retrieve the trigger streams by calling obj['trig'].
-
- See also: DataTable, NewTable, TableRec
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = DataTable(size=16)
- >>> rnd = Choice(range(200, 601, 50), freq=16)
- >>> rec = TablePut(rnd, t).play()
- >>> met = Metro(.125).play()
- >>> ind = Counter(met, max=16)
- >>> fr = TableIndex(t, ind, mul=[1,1.005])
- >>> osc = SineLoop(fr, feedback=.08, mul=.3).out()
-
- """
- def __init__(self, input, table):
- PyoObject.__init__(self)
- self._input = input
- self._table = table
- self._in_fader = InputFader(input)
- in_fader, table, lmax = convertArgsToLists(self._in_fader, table)
- self._base_objs = [TablePut_base(wrap(in_fader,i), wrap(table,i)) for i in range(len(table))]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
-
- def __dir__(self):
- return ['input', 'table']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : DataTable
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Audio signal to write in the table."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def table(self):
- """DataTable. The table where to write values."""
- return self._table
- @table.setter
- def table(self, x): self.setTable(x)
-
diff --git a/build/lib.linux-x86_64-2.7/pyolib/tables.py b/build/lib.linux-x86_64-2.7/pyolib/tables.py
deleted file mode 100644
index f578b6d..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/tables.py
+++ /dev/null
@@ -1,2459 +0,0 @@
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-from _widgets import createGraphWindow, createSndViewTableWindow
-from types import ListType
-from math import pi
-
-######################################################################
-### Tables
-######################################################################
-class HarmTable(PyoTableObject):
- """
- Harmonic waveform generator.
-
- Generates composite waveforms made up of weighted sums
- of simple sinusoids.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- list : list, optional
- Relative strengths of the fixed harmonic partial numbers 1,2,3, etc.
- Defaults to [1].
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table. This will erase the
- previously drawn waveform.
- replace(list) : Redraw the waveform according to the new `list`
- parameter.
-
- Attributes:
-
- list : list, optional
- Relative strengths of the fixed harmonic partial numbers.
- size : int, optional
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Square wave up to 9th harmonic
- >>> t = HarmTable([1,0,.33,0,.2,0,.143,0,.111])
- >>> a = Osc(table=t, freq=[199,200], mul=.2).out()
-
- """
- def __init__(self, list=[1., 0.], size=8192):
- PyoTableObject.__init__(self)
- self._list = list
- self._size = size
- self._base_objs = [HarmTable_base(list, size)]
-
- def __dir__(self):
- return ['list', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table. This will erase the previously
- drawn waveform.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def replace(self, list):
- """
- Redraw the waveform according to a new set of harmonics
- relative strengths.
-
- Parameters:
-
- list : list
- Relative strengths of the fixed harmonic partial
- numbers 1,2,3, etc.
-
- """
- self._list = list
- [obj.replace(list) for obj in self._base_objs]
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def list(self):
- """list. Relative strengths of the fixed harmonic partial numbers."""
- return self._list
- @list.setter
- def list(self, x): self.replace(x)
-
-class SawTable(PyoTableObject):
- """
- Sawtooth waveform generator.
-
- Generates sawtooth waveforms made up of fixed number of harmonics.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- order : int, optional
- Number of harmonics sawtooth is made of.
- Defaults to 10.
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setOrder(x) : Change the `order` attribute and redraw the waveform.
- setSize(size) : Change the size of the table. This will erase the
- previously drawn waveform.
-
- Attributes:
-
- order : int, optional
- Number of harmonics sawtooth is made of.
- size : int, optional
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = SawTable(order=12).normalize()
- >>> a = Osc(table=t, freq=[199,200], mul=.2).out()
-
- """
- def __init__(self, order=10, size=8192):
- PyoTableObject.__init__(self)
- self._order = order
- self._size = size
- list = [1./i for i in range(1,(order+1))]
- self._base_objs = [HarmTable_base(list, size)]
-
- def __dir__(self):
- return ['order', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table. This will erase the previously
- drawn waveform.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def setOrder(self, x):
- """
- Change the `order` attribute and redraw the waveform.
-
- Parameters:
-
- x : int
- New number of harmonics
-
- """
- self._order = x
- list = [1./i for i in range(1,(self._order+1))]
- [obj.replace(list) for obj in self._base_objs]
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def order(self):
- """int. Number of harmonics sawtooth is made of."""
- return self._order
- @order.setter
- def order(self, x): self.setOrder(x)
-
-class SquareTable(PyoTableObject):
- """
- Square waveform generator.
-
- Generates square waveforms made up of fixed number of harmonics.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- order : int, optional
- Number of harmonics square waveform is made of. The waveform will
- contains `order` odd harmonics. Defaults to 10.
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setOrder(x) : Change the `order` attribute and redraw the waveform.
- setSize(size) : Change the size of the table. This will erase the
- previously drawn waveform.
-
- Attributes:
-
- order : int, optional
- Number of harmonics square waveform is made of.
- size : int, optional
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = SquareTable(order=15).normalize()
- >>> a = Osc(table=t, freq=[199,200], mul=.2).out()
-
- """
- def __init__(self, order=10, size=8192):
- PyoTableObject.__init__(self)
- self._order = order
- self._size = size
- list = []
- for i in range(1,(order*2)):
- if i%2 == 1:
- list.append(1./i)
- else:
- list.append(0.)
- self._base_objs = [HarmTable_base(list, size)]
-
- def __dir__(self):
- return ['order', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table. This will erase the previously
- drawn waveform.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def setOrder(self, x):
- """
- Change the `order` attribute and redraw the waveform.
-
- Parameters:
-
- x : int
- New number of harmonics
-
- """
- self._order = x
- list = []
- for i in range(1,(self._order*2)):
- if i%2 == 1:
- list.append(1./i)
- else:
- list.append(0.)
- [obj.replace(list) for obj in self._base_objs]
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def order(self):
- """int. Number of harmonics square waveform is made of."""
- return self._order
- @order.setter
- def order(self, x): self.setOrder(x)
-
-class ChebyTable(PyoTableObject):
- """
- Chebyshev polynomials of the first kind.
-
- Uses Chebyshev coefficients to generate stored polynomial functions
- which, under waveshaping, can be used to split a sinusoid into
- harmonic partials having a pre-definable spectrum.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- list : list, optional
- Relative strengths of partials numbers 1,2,3, ..., 12 that will
- result when a sinusoid of amplitude 1 is waveshaped using this
- function table. Up to 12 partials can be specified. Defaults to [1].
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table. This will erase the
- previously drawn waveform.
- replace(list) : Redraw the waveform according to the new `list`
- parameter.
- getNormTable() : Return a DataTable filled with the normalization
- function corresponding to the current polynomial.
-
- Attributes:
-
- list : list, optional
- Relative strengths of the fixed harmonic partial numbers.
- size : int, optional
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = ChebyTable([1,0,.33,0,.2,0,.143,0,.111])
- >>> lfo = Sine(freq=.25, mul=0.45, add=0.5)
- >>> a = Sine(freq=[200,201], mul=lfo)
- >>> b = Lookup(table=t, index=a, mul=1-lfo).out()
-
- """
- def __init__(self, list=[1., 0.], size=8192):
- PyoTableObject.__init__(self)
- self._list = list
- self._size = size
- self._base_objs = [ChebyTable_base(list, size)]
-
- def __dir__(self):
- return ['list', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table. This will erase the previously
- drawn waveform.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def replace(self, list):
- """
- Redraw the waveform according to a new set of harmonics
- relative strengths that will result when a sinusoid of
- amplitude 1 is waveshaped using this function table.
-
- Parameters:
-
- list : list
- Relative strengths of the fixed harmonic partial
- numbers 1,2,3, ..., 12. Up to 12 partials can be specified.
-
- """
- self._list = list
- [obj.replace(list) for obj in self._base_objs]
-
- def getNormTable(self):
- """
- Return a DataTable filled with the normalization function
- corresponding to the current polynomial.
-
- """
- if sum(self._list[1::2]) == 0:
- data = self._base_objs[0].getNormTable(0)
- else:
- data = self._base_objs[0].getNormTable(1)
- return DataTable(size=len(data), init=data).normalize()
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def list(self):
- """list. Relative strengths of the fixed harmonic partial numbers."""
- return self._list
- @list.setter
- def list(self, x): self.replace(x)
-
-class HannTable(PyoTableObject):
- """
- Generates Hanning window function.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table. This will redraw the envelope.
-
- Attributes:
-
- size : int
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Hanning envelope
- >>> t = HannTable()
- >>> a = Osc(table=t, freq=2, mul=.2)
- >>> b = Sine(freq=[299,300], mul=a).out()
-
- """
- def __init__(self, size=8192):
- PyoTableObject.__init__(self)
- self._size = size
- self._base_objs = [HannTable_base(size)]
-
- def __dir__(self):
- return ['size']
-
- def setSize(self, size):
- """
- Change the size of the table. This will redraw the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
-class SincTable(PyoTableObject):
- """
- Generates sinc window function.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- freq : float, optional
- Frequency, in radians, of the sinc function. Defaults to pi*2.
- windowed : boolean, optional
- If True, an hanning window is applied on the sinc function. Defaults to False.
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setFreq(x) : Change the frequency of the sinc function. This will redraw the envelope.
- setWindowed(x) : Change the windowed flag. This will redraw the envelope.
- setSize(size) : Change the size of the table. This will redraw the envelope.
-
- Attributes:
-
- freq : float
- Frequency, in radians, of the sinc function.
- windowed : boolean
- If True, an hanning window is applied on the sinc function.
- size : int
- Table size in samples.
-
- Examples:
-
- >>> import math
- >>> s = Server().boot()
- >>> s.start()
- >>> t = SincTable(freq=math.pi*6, windowed=True)
- >>> a = Osc(t, freq=[199,200], mul=.2).out()
-
- """
- def __init__(self, freq=pi*2, windowed=False, size=8192):
- PyoTableObject.__init__(self)
- self._freq = freq
- self._windowed = windowed
- self._size = size
- self._base_objs = [SincTable_base(freq, windowed, size)]
-
- def __dir__(self):
- return ['freq', 'windowed', 'size']
-
- def setFreq(self, x):
- """
- Change the frequency of the sinc function. This will redraw the envelope.
-
- Parameters:
-
- x : float
- New frequency in radians.
-
- """
- self._freq = x
- [obj.setFreq(x) for obj in self._base_objs]
-
- def setWindowed(self, x):
- """
- Change the windowed flag. This will redraw the envelope.
-
- Parameters:
-
- x : boolean
- New windowed flag.
-
- """
- self._windowed = x
- [obj.setWindowed(x) for obj in self._base_objs]
-
- def setSize(self, size):
- """
- Change the size of the table. This will redraw the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- @property
- def freq(self):
- """float. Frequency of the sinc function."""
- return self._freq
- @freq.setter
- def freq(self, x): self.setFreq(x)
- @property
- def windowed(self):
- """boolean. Windowed flag."""
- return self._windowed
- @windowed.setter
- def windowed(self, x): self.setWindowed(x)
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
-class WinTable(PyoTableObject):
- """
- Generates different kind of windowing functions.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- type : int, optional
- Windowing function. Defaults to 2.
- Possible choices are:
- 0 : Rectangular (no window)
- 1 : Hamming
- 2 : Hanning
- 3 : Bartlett (triangular)
- 4 : Blackman 3-term
- 5 : Blackman-Harris 4-term
- 6 : Blackman-Harris 7-term
- 7 : Tuckey (alpha = 0.66)
- 8 : Sine (half-sine window)
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setType(x) : Sets the windowing function.
- setSize(size) : Change the size of the table. This will redraw the envelope.
-
- Attributes:
-
- type : int
- Windowing function.
- size : int
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Triangular envelope
- >>> t = WinTable(type=3)
- >>> a = Osc(table=t, freq=2, mul=.2)
- >>> b = SineLoop(freq=[199,200], feedback=0.05, mul=a).out()
-
- """
- def __init__(self, type=2, size=8192):
- PyoTableObject.__init__(self)
- self._type = type
- self._size = size
- self._base_objs = [WinTable_base(type, size)]
-
- def __dir__(self):
- return ['type', 'size']
-
- def setType(self, type):
- """
- Sets the windowing function.
-
- Parameters:
-
- type : int {0 -> 8}
- Windowing function.
- """
- self._type = type
- [obj.setType(type) for obj in self._base_objs]
-
-
- def setSize(self, size):
- """
- Change the size of the table. This will redraw the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- @property
- def type(self):
- """int. Windowing function."""
- return self._type
- @type.setter
- def type(self, x): self.setType(x)
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
-class ParaTable(PyoTableObject):
- """
- Generates parabola window function.
-
- The parabola is a conic section, the intersection of a right circular conical
- surface and a plane parallel to a generating straight line of that surface.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table. This will redraw the envelope.
-
- Attributes:
-
- size : int
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Parabola envelope
- >>> t = ParaTable()
- >>> a = Osc(table=t, freq=2, mul=.2)
- >>> b = SineLoop(freq=[299,300], feedback=0.05, mul=a).out()
-
- """
- def __init__(self, size=8192):
- PyoTableObject.__init__(self)
- self._size = size
- self._base_objs = [ParaTable_base(size)]
-
- def __dir__(self):
- return ['size']
-
- def setSize(self, size):
- """
- Change the size of the table. This will redraw the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
-class LinTable(PyoTableObject):
- """
- Construct a table from segments of straight lines in breakpoint fashion.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- list : list, optional
- List of tuples indicating location and value of each points
- in the table. The default, [(0,0.), (8191, 1.)], creates a
- straight line from 0.0 at location 0 to 1.0 at the end of the
- table (size - 1). Location must be an integer.
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table and rescale the envelope.
- replace(list) : Draw a new envelope according to the `list` parameter.
- loadRecFile(filename, tolerance) : Import an automation recording file.
- graph(yrange, title, wxnoserver) : Opens a grapher window to control
- the shape of the envelope.
-
- Notes:
-
- Locations in the list must be in increasing order. If the last value
- is less than size, the rest of the table will be filled with zeros.
-
- Attributes:
-
- list : list
- List of tuples [(location, value), ...].
- size : int, optional
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Sharp attack envelope
- >>> t = LinTable([(0,0), (100,1), (1000,.25), (8191,0)])
- >>> a = Osc(table=t, freq=2, mul=.25)
- >>> b = SineLoop(freq=[299,300], feedback=0.05, mul=a).out()
-
- """
- def __init__(self, list=[(0, 0.), (8191, 1.)], size=8192):
- PyoTableObject.__init__(self)
- if size < list[-1][0]:
- print "LinTable warning : size smaller than last point position."
- print " Increased size to last point position + 1"
- size = list[-1][0] + 1
- self._size = size
- self._base_objs = [LinTable_base(list, size)]
-
- def __dir__(self):
- return ['list', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table and rescale the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def replace(self, list):
- """
- Draw a new envelope according to the new `list` parameter.
-
- Parameters:
-
- list : list
- List of tuples indicating location and value of each points
- in the table. Location must be integer.
-
- """
- self._list = list
- [obj.replace(list) for obj in self._base_objs]
-
- def loadRecFile(self, filename, tolerance=0.02):
- """
- Import an automation recording file in the table.
-
- loadRecFile takes a recording file, usually from a ControlRec object,
- as `filename` parameter, applies a filtering pre-processing to eliminate
- redundancies and loads the result in the table as a list of points.
- Filtering process can be controled with the `tolerance` parameter.
-
- Parameters:
-
- filename : string
- Full path of an automation recording file.
- tolerance : float, optional
- Tolerance of the filter. A higher value will eliminate more points.
- Defaults to 0.02.
-
- """
- _path, _name = os.path.split(filename)
- # files = sorted([f for f in os.listdir(_path) if _name+"_" in f])
- # if _name not in files: files.append(_name)
- files = [filename]
- for i, obj in enumerate(self._base_objs):
- p = os.path.join(_path, wrap(files,i))
- f = open(p, "r")
- values = [(float(l.split()[0]), float(l.split()[1])) for l in f.readlines()]
- scl = self._size / values[-1][0]
- values = [(int(v[0]*scl), v[1]) for v in values]
- f.close()
- values = reducePoints(values, tolerance=tolerance)
- self._list = values
- obj.replace(values)
-
- def getPoints(self):
- return self._base_objs[0].getPoints()
-
- def graph(self, yrange=(0.0, 1.0), title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph.
- Defaults to (0.0, 1.0).
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- createGraphWindow(self, 0, self._size, yrange, title, wxnoserver)
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def list(self):
- """list. List of tuples indicating location and value of each points in the table."""
- return self.getPoints()
- @list.setter
- def list(self, x): self.replace(x)
-
-class LogTable(PyoTableObject):
- """
- Construct a table from logarithmic segments in breakpoint fashion.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- list : list, optional
- List of tuples indicating location and value of each points
- in the table. The default, [(0,0.), (8191, 1.)], creates a
- logarithmic line from 0.0 at location 0 to 1.0 at the end of
- the table (size - 1). Location must be an integer.
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table and rescale the envelope.
- replace(list) : Draw a new envelope according to the `list` parameter.
- loadRecFile(filename, tolerance) : Import an automation recording file.
- graph(yrange, title, wxnoserver) : Opens a grapher window to control
- the shape of the envelope.
-
- Notes:
-
- Locations in the list must be in increasing order. If the last value
- is less than size, the rest of the table will be filled with zeros.
-
- Values must be greater than 0.0.
-
- Attributes:
-
- list : list, List of tuples [(location, value), ...].
- size : int, Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = LogTable([(0,0), (4095,1), (8192,0)])
- >>> a = Osc(table=t, freq=2, mul=.25)
- >>> b = SineLoop(freq=[599,600], feedback=0.05, mul=a).out()
-
- """
- def __init__(self, list=[(0, 0.), (8191, 1.)], size=8192):
- PyoTableObject.__init__(self)
- if size < list[-1][0]:
- print "LogTable warning : size smaller than last point position."
- print " Increased size to last point position + 1"
- size = list[-1][0] + 1
- self._size = size
- self._base_objs = [LogTable_base(list, size)]
-
- def __dir__(self):
- return ['list', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table and rescale the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def replace(self, list):
- """
- Draw a new envelope according to the new `list` parameter.
-
- Parameters:
-
- list : list
- List of tuples indicating location and value of each points
- in the table. Location must be integer.
-
- """
- self._list = list
- [obj.replace(list) for obj in self._base_objs]
-
- def loadRecFile(self, filename, tolerance=0.02):
- """
- Import an automation recording file in the table.
-
- loadRecFile takes a recording file, usually from a ControlRec object,
- as `filename` parameter, applies a filtering pre-processing to eliminate
- redundancies and loads the result in the table as a list of points.
- Filtering process can be controled with the `tolerance` parameter.
-
- Parameters:
-
- filename : string
- Full path of an automation recording file.
- tolerance : float, optional
- Tolerance of the filter. A higher value will eliminate more points.
- Defaults to 0.02.
-
- """
- _path, _name = os.path.split(filename)
- # files = sorted([f for f in os.listdir(_path) if _name+"_" in f])
- # if _name not in files: files.append(_name)
- files = [filename]
- for i, obj in enumerate(self._base_objs):
- p = os.path.join(_path, wrap(files,i))
- f = open(p, "r")
- values = [(float(l.split()[0]), float(l.split()[1])) for l in f.readlines()]
- scl = self._size / values[-1][0]
- values = [(int(v[0]*scl), v[1]) for v in values]
- f.close()
- values = reducePoints(values, tolerance=tolerance)
- self._list = values
- obj.replace(values)
-
- def getPoints(self):
- return self._base_objs[0].getPoints()
-
- def graph(self, yrange=(0.0, 1.0), title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph.
- Defaults to (0.0, 1.0).
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- createGraphWindow(self, 4, self._size, yrange, title, wxnoserver)
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def list(self):
- """list. List of tuples indicating location and value of each points in the table."""
- return self.getPoints()
- @list.setter
- def list(self, x): self.replace(x)
-
-class CosLogTable(PyoTableObject):
- """
- Construct a table from logarithmic-cosine segments in breakpoint fashion.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- list : list, optional
- List of tuples indicating location and value of each points
- in the table. The default, [(0,0.), (8191, 1.)], creates a
- logarithmic line from 0.0 at location 0 to 1.0 at the end of
- the table (size - 1). Location must be an integer.
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table and rescale the envelope.
- replace(list) : Draw a new envelope according to the `list` parameter.
- loadRecFile(filename, tolerance) : Import an automation recording file.
- graph(yrange, title, wxnoserver) : Opens a grapher window to control
- the shape of the envelope.
-
- Notes:
-
- Locations in the list must be in increasing order. If the last value
- is less than size, the rest of the table will be filled with zeros.
-
- Values must be greater than 0.0.
-
- Attributes:
-
- list : list, List of tuples [(location, value), ...].
- size : int, Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = CosLogTable([(0,0), (4095,1), (8192,0)])
- >>> a = Osc(table=t, freq=2, mul=.25)
- >>> b = SineLoop(freq=[599,600], feedback=0.05, mul=a).out()
-
- """
- def __init__(self, list=[(0, 0.), (8191, 1.)], size=8192):
- PyoTableObject.__init__(self)
- if size < list[-1][0]:
- print "CosLogTable warning : size smaller than last point position."
- print " Increased size to last point position + 1"
- size = list[-1][0] + 1
- self._size = size
- self._base_objs = [CosLogTable_base(list, size)]
-
- def __dir__(self):
- return ['list', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table and rescale the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def replace(self, list):
- """
- Draw a new envelope according to the new `list` parameter.
-
- Parameters:
-
- list : list
- List of tuples indicating location and value of each points
- in the table. Location must be integer.
-
- """
- self._list = list
- [obj.replace(list) for obj in self._base_objs]
-
- def loadRecFile(self, filename, tolerance=0.02):
- """
- Import an automation recording file in the table.
-
- loadRecFile takes a recording file, usually from a ControlRec object,
- as `filename` parameter, applies a filtering pre-processing to eliminate
- redundancies and loads the result in the table as a list of points.
- Filtering process can be controled with the `tolerance` parameter.
-
- Parameters:
-
- filename : string
- Full path of an automation recording file.
- tolerance : float, optional
- Tolerance of the filter. A higher value will eliminate more points.
- Defaults to 0.02.
-
- """
- _path, _name = os.path.split(filename)
- # files = sorted([f for f in os.listdir(_path) if _name+"_" in f])
- # if _name not in files: files.append(_name)
- files = [filename]
- for i, obj in enumerate(self._base_objs):
- p = os.path.join(_path, wrap(files,i))
- f = open(p, "r")
- values = [(float(l.split()[0]), float(l.split()[1])) for l in f.readlines()]
- scl = self._size / values[-1][0]
- values = [(int(v[0]*scl), v[1]) for v in values]
- f.close()
- values = reducePoints(values, tolerance=tolerance)
- self._list = values
- obj.replace(values)
-
- def getPoints(self):
- return self._base_objs[0].getPoints()
-
- def graph(self, yrange=(0.0, 1.0), title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph.
- Defaults to (0.0, 1.0).
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- createGraphWindow(self, 5, self._size, yrange, title, wxnoserver)
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def list(self):
- """list. List of tuples indicating location and value of each points in the table."""
- return self.getPoints()
- @list.setter
- def list(self, x): self.replace(x)
-
-class CosTable(PyoTableObject):
- """
- Construct a table from cosine interpolated segments.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- list : list, optional
- List of tuples indicating location and value of each points
- in the table. The default, [(0,0.), (8191, 1.)], creates a
- cosine line from 0.0 at location 0 to 1.0 at the end of the
- table (size - 1). Location must be an integer.
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table and rescale the envelope.
- replace(list) : Draw a new envelope according to the `list` parameter.
- loadRecFile(filename, tolerance) : Import an automation recording file.
- graph(yrange, title, wxnoserver) : Opens a grapher window to control
- the shape of the envelope.
-
- Notes:
-
- Locations in the list must be in increasing order. If the last value
- is less than size, the rest of the table will be filled with zeros.
-
- Attributes:
-
- list : list
- List of tuples [(location, value), ...].
- size : int, optional
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # Sharp attack envelope
- >>> t = CosTable([(0,0), (100,1), (1000,.25), (8191,0)])
- >>> a = Osc(table=t, freq=2, mul=.25)
- >>> b = SineLoop(freq=[299,300], feedback=0.05, mul=a).out()
-
- """
- def __init__(self, list=[(0, 0.), (8191, 1.)], size=8192):
- PyoTableObject.__init__(self)
- if size < list[-1][0]:
- print "CosTable warning : size smaller than last point position."
- print " Increased size to last point position + 1"
- size = list[-1][0] + 1
- self._size = size
- self._base_objs = [CosTable_base(list, size)]
-
- def __dir__(self):
- return ['list', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table and rescale the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def replace(self, list):
- """
- Draw a new envelope according to the new `list` parameter.
-
- Parameters:
-
- list : list
- List of tuples indicating location and value of each points
- in the table. Location must be integer.
-
- """
- self._list = list
- [obj.replace(list) for obj in self._base_objs]
-
- def loadRecFile(self, filename, tolerance=0.02):
- """
- Import an automation recording file in the table.
-
- loadRecFile takes a recording file, usually from a ControlRec object,
- as `filename` parameter, applies a filtering pre-processing to eliminate
- redundancies and loads the result in the table as a list of points.
- Filtering process can be controled with the `tolerance` parameter.
-
- Parameters:
-
- filename : string
- Full path of an automation recording file.
- tolerance : float, optional
- Tolerance of the filter. A higher value will eliminate more points.
- Defaults to 0.02.
-
- """
- _path, _name = os.path.split(filename)
- # files = sorted([f for f in os.listdir(_path) if _name+"_" in f])
- # if _name not in files: files.append(_name)
- files = [filename]
- for i, obj in enumerate(self._base_objs):
- p = os.path.join(_path, wrap(files,i))
- f = open(p, "r")
- values = [(float(l.split()[0]), float(l.split()[1])) for l in f.readlines()]
- scl = self._size / values[-1][0]
- values = [(int(v[0]*scl), v[1]) for v in values]
- f.close()
- values = reducePoints(values, tolerance=tolerance)
- self._list = values
- obj.replace(values)
-
- def getPoints(self):
- return self._base_objs[0].getPoints()
-
- def graph(self, yrange=(0.0, 1.0), title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph.
- Defaults to (0.0, 1.0).
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- createGraphWindow(self, 1, self._size, yrange, title, wxnoserver)
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def list(self):
- """list. List of tuples indicating location and value of each points in the table."""
- return self.getPoints()
- @list.setter
- def list(self, x): self.replace(x)
-
-class CurveTable(PyoTableObject):
- """
- Construct a table from curve interpolated segments.
-
- CurveTable uses Hermite interpolation (sort of cubic interpolation)
- to calculate each points of the curve. This algorithm allows tension
- and biasing controls. Tension can be used to tighten up the curvature
- at the known points. The bias is used to twist the curve about the
- known points.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- list : list, optional
- List of tuples indicating location and value of each points
- in the table. The default, [(0,0.), (8191, 1.)], creates a
- curved line from 0.0 at location 0 to 1.0 at the end of the
- table (size - 1). Location must be an integer.
- tension : float, optional
- Curvature at the known points. 1 is high, 0 normal, -1 is low.
- Defaults to 0.
- bias : float, optional
- Curve attraction (for each segments) toward bundary points.
- 0 is even, positive is towards first point, negative is towards
- the second point. Defaults to 0.
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table and rescale the envelope.
- setTension(x) : Replace the `tension` attribute.
- setTension(x) : Replace the `bias` attribute.
- replace(list) : Draw a new envelope according to the `list` parameter.
- loadRecFile(filename, tolerance) : Import an automation recording file.
- graph(yrange, title, wxnoserver) : Opens a grapher window to control
- the shape of the envelope.
-
- Notes:
-
- Locations in the list must be in increasing order. If the last value
- is less than size, the rest of the table will be filled with zeros.
-
- High tension or bias values can create unstable or very loud table,
- use normalize method to keep the curve between -1 and 1.
-
- Attributes:
-
- list : list
- List of tuples [(location, value), ...].
- tension : float
- Curvature tension.
- bias : float
- Curve attraction.
- size : int, optional
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = CurveTable([(0,0),(2048,.5),(4096,.2),(6144,.5),(8192,0)], 0, 20)
- >>> t.normalize()
- >>> a = Osc(table=t, freq=2, mul=.25)
- >>> b = SineLoop(freq=[299,300], feedback=0.05, mul=a).out()
-
- """
- def __init__(self, list=[(0, 0.), (8191, 1.)], tension=0, bias=0, size=8192):
- PyoTableObject.__init__(self)
- if size < list[-1][0]:
- print "CurveTable warning : size smaller than last point position."
- print " Increased size to last point position + 1"
- size = list[-1][0] + 1
- self._size = size
- self._tension = tension
- self._bias = bias
- self._base_objs = [CurveTable_base(list, tension, bias, size)]
-
- def __dir__(self):
- return ['list', 'tension', 'bias', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table and rescale the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def setTension(self, x):
- """
- Replace the `tension` attribute.
-
- 1 is high, 0 normal, -1 is low.
-
- Parameters:
-
- x : float
- New `tension` attribute.
-
- """
- self._tension = x
- [obj.setTension(x) for obj in self._base_objs]
-
- def setBias(self, x):
- """
- Replace the `bias` attribute.
-
- 0 is even, positive is towards first point, negative is towards
- the second point.
-
- Parameters:
-
- x : float
- New `bias` attribute.
-
- """
- self._bias = x
- [obj.setBias(x) for obj in self._base_objs]
-
- def replace(self, list):
- """
- Draw a new envelope according to the new `list` parameter.
-
- Parameters:
-
- list : list
- List of tuples indicating location and value of each points
- in the table. Location must be integer.
-
- """
- self._list = list
- [obj.replace(list) for obj in self._base_objs]
-
- def loadRecFile(self, filename, tolerance=0.02):
- """
- Import an automation recording file in the table.
-
- loadRecFile takes a recording file, usually from a ControlRec object,
- as `filename` parameter, applies a filtering pre-processing to eliminate
- redundancies and loads the result in the table as a list of points.
- Filtering process can be controled with the `tolerance` parameter.
-
- Parameters:
-
- filename : string
- Full path of an automation recording file.
- tolerance : float, optional
- Tolerance of the filter. A higher value will eliminate more points.
- Defaults to 0.02.
-
- """
- _path, _name = os.path.split(filename)
- # files = sorted([f for f in os.listdir(_path) if _name+"_" in f])
- # if _name not in files: files.append(_name)
- files = [filename]
- for i, obj in enumerate(self._base_objs):
- p = os.path.join(_path, wrap(files,i))
- f = open(p, "r")
- values = [(float(l.split()[0]), float(l.split()[1])) for l in f.readlines()]
- scl = self._size / values[-1][0]
- values = [(int(v[0]*scl), v[1]) for v in values]
- f.close()
- values = reducePoints(values, tolerance=tolerance)
- self._list = values
- obj.replace(values)
-
- def getPoints(self):
- return self._base_objs[0].getPoints()
-
- def graph(self, yrange=(0.0, 1.0), title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph.
- Defaults to (0.0, 1.0).
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- createGraphWindow(self, 3, self._size, yrange, title, wxnoserver)
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
-
- @property
- def tension(self):
- """float. Curvature tension."""
- return self._tension
- @tension.setter
- def tension(self, x): self.setTension(x)
-
- @property
- def bias(self):
- """float. Curve Attraction."""
- return self._bias
- @bias.setter
- def bias(self, x): self.setBias(x)
-
- @property
- def list(self):
- """list. List of tuples indicating location and value of each points in the table."""
- return self.getPoints()
- @list.setter
- def list(self, x): self.replace(x)
-
-class ExpTable(PyoTableObject):
- """
- Construct a table from exponential interpolated segments.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- list : list, optional
- List of tuples indicating location and value of each points
- in the table. The default, [(0,0.), (8192, 1.)], creates a
- exponential line from 0.0 at location 0 to 1.0 at the end of
- the table. Location must be an integer.
- exp : float, optional
- Exponent factor. Used to control the slope of the curve.
- Defaults to 10.
- inverse : boolean, optional
- If True, downward slope will be inversed. Useful to create
- biexponential curves. Defaults to True.
- size : int, optional
- Table size in samples. Defaults to 8192.
-
- Methods:
-
- setSize(size) : Change the size of the table and rescale the envelope.
- setExp(x) : Replace the `exp` attribute.
- setInverse(x) : Replace the `inverse` attribute.
- replace(list) : Draw a new envelope according to the `list` parameter.
- loadRecFile(filename, tolerance) : Import an automation recording file.
- graph(yrange, title, wxnoserver) : Opens a grapher window to control
- the shape of the envelope.
-
- Notes:
-
- Locations in the list must be in increasing order. If the last value
- is less than size, the rest of the table will be filled with zeros.
-
- Attributes:
-
- list : list
- List of tuples [(location, value), ...].
- exp : float
- Exponent factor.
- inverse : boolean
- Inversion of downward slope.
- size : int, optional
- Table size in samples.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = ExpTable([(0,0),(4096,1),(8192,0)], exp=5, inverse=True)
- >>> a = Osc(table=t, freq=2, mul=.3)
- >>> b = Sine(freq=[299,300], mul=a).out()
-
- """
- def __init__(self, list=[(0, 0.), (8192, 1.)], exp=10, inverse=True, size=8192):
- PyoTableObject.__init__(self)
- if size < list[-1][0]:
- print "ExpTable warning : size smaller than last point position."
- print " Increased size to last point position + 1"
- size = list[-1][0] + 1
- self._size = size
- self._exp = exp
- self._inverse = inverse
- self._base_objs = [ExpTable_base(list, exp, inverse, size)]
-
- def __dir__(self):
- return ['list', 'exp', 'inverse', 'size']
-
- def setSize(self, size):
- """
- Change the size of the table and rescale the envelope.
-
- Parameters:
-
- size : int
- New table size in samples.
-
- """
- self._size = size
- [obj.setSize(size) for obj in self._base_objs]
-
- def setExp(self, x):
- """
- Replace the `exp` attribute.
-
- Parameters:
-
- x : float
- New `exp` attribute.
-
- """
- self._exp = x
- [obj.setExp(x) for obj in self._base_objs]
-
- def setInverse(self, x):
- """
- Replace the `inverse` attribute.
-
- Parameters:
-
- x : boolean
- New `inverse` attribute.
-
- """
- self._inverse = x
- [obj.setInverse(x) for obj in self._base_objs]
-
- def replace(self, list):
- """
- Draw a new envelope according to the new `list` parameter.
-
- Parameters:
-
- list : list
- List of tuples indicating location and value of each points
- in the table. Location must be integer.
-
- """
- self._list = list
- [obj.replace(list) for obj in self._base_objs]
-
- def loadRecFile(self, filename, tolerance=0.02):
- """
- Import an automation recording file in the table.
-
- loadRecFile takes a recording file, usually from a ControlRec object,
- as `filename` parameter, applies a filtering pre-processing to eliminate
- redundancies and loads the result in the table as a list of points.
- Filtering process can be controled with the `tolerance` parameter.
-
- Parameters:
-
- filename : string
- Full path of an automation recording file.
- tolerance : float, optional
- Tolerance of the filter. A higher value will eliminate more points.
- Defaults to 0.02.
-
- """
- _path, _name = os.path.split(filename)
- # files = sorted([f for f in os.listdir(_path) if _name+"_" in f])
- # if _name not in files: files.append(_name)
- files = [filename]
- for i, obj in enumerate(self._base_objs):
- p = os.path.join(_path, wrap(files,i))
- f = open(p, "r")
- values = [(float(l.split()[0]), float(l.split()[1])) for l in f.readlines()]
- scl = self._size / values[-1][0]
- values = [(int(v[0]*scl), v[1]) for v in values]
- f.close()
- values = reducePoints(values, tolerance=tolerance)
- self._list = values
- obj.replace(values)
-
- def getPoints(self):
- return self._base_objs[0].getPoints()
-
- def graph(self, yrange=(0.0, 1.0), title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph.
- Defaults to (0.0, 1.0).
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- createGraphWindow(self, 2, self._size, yrange, title, wxnoserver)
-
- @property
- def size(self):
- """int. Table size in samples."""
- return self._size
- @size.setter
- def size(self, x): self.setSize(x)
- @property
- def exp(self):
- """float. Exponent factor."""
- return self._exp
- @exp.setter
- def exp(self, x): self.setExp(x)
- @property
- def inverse(self):
- """boolean. Inverse factor."""
- return self._inverse
- @inverse.setter
- def inverse(self, x): self.setInverse(x)
- @property
- def list(self):
- """list. List of tuples indicating location and value of each points in the table."""
- return self.getPoints()
- @list.setter
- def list(self, x): self.replace(x)
-
-class SndTable(PyoTableObject):
- """
- Transfers data from a soundfile into a function table.
-
- If `chnl` is None, the table will contain as many table streams as
- necessary to read all channels of the loaded sound.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- path : string, optional
- Full path name of the sound. The defaults, None, creates an empty
- table.
- chnl : int, optional
- Channel number to read in. Available at initialization time only.
- The default (None) reads all channels.
- start : float, optional
- Begins reading at `start` seconds into the file. Available at
- initialization time only. Defaults to 0.
- stop : float, optional
- Stops reading at `stop` seconds into the file. Available at
- initialization time only. The default (None) means the end of
- the file.
-
- Methods:
-
- setSound(path, start, stop) : Load a new sound in the table.
- append(path, crossfade, start, stop) : Append a sound in the table
- with crossfade.
- insert(path, pos, crossfade, start, stop) : Insert a sound in the
- table with crossfade.
- getDur(all) : Return the duration of the sound in seconds.
- getSize(all) : Return the size of the table in samples.
- getRate() : Return the frequency in cps at which the sound will be
- read at its original pitch.
- getEnvelope(points) : Return the amplitude envelope of the table.
- view(title, wxnoserver, mouse_callback) : Opens a window showing the
- contents of the table.
-
- Attributes:
-
- sound : Sound path loaded in the table.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> snd_path = SNDS_PATH + '/transparent.aif'
- >>> t = SndTable(snd_path)
- >>> freq = t.getRate()
- >>> a = Osc(table=t, freq=[freq, freq*.995], mul=.3).out()
-
- """
- def __init__(self, path=None, chnl=None, start=0, stop=None, initchnls=1):
- PyoTableObject.__init__(self)
- self._path = path
- self._chnl = chnl
- self._start = start
- self._stop = stop
- self._size = []
- self._dur = []
- self._base_objs = []
- path, lmax = convertArgsToLists(path)
- if self._path == None:
- self._base_objs = [SndTable_base("", 0, 0) for i in range(initchnls)]
- else:
- for p in path:
- _size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(p)
- if chnl == None:
- if stop == None:
- self._base_objs.extend([SndTable_base(p, i, start) for i in range(_snd_chnls)])
- else:
- self._base_objs.extend([SndTable_base(p, i, start, stop) for i in range(_snd_chnls)])
- else:
- if stop == None:
- self._base_objs.append(SndTable_base(p, chnl, start))
- else:
- self._base_objs.append(SndTable_base(p, chnl, start, stop))
- self._size.append(self._base_objs[-1].getSize())
- self._dur.append(self._size[-1] / float(_snd_sr))
- if lmax == 1:
- self._size = self._base_objs[-1].getSize()
- self._dur = self._size / float(_snd_sr)
-
- def __dir__(self):
- return ['path', 'chnl', 'start', 'stop']
-
- def setSound(self, path, start=0, stop=None):
- """
- Load a new sound in the table.
-
- Keeps the number of channels of the sound loaded at initialization.
- If the new sound has less channels, it will wrap around and load
- the same channels many times. If the new sound has more channels,
- the extra channels will be skipped.
-
- Parameters:
-
- path : string
- Full path of the new sound.
- start : float, optional
- Begins reading at `start` seconds into the file. Defaults to 0.
- stop : float, optional
- Stops reading at `stop` seconds into the file. The default (None)
- means the end of the file.
-
- """
- self._path = path
- if type(path) == ListType:
- self._size = []
- self._dur = []
- path, lmax = convertArgsToLists(path)
- for i, obj in enumerate(self._base_objs):
- p = path[i%lmax]
- _size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(p)
- self._size.append(_size)
- self._dur.append(_dur)
- if stop == None:
- obj.setSound(p, 0, start)
- else:
- obj.setSound(p, 0, start, stop)
- else:
- _size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(path)
- self._size = _size
- self._dur = _dur
- if stop == None:
- [obj.setSound(path, (i%_snd_chnls), start) for i, obj in enumerate(self._base_objs)]
- else:
- [obj.setSound(path, (i%_snd_chnls), start, stop) for i, obj in enumerate(self._base_objs)]
-
- def append(self, path, crossfade=0, start=0, stop=None):
- """
- Append a sound to the one already in the table with crossfade.
-
- Keeps the number of channels of the sound loaded at initialization.
- If the new sound has less channels, it will wrap around and load
- the same channels many times. If the new sound has more channels,
- the extra channels will be skipped.
-
- Parameters:
-
- path : string
- Full path of the new sound.
- crossfade : float, optional
- Crossfade time, in seconds, between the sound already in the table
- and the new one. Defaults to 0.
- start : float, optional
- Begins reading at `start` seconds into the file. Defaults to 0.
- stop : float, optional
- Stops reading at `stop` seconds into the file. The default, None,
- means the end of the file.
-
- """
- if type(path) == ListType:
- self._size = []
- self._dur = []
- path, lmax = convertArgsToLists(path)
- for i, obj in enumerate(self._base_objs):
- p = path[i%lmax]
- _size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(p)
- self._size.append(_size)
- self._dur.append(_dur)
- if stop == None:
- obj.append(p, crossfade, 0, start)
- else:
- obj.append(p, crossfade, 0, start, stop)
- else:
- _size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(path)
- self._size = _size
- self._dur = _dur
- if stop == None:
- [obj.append(path, crossfade, (i%_snd_chnls), start) for i, obj in enumerate(self._base_objs)]
- else:
- [obj.append(path, crossfade, (i%_snd_chnls), start, stop) for i, obj in enumerate(self._base_objs)]
-
- def insert(self, path, pos=0, crossfade=0, start=0, stop=None):
- """
- Insert a sound into the one already in the table with crossfade.
-
- Insert a sound at position `pos`, specified in seconds,
- with crossfading at the beginning and the end of the insertion.
-
- Keeps the number of channels of the sound loaded at initialization.
- If the new sound has less channels, it will wrap around and load
- the same channels many times. If the new sound has more channels,
- the extra channels will be skipped.
-
- Parameters:
-
- path : string
- Full path of the new sound.
- pos : float, optional
- Position in the table, in seconds, where to insert the new sound.
- Defaults to 0.
- crossfade : float, optional
- Crossfade time, in seconds, between the sound already in the table
- and the new one. Defaults to 0.
- start : float, optional
- Begins reading at `start` seconds into the file. Defaults to 0.
- stop : float, optional
- Stops reading at `stop` seconds into the file. The default, None,
- means the end of the file.
-
- """
- if type(path) == ListType:
- self._size = []
- self._dur = []
- path, lmax = convertArgsToLists(path)
- for i, obj in enumerate(self._base_objs):
- p = path[i%lmax]
- _size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(p)
- self._size.append(_size)
- self._dur.append(_dur)
- if stop == None:
- obj.insert(p, pos, crossfade, 0, start)
- else:
- obj.insert(p, pos, crossfade, 0, start, stop)
- else:
- _size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(path)
- self._size = _size
- self._dur = _dur
- if stop == None:
- [obj.insert(path, pos, crossfade, (i%_snd_chnls), start) for i, obj in enumerate(self._base_objs)]
- else:
- [obj.insert(path, pos, crossfade, (i%_snd_chnls), start, stop) for i, obj in enumerate(self._base_objs)]
-
- def getRate(self):
- """
- Return the frequency in cps at which the sound will be read at its
- original pitch.
-
- """
- if type(self._path) == ListType:
- return [obj.getRate() for obj in self._base_objs]
- else:
- return self._base_objs[0].getRate()
-
- def getDur(self, all=True):
- """
- Return the duration of the sound in seconds.
-
- Parameters:
-
- all : boolean
- If the table contains more than one sound and `all` is True,
- returns a list of all durations. Otherwise, returns only the
- first duration as a float.
-
- """
- if type(self._path) == ListType:
- _dur = [1./obj.getRate() for obj in self._base_objs]
- else:
- _dur = 1./self._base_objs[0].getRate()
-
- if all:
- return _dur
- else:
- if type(_dur) == ListType:
- return _dur[0]
- else:
- return _dur
-
- def getSize(self, all=True):
- """
- Return the size of the table in samples.
-
- Parameters:
-
- all : boolean
- If the table contains more than one sound and `all` is True,
- returns a list of all sizes. Otherwise, returns only the
- first size as an int.
-
- """
- if len(self._base_objs) > 1:
- _size = [obj.getSize() for obj in self._base_objs]
- else:
- _size = self._base_objs[0].getSize()
-
- if all:
- return _size
- else:
- if type(_size) == ListType:
- return _size[0]
- else:
- return _size
-
- def getEnvelope(self, points):
- """
- Return the amplitude envelope of the table.
-
- Return a list, of length `chnl`, of lists of length `points` filled
- with the amplitude envelope of the table.
-
- Parameters:
-
- points : int
- Number of points of the amplitude analysis.
-
- """
- return [obj.getEnvelope(points) for obj in self._base_objs]
-
- def view(self, title="Sound waveform", wxnoserver=False, mouse_callback=None):
- """
- Opens a window showing the contents of the table.
-
- Parameters:
-
- title : string, optional
- Window title. Defaults to "Table waveform".
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the table window.
- Defaults to False.
- mouse_callback : callable
- If provided, this function will be called with the mouse
- position, inside the frame, as argument. Defaults to None.
-
- """
- createSndViewTableWindow(self, title, wxnoserver, self.__class__.__name__, mouse_callback)
-
- @property
- def sound(self):
- """string. Full path of the sound."""
- return self._path
- @sound.setter
- def sound(self, x): self.setSound(x)
- @property
- def path(self):
- """string. Full path of the sound."""
- return self._path
- @path.setter
- def path(self, x): self.setSound(x)
- @property
- def chnl(self):
- """int. Channel to read in."""
- return self._chnl
- @chnl.setter
- def chnl(self, x): print "'chnl' attribute is read-only."
- @property
- def start(self):
- """float. Start point, in seconds, to read into the file."""
- return self._start
- @start.setter
- def start(self, x): print "'start' attribute is read-only."
- @property
- def stop(self):
- """float. Stop point, in seconds, to read into the file."""
- return self._stop
- @stop.setter
- def stop(self, x): print "SndTable 'stop' attribute is read-only."
-
-class NewTable(PyoTableObject):
- """
- Create an empty table ready for recording.
-
- See `TableRec` to write samples in the table.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- length : float
- Length of the table in seconds.
- chnls : int, optional
- Number of channels that will be handled by the table.
- Defaults to 1.
- init : list of floats, optional
- Initial table. List of list can match the number of channels,
- otherwise, the list will be loaded in all tablestreams.
- Defaults to None.
- feedback : float, optional
- Amount of old data to mix with a new recording. Defaults to 0.0.
-
- Methods:
-
- getSize() : Returns the length of the table in samples.
- getLength() : Returns the length of the table in seconds.
- getDur() : Returns the length of the table in seconds.
- getRate() : Returns the frequency (cycle per second) to give
- to an oscillator to read the sound at its original pitch.
- replace() : Replaces the actual table.
- setFeedback() : Replace the `feedback` attribute.
-
- Attributes:
-
- feedback : float. Amount of old data to mix with a new recording.
-
- See also: DataTable, TableRec
-
- Examples:
-
- >>> s = Server(duplex=1).boot()
- >>> s.start()
- >>> t = NewTable(length=2, chnls=1)
- >>> a = Input(0)
- >>> b = TableRec(a, t, .01)
- >>> amp = Iter(b["trig"], [.5])
- >>> freq = t.getRate()
- >>> c = Osc(table=t, freq=[freq, freq*.99], mul=amp).out()
- >>> # to record in the empty table, call:
- >>> # b.play()
-
- """
- def __init__(self, length, chnls=1, init=None, feedback=0.0):
- PyoTableObject.__init__(self)
- self._length = length
- self._chnls = chnls
- self._init = init
- self._feedback = feedback
- if init == None:
- self._base_objs = [NewTable_base(length, feedback=feedback) for i in range(chnls)]
- else:
- if type(init[0]) != ListType:
- init = [init]
- self._base_objs = [NewTable_base(length, wrap(init,i), feedback) for i in range(chnls)]
-
- def __dir__(self):
- return ['length', 'chnls', 'init', 'feedback']
-
- def replace(self, x):
- """
- Replaces the actual table.
-
- Parameters:
-
- x : list of floats
- New table. Must be of the same size as the actual table.
- List of list can match the number of channels, otherwise,
- the list will be loaded in all tablestreams.
-
- """
- if type(x[0]) != ListType:
- x = [x]
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setFeedback(self, x):
- """
- Replaces the`feedback` attribute.
-
- Parameters:
-
- x : float
- New `feedback` value.
-
- """
- self._feedback = x
- [obj.setFeedback(x) for i, obj in enumerate(self._base_objs)]
-
- def getSize(self):
- """
- Returns the length of the table in samples.
-
- """
- return self._base_objs[0].getSize()
-
- def getLength(self):
- """
- Returns the length of the table in seconds.
-
- """
- return self._base_objs[0].getLength()
-
- def getDur(self):
- """
- Returns the length of the table in seconds.
-
- """
- return self._base_objs[0].getLength()
-
- def getRate(self):
- """
- Returns the frequency (cycle per second) to give to an
- oscillator to read the sound at its original pitch.
-
- """
- return self._base_objs[0].getRate()
-
- def view(self, title="Sound waveform", wxnoserver=False, mouse_callback=None):
- """
- Opens a window showing the contents of the table.
-
- Parameters:
-
- title : string, optional
- Window title. Defaults to "Table waveform".
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the table window.
- Defaults to False.
- mouse_callback : callable
- If provided, this function will be called with the mouse
- position, inside the frame, as argument. Defaults to None.
-
- """
- createSndViewTableWindow(self, title, wxnoserver, self.__class__.__name__, mouse_callback)
-
- @property
- def length(self):
- """float. Length of the table in seconds."""
- return self._length
- @length.setter
- def length(self, x): print "'length' attribute is read-only."
- @property
- def chnls(self):
- """int. Number of channels that will be handled by the table."""
- return self._chnls
- @chnls.setter
- def chnls(self, x): print "'chnls' attribute is read-only."
- @property
- def init(self):
- """list of floats. Initial table."""
- return self._init
- @init.setter
- def init(self, x): print "'init' attribute is read-only."
- @property
- def feedback(self):
- """float. Amount of old data to mix with a new recording."""
- return self._feedback
- @feedback.setter
- def feedback(self, x): self.setFeedback(x)
-
-class DataTable(PyoTableObject):
- """
- Create an empty table ready for data recording.
-
- See `TableRec` to write samples in the table.
-
- Parentclass: PyoTableObject
-
- Parameters:
-
- size : int
- Size of the table in samples.
- chnls : int, optional
- Number of channels that will be handled by the table.
- Defaults to 1.
- init : list of floats, optional
- Initial table. List of list can match the number of channels,
- otherwise, the list will be loaded in all tablestreams.
- Defaults to None.
-
- Methods:
-
- getSize() : Returns the length of the table in samples.
- getRate() : Returns the frequency (cycle per second) to give
- to an oscillator to read the sound at its original pitch.
- replace() : Replaces the actual table.
-
- See also: NewTable, TableRec
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> import random
- >>> notes = [midiToHz(random.randint(48,72)) for i in range(10)]
- >>> tab = DataTable(size=10, init=notes)
- >>> ind = RandInt(10, 8)
- >>> pit = TableIndex(tab, ind)
- >>> a = SineLoop(freq=[pit,pit*0.99], feedback = 0.07, mul=.2).out()
-
- """
- def __init__(self, size, chnls=1, init=None):
- PyoTableObject.__init__(self)
- self._size = size
- self._chnls = chnls
- self._init = init
- if init == None:
- self._base_objs = [DataTable_base(size) for i in range(chnls)]
- else:
- if type(init[0]) != ListType:
- init = [init]
- self._base_objs = [DataTable_base(size, wrap(init,i)) for i in range(chnls)]
-
-
- def __dir__(self):
- return ['size', 'chnls', 'init']
-
- def replace(self, x):
- """
- Replaces the actual table.
-
- Parameters:
-
- x : list of floats
- New table. Must be of the same size as the actual table.
- List of list can match the number of channels, otherwise,
- the list will be loaded in all tablestreams.
-
- """
- if type(x[0]) != ListType:
- x = [x]
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def getSize(self):
- """
- Returns the length of the table in samples.
-
- """
- return self._base_objs[0].getSize()
-
- def getRate(self):
- """
- Returns the frequency (cycle per second) to give to an
- oscillator to read the sound at its original pitch.
-
- """
- return self._base_objs[0].getRate()
-
- @property
- def size(self):
- """int. Length of the table in samples."""
- return self._size
- @size.setter
- def size(self, x): print "'size' attribute is read-only."
- @property
- def chnls(self):
- """int. Number of channels that will be handled by the table."""
- return self._chnls
- @chnls.setter
- def chnls(self, x): print "'chnls' attribute is read-only."
- @property
- def init(self):
- """list of floats. Initial table."""
- return self._init
- @init.setter
- def init(self, x): print "'init' attribute is read-only."
-
diff --git a/build/lib.linux-x86_64-2.7/pyolib/triggers.py b/build/lib.linux-x86_64-2.7/pyolib/triggers.py
deleted file mode 100644
index 7bbad47..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/triggers.py
+++ /dev/null
@@ -1,3435 +0,0 @@
-"""
-Set of objects to manage triggers streams.
-
-A trigger is an audio signal with a value of 1 surrounded by 0s.
-
-TrigXXX objects use this kind of signal to generate different
-processes with sampling rate time accuracy.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-import sys
-from _core import *
-from _maps import *
-from _widgets import createGraphWindow
-from types import SliceType, ListType, TupleType
-
-class Trig(PyoObject):
- """
- Sends one trigger.
-
- A trigger is an audio signal with a value of 1 surrounded by 0s.
-
- Trig sends a trigger each time it's play() method is called.
-
- Parentclass: PyoObject
-
- Parameters:
-
- Methods:
-
- Attributes:
-
- Notes:
-
- The out() method is bypassed. Trig's signal can not be sent to audio outs.
-
- Trig has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Trig()
- >>> env = HannTable()
- >>> tenv = TrigEnv(a, table=env, dur=5, mul=.3)
- >>> n = Noise(tenv).out()
-
- """
- def __init__(self):
- PyoObject.__init__(self)
- self._base_objs = [Trig_base()]
-
- def __dir__(self):
- return []
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setSub(self, x):
- pass
-
- def setDiv(self, x):
- pass
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class Metro(PyoObject):
- """
- Generates isochronous trigger signals.
-
- A trigger is an audio signal with a value of 1 surrounded by 0s.
-
- The play() method starts the metro and is not called at the object
- creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- time : float or PyoObject, optional
- Time between each trigger in seconds. Defaults to 1.
- poly : int, optional
- Metronome polyphony. Denotes how many independent streams are
- generated by the metronome, allowing overlapping processes.
- Available only at initialization. Defaults to 1.
-
- Methods:
-
- setTime(x) : Replace the `time` attribute.
-
- Attributes:
-
- time : float or PyoObject. Time between each trigger in seconds.
-
- Notes:
-
- The out() method is bypassed. Metro's signal can not be sent to audio outs.
-
- Metro has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = CosTable([(0,0), (50,1), (250,.3), (8191,0)])
- >>> met = Metro(time=.125, poly=2).play()
- >>> amp = TrigEnv(met, table=t, dur=.25, mul=.3)
- >>> freq = TrigRand(met, min=400, max=1000)
- >>> a = Sine(freq=freq, mul=amp).out()
-
- """
- def __init__(self, time=1, poly=1):
- PyoObject.__init__(self)
- self._time = time
- self._poly = poly
- time, lmax = convertArgsToLists(time)
- self._base_objs = [Metro_base(wrap(time,i)*poly, (float(j)/poly)) for i in range(lmax) for j in range(poly)]
-
- def __dir__(self):
- return ['time']
-
- def setTime(self, x):
- """
- Replace the `time` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `time` attribute.
-
- """
- self._time = x
- x, lmax = convertArgsToLists(x)
- [obj.setTime(wrap(x,i)*self._poly) for i, obj in enumerate(self._base_objs)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setSub(self, x):
- pass
-
- def setDiv(self, x):
- pass
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0.001, 1., 'log', 'time', self._time)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def time(self):
- """float or PyoObject. Time between each trigger in seconds."""
- return self._time
- @time.setter
- def time(self, x): self.setTime(x)
-
-class Seq(PyoObject):
- """
- Generates a rhythmic sequence of trigger signals.
-
- A trigger is an audio signal with a value of 1 surrounded by 0s.
-
- The play() method starts the sequence and is not called at the object
- creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- time : float or PyoObject, optional
- Base time between each trigger in seconds. Defaults to 1.
- seq : list of ints, optional
- Sequence of beat durations in time's unit. Defaults to [1].
- poly : int, optional
- Seq polyphony. Denotes how many independent streams are
- generated by the metronome, allowing overlapping processes.
- Available only at initialization. Defaults to 1.
-
- Methods:
-
- setTime(x) : Replace the `time` attribute.
- setSeq(x) ; Replace the `seq` attribute.
-
- Attributes:
-
- time : float or PyoObject. Base time between each trigger in seconds.
- seq : list of ints. Sequence of beat durations in time's unit.
-
- Notes:
-
- The out() method is bypassed. Seq's signal can not be sent to audio outs.
-
- Seq has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> env = CosTable([(0,0),(300,1),(1000,.3),(8191,0)])
- >>> seq = Seq(time=.125, seq=[2,1,1,2], poly=2).play()
- >>> tr = TrigRand(seq, min=250, max=500, port=.005)
- >>> amp = TrigEnv(seq, table=env, dur=.25, mul=.25)
- >>> a = SineLoop(tr, feedback=0.07, mul=amp).out()
-
- """
- def __init__(self, time=1, seq=[1], poly=1):
- PyoObject.__init__(self)
- if type(seq) != ListType:
- print >> sys.stderr, 'TypeError: "seq" argument of %s must be a list.\n' % self.__class__.__name__
- exit()
- self._time = time
- self._seq = seq
- self._poly = poly
- time, lmax = convertArgsToLists(time)
- if type(seq[0]) != ListType:
- self._base_players = [Seqer_base(wrap(time,i), seq, poly) for i in range(lmax)]
- else:
- seqlen = len(seq)
- lmax = max(seqlen, lmax)
- self._base_players = [Seqer_base(wrap(time,i), wrap(seq,i), poly) for i in range(lmax)]
- self._base_objs = [Seq_base(wrap(self._base_players,j), i) for i in range(poly) for j in range(lmax)]
-
- def __dir__(self):
- return ['time', 'seq']
-
- def setTime(self, x):
- """
- Replace the `time` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `time` attribute.
-
- """
- self._time = x
- x, lmax = convertArgsToLists(x)
- [obj.setTime(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setSeq(self, x):
- """
- Replace the `seq` attribute.
-
- Parameters:
-
- x : list of ints
- New `seq` attribute.
-
- """
- self._seq = x
- if type(x[0]) != ListType:
- [obj.setSeq(x) for i, obj in enumerate(self._base_players)]
- else:
- [obj.setSeq(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setSub(self, x):
- pass
-
- def setDiv(self, x):
- pass
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0.001, 10., 'log', 'time', self._time)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def time(self):
- """float or PyoObject. Base time between each trigger in seconds."""
- return self._time
- @time.setter
- def time(self, x): self.setTime(x)
-
- @property
- def seq(self):
- """List of ints. Sequence of beat durations in time's unit."""
- return self._seq
- @seq.setter
- def seq(self, x): self.setSeq(x)
-
-class Cloud(PyoObject):
- """
- Generates random triggers.
-
- Generates random triggers with control over the generation density.
-
- A trigger is an audio signal with a value of 1 surrounded by 0s.
-
- The play() method starts the Cloud and is not called at the object
- creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- density : float or PyoObject, optional
- Average number of triggers per second. Defaults to 10.
- poly : int, optional
- Cloud polyphony. Denotes how many independent streams are
- generated by the object, allowing overlapping processes.
- Available only at initialization. Defaults to 1.
-
- Methods:
-
- setDensity(x) : Replace the `density` attribute.
-
- Attributes:
-
- density : float or PyoObject. Average number of triggers per second.
-
- Notes:
-
- The out() method is bypassed. Cloud's signal can not be sent to audio outs.
-
- Cloud has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> dens = Expseg([(0,1),(5,50)], loop=True, exp=5, initToFirstVal=True).play()
- >>> m = Cloud(density=dens, poly=2).play()
- >>> tr = TrigRand(m, min=300, max=1000)
- >>> tr_p = Port(tr, risetime=0.001, falltime=0.001)
- >>> a = Sine(freq=tr, mul=0.2).out()
-
- """
- def __init__(self, density=10, poly=1):
- PyoObject.__init__(self)
- self._density = density
- self._poly = poly
- density, lmax = convertArgsToLists(density)
- self._base_players = [Clouder_base(wrap(density,i), poly) for i in range(lmax)]
- self._base_objs = [Cloud_base(wrap(self._base_players,j), i) for i in range(poly) for j in range(lmax)]
-
- def __dir__(self):
- return ['density']
-
- def setDensity(self, x):
- """
- Replace the `density` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `density` attribute.
-
- """
- self._density = x
- x, lmax = convertArgsToLists(x)
- [obj.setDensity(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setSub(self, x):
- pass
-
- def setDiv(self, x):
- pass
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0, 100., 'lin', 'density', self._density)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def density(self):
- """float or PyoObject. Average density of triggers generation."""
- return self._density
- @density.setter
- def density(self, x): self.setDensity(x)
-
-class Beat(PyoObject):
- """
- Generates algorithmic trigger patterns.
-
- A trigger is an audio signal with a value of 1 surrounded by 0s.
-
- Beat generates measures of length `taps` and uses weight parameters
- (`w1`, `w2` and `w3`) to compute the chances of a beat to be present
- in the generated measure.
-
- User can store the current pattern in one of the 32 preset slots with
- the store() method and recall it later with recall(x).
-
- A preset is a list where the first value is the number of beats in the
- measure, followed by 1s and 0s. For a 4/4 measure with only down beats:
-
- [16, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]
-
- The play() method starts the Beat and is not called at the object
- creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- time : float or PyoObject, optional
- Time, in seconds, between each beat of the pattern. Defaults to 0.125.
- taps : int, optional
- Number of beats in the generated pattern, max = 64. Defaults to 16.
- w1 : int {0 -> 100}, optional
- Probability for down beats. Defaults to 80.
- w2 : int {0 -> 100}, optional
- Probability for up beats. Defaults to 50.
- w3 : int {0 -> 100}, optional
- Probability for the weakest beats. Defaults to 30.
- poly : int, optional
- Beat polyphony. Denotes how many independent streams are
- generated by the object, allowing overlapping processes.
- Available only at initialization. Defaults to 1.
-
- Methods:
-
- setTime(x) : Replace the `time` attribute.
- setTaps(x) : Replace the `taps` attribute.
- setW1(x) : Replace the `w1` attribute.
- setW2(x) : Replace the `w2` attribute.
- setW3(x) : Replace the `w3` attribute.
- setWeights(w1, w2, w3) : Replace the weight attributes.
- new() : Generates a new pattern with the current parameters.
- fill() : Generates a fill-in pattern and then restore the current one.
- store(x) : Store the current pattern in memory `x`.
- recall(x) : Recall the pattern previously stored in memory `x`.
- getPresets() : Returns the list of stored presets.
- setPresets(list) : Store a list of presets.
- get(identifier, all) : Return the first sample of the current
- buffer as a float.
-
- Attributes:
-
- time : float or PyoObject. Time, in seconds, between each tap of the pattern.
- taps : int. Number of taps in the generated pattern.
- w1 : Probability for down beats.
- w2 : Probability for up beats.
- w3 : Probability for other beats.
-
- Notes:
-
- Beat outputs many signals identified with a string between brackets:
-
- obj['tap'] returns audio stream of the current tap of the measure.
- obj['amp'] returns audio stream of the current beat amplitude.
- obj['dur'] returns audio stream of the current beat duration in seconds.
- obj['end'] returns audio stream with a trigger just before the end of the measure.
-
- obj without brackets returns the generated trigger stream of the measure.
-
- The out() method is bypassed. Beat's signal can not be sent to audio outs.
-
- Beat has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = CosTable([(0,0), (100,1), (500,.3), (8191,0)])
- >>> beat = Beat(time=.125, taps=16, w1=[90,80], w2=50, w3=35, poly=1).play()
- >>> trmid = TrigXnoiseMidi(beat, dist=12, mrange=(60, 96))
- >>> trhz = Snap(trmid, choice=[0,2,3,5,7,8,10], scale=1)
- >>> tr2 = TrigEnv(beat, table=t, dur=beat['dur'], mul=beat['amp'])
- >>> a = Sine(freq=trhz, mul=tr2*0.3).out()
-
- """
- def __init__(self, time=.125, taps=16, w1=80, w2=50, w3=30, poly=1):
- PyoObject.__init__(self)
- self._tap_dummy = []
- self._amp_dummy = []
- self._dur_dummy = []
- self._end_dummy = []
- self._time = time
- self._taps = taps
- self._w1 = w1
- self._w2 = w2
- self._w3 = w3
- self._poly = poly
- time, taps, w1, w2, w3, lmax = convertArgsToLists(time, taps, w1, w2, w3)
- self._base_players = [Beater_base(wrap(time,i), wrap(taps,i), wrap(w1,i), wrap(w2,i), wrap(w3,i), poly) for i in range(lmax)]
- self._base_objs = [Beat_base(wrap(self._base_players,j), i) for i in range(poly) for j in range(lmax)]
- self._tap_objs = [BeatTapStream_base(wrap(self._base_players,j), i) for i in range(poly) for j in range(lmax)]
- self._amp_objs = [BeatAmpStream_base(wrap(self._base_players,j), i) for i in range(poly) for j in range(lmax)]
- self._dur_objs = [BeatDurStream_base(wrap(self._base_players,j), i) for i in range(poly) for j in range(lmax)]
- self._end_objs = [BeatEndStream_base(wrap(self._base_players,j), i) for i in range(poly) for j in range(lmax)]
-
- def __dir__(self):
- return ['time', 'taps', 'w1', 'w2', 'w3']
-
- def __getitem__(self, i):
- if i == 'tap':
- self._tap_dummy.append(Dummy([obj for obj in self._tap_objs]))
- return self._tap_dummy[-1]
- if i == 'amp':
- self._amp_dummy.append(Dummy([obj for obj in self._amp_objs]))
- return self._amp_dummy[-1]
- if i == 'dur':
- self._dur_dummy.append(Dummy([obj for obj in self._dur_objs]))
- return self._dur_dummy[-1]
- if i == 'end':
- self._end_dummy.append(Dummy([obj for obj in self._end_objs]))
- return self._end_dummy[-1]
- if type(i) == SliceType:
- return self._base_objs[i]
- if i < len(self._base_objs):
- return self._base_objs[i]
- else:
- print "'i' too large!"
-
- def get(self, identifier="amp", all=False):
- """
- Return the first sample of the current buffer as a float.
-
- Can be used to convert audio stream to usable Python data.
-
- "tap", "amp" or "dur" must be given to `identifier` to specify
- which stream to get value from.
-
- Parameters:
-
- identifier : string {"tap", "amp", "dur"}
- Address string parameter identifying audio stream.
- Defaults to "amp".
- all : boolean, optional
- If True, the first value of each object's stream
- will be returned as a list. Otherwise, only the value
- of the first object's stream will be returned as a float.
- Defaults to False.
-
- """
- if not all:
- return self.__getitem__(identifier)[0]._getStream().getValue()
- else:
- return [obj._getStream().getValue() for obj in self.__getitem__(identifier).getBaseObjects()]
-
- def new(self):
- """
- Generates a new pattern with the current parameters.
-
- """
- [obj.new() for i, obj in enumerate(self._base_players)]
-
- def fill(self):
- """
- Generates a fill-in pattern and then restore the current one.
-
- """
- [obj.fill() for i, obj in enumerate(self._base_players)]
-
- def store(self, x):
- """
- Store the current pattern in memory `x`.
-
- Parameters:
-
- x : int
- Memory number. 0 <= x < 32.
-
- """
- [obj.store(x) for i, obj in enumerate(self._base_players)]
-
- def recall(self, x):
- """
- Recall the pattern previously stored in memory `x`.
-
- Parameters:
-
- x : int
- Memory number. 0 <= x < 32.
-
- """
- [obj.recall(x) for i, obj in enumerate(self._base_players)]
-
- def getPresets(self):
- """
- Returns the list of stored presets.
-
- """
- if len(self._base_players) == 1:
- return self._base_players[0].getPresets()
- else:
- return [obj.getPresets() for obj in self._base_players]
-
- def setPresets(self, x):
- """
- Store a list presets.
-
- Parameters:
-
- x : list
- List of presets.
-
- """
- if len(self._base_players) == 1:
- return self._base_players[0].setPresets(x)
- else:
- return [obj.setPresets(x[i]) for i, obj in enumerate(self._base_players)]
-
- def setTime(self, x):
- """
- Replace the `time` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `time` attribute.
-
- """
- self._time = x
- x, lmax = convertArgsToLists(x)
- [obj.setTime(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setTaps(self, x):
- """
- Replace the `taps` attribute.
-
- Parameters:
-
- x : int
- New `taps` attribute.
-
- """
- self._taps = x
- x, lmax = convertArgsToLists(x)
- [obj.setTaps(wrap(x,i)) for i, obj in enumerate(self._base_players)]
-
- def setW1(self, x):
- """
- Replace the `w1` attribute.
-
- Parameters:
-
- x : int
- New `w1` attribute.
-
- """
- self.setWeights(w1=x)
-
- def setW2(self, x):
- """
- Replace the `w2` attribute.
-
- Parameters:
-
- x : int
- New `w2` attribute.
-
- """
- self.setWeights(w2=x)
-
- def setW3(self, x):
- """
- Replace the `w3` attribute.
-
- Parameters:
-
- x : int
- New `w3` attribute.
-
- """
- self.setWeights(w3=x)
-
- def setWeights(self, w1=None, w2=None, w3=None):
- """
- Replace the weight attributes.
-
- Arguments set to `None` remain unchanged.
-
- Parameters:
-
- w1 : int, optional
- New `w1` attribute. Defaults to None.
- w2 : int, optional
- New `w2` attribute. Defaults to None.
- w3 : int, optional
- New `w3` attribute. Defaults to None.
-
- """
- if w1 != None: self._w1 = w1
- if w2 != None: self._w2 = w2
- if w3 != None: self._w3 = w3
- w1, w2, w3, lmax = convertArgsToLists(w1, w2, w3)
- [obj.setWeights(wrap(w1,i), wrap(w2,i), wrap(w3,i)) for i, obj in enumerate(self._base_players)]
-
- def play(self, dur=0, delay=0):
- dur, delay, lmax = convertArgsToLists(dur, delay)
- self._tap_objs = [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._tap_objs)]
- self._amp_objs = [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._amp_objs)]
- self._dur_objs = [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._dur_objs)]
- self._end_objs = [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._end_objs)]
- return PyoObject.play(self, dur, delay)
-
- def stop(self):
- [obj.stop() for obj in self._tap_objs]
- [obj.stop() for obj in self._amp_objs]
- [obj.stop() for obj in self._dur_objs]
- [obj.stop() for obj in self._end_objs]
- return PyoObject.stop(self)
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setSub(self, x):
- pass
-
- def setDiv(self, x):
- pass
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0.001, 1., 'lin', 'time', self._time)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def time(self):
- """float or PyoObject. Time, in seconds, between each beat."""
- return self._time
- @time.setter
- def time(self, x): self.setTime(x)
-
- @property
- def taps(self):
- """int. Number of beats in the generated pattern."""
- return self._taps
- @taps.setter
- def taps(self, x): self.setTaps(x)
-
- @property
- def w1(self):
- """int. Probability for down beats."""
- return self._w1
- @w1.setter
- def w1(self, x): self.setW1(x)
-
- @property
- def w2(self):
- """int. Probability for up beats."""
- return self._w2
- @w2.setter
- def w2(self, x): self.setW2(x)
-
- @property
- def w3(self):
- """int. Probability for other beats."""
- return self._w3
- @w3.setter
- def w3(self, x): self.setW3(x)
-
-class TrigRandInt(PyoObject):
- """
- Pseudo-random integer generator.
-
- TrigRandInt generates a pseudo-random number integer number between
- 0 and `max` values each time it receives a trigger in its `input`
- parameter. The value is kept until the next trigger.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- max : float or PyoObject, optional
- Maximum value for the random generation. Defaults to 100.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMax(x) : Replace the `max` attribute.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- max : float or PyoObject. Maximum value.
-
- Notes:
-
- The out() method is bypassed. TrigRandInt's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = CosTable([(0,0), (50,1), (250,.3), (8191,0)])
- >>> met = Metro(.125, poly=2).play()
- >>> amp = TrigEnv(met, table=t, dur=.25, mul=.3)
- >>> tr = TrigRandInt(met, max=10, mul=100, add=200)
- >>> a = Sine(tr, mul=amp).out()
-
- """
- def __init__(self, input, max=100., mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._max = max
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, max, mul, add, lmax = convertArgsToLists(self._in_fader, max, mul, add)
- self._base_objs = [TrigRandInt_base(wrap(in_fader,i), wrap(max,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'max', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(1., 200., 'lin', 'max', self._max),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
-
-class TrigRand(PyoObject):
- """
- Pseudo-random number generator.
-
- TrigRand generates a pseudo-random number between `min` and `max`
- values each time it receives a trigger in its `input` parameter.
- The value is kept until the next trigger.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- min : float or PyoObject, optional
- Minimum value for the random generation. Defaults to 0.
- max : float or PyoObject, optional
- Maximum value for the random generation. Defaults to 1.
- port : float, optional
- Portamento. Time to reach a new value. Defaults to 0.
- init : float, optional
- Initial value. Available at initialization time only.
- Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
- setPort(x) : Replace the `port` attribute.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- min : float or PyoObject. Minimum value.
- max : float or PyoObject. Maximum value.
- port : float. Ramp time.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = CosTable([(0,0), (50,1), (250,.3), (8191,0)])
- >>> met = Metro(.125, poly=2).play()
- >>> amp = TrigEnv(met, table=t, dur=.25, mul=.3)
- >>> tr = TrigRand(met, 400, 600)
- >>> a = Sine(tr, mul=amp).out()
-
- """
- def __init__(self, input, min=0., max=1., port=0., init=0., mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._min = min
- self._max = max
- self._port = port
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, min, max, port, init, mul, add, lmax = convertArgsToLists(self._in_fader, min, max, port, init, mul, add)
- self._base_objs = [TrigRand_base(wrap(in_fader,i), wrap(min,i), wrap(max,i), wrap(port,i), wrap(init,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'min', 'max', 'port', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPort(self, x):
- """
- Replace the `port` attribute.
-
- Parameters:
-
- x : float
- new `port` attribute.
-
- """
- self._port = x
- x, lmax = convertArgsToLists(x)
- [obj.setPort(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', 'min', self._min),
- SLMap(1., 2., 'lin', 'max', self._max),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def min(self): return self._min
- @min.setter
- def min(self, x): self.setMin(x)
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
- @property
- def port(self): return self._port
- @port.setter
- def port(self, x): self.setPort(x)
-
-class TrigChoice(PyoObject):
- """
- Random generator from user's defined values.
-
- TrigChoice chooses randomly a new value in list `choice` each
- time it receives a trigger in its `input` parameter. The value
- is kept until the next trigger.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- choice : list of floats
- Possible values for the random generation.
- port : float, optional
- Portamento. Time to reach a new value. Defaults to 0.
- init : float, optional
- Initial value. Available at initialization time only.
- Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setChoice(x) : Replace the `choice` attribute.
- setPort(x) : Replace the `port` attribute.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- choice : list of floats. Possible values.
- port : float. Ramp time.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = CosTable([(0,0), (50,1), (250,.3), (8191,0)])
- >>> met = Metro(.125, poly=2).play()
- >>> freq = TrigChoice(met, [300, 350, 400, 450, 500, 550])
- >>> amp = TrigEnv(met, table=t, dur=.25, mul=.3)
- >>> a = Sine(freq=freq, mul=amp).out()
-
- """
- def __init__(self, input, choice, port=0., init=0., mul=1, add=0):
- PyoObject.__init__(self)
- if type(choice) != ListType:
- print >> sys.stderr, 'TypeError: "choice" argument of %s must be a list.\n' % self.__class__.__name__
- exit()
- self._input = input
- self._choice = choice
- self._port = port
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, port, init, mul, add, lmax = convertArgsToLists(self._in_fader, port, init, mul, add)
- if type(choice[0]) != ListType:
- self._base_objs = [TrigChoice_base(wrap(in_fader,i), choice, wrap(port,i), wrap(init,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- else:
- choicelen = len(choice)
- lmax = max(choicelen, lmax)
- self._base_objs = [TrigChoice_base(wrap(in_fader,i), wrap(choice,i), wrap(port,i), wrap(init,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'choice', 'port', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setChoice(self, x):
- """
- Replace the `choice` attribute.
-
- Parameters:
-
- x : list of floats
- new `choice` attribute.
-
- """
- self._choice = x
- if type(x[0]) != ListType:
- [obj.setChoice(self._choice) for i, obj in enumerate(self._base_objs)]
- else:
- [obj.setChoice(wrap(self._choice,i)) for i, obj in enumerate(self._base_objs)]
-
- def setPort(self, x):
- """
- Replace the `port` attribute.
-
- Parameters:
-
- x : float
- new `port` attribute.
-
- """
- self._port = x
- x, lmax = convertArgsToLists(x)
- [obj.setPort(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def choice(self): return self._choice
- @choice.setter
- def choice(self, x): self.setChoice(x)
- @property
- def port(self): return self._port
- @port.setter
- def port(self, x): self.setPort(x)
-
-class TrigFunc(PyoObject):
- """
- Python function callback.
-
- TrigFunc calls the function given at parameter `function` each
- time it receives a trigger in its `input` parameter.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- function : Python function
- Function to be called.
- arg : anything, optional
- Argument sent to the function's call. If None, the function
- will be called without argument. Defaults to None.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setFunction(x) : Replace the `function` attribute.
- setArg(x) : Replace the `arg` attribute.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- function : Python function. Function to be called.
- arg : Anything. Function's argument.
-
- Notes:
-
- The out() method is bypassed. TrigFunc's signal can not be sent
- to audio outs.
-
- TrigFunc has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> f = Fader(fadein=.005, fadeout=.1, dur=.12, mul=.2)
- >>> a = SineLoop(midiToHz([60,60]), feedback=0.05, mul=f).out()
- >>> c = 0.0
- >>> def count():
- ... global c
- ... freq = midiToHz(round(c) + 60)
- ... a.freq = [freq, freq*0.995]
- ... c += 1.77
- ... if c > 13: c = 0
- ... f.play()
- >>> m = Metro(.125).play()
- >>> tf = TrigFunc(m, count)
-
- """
- def __init__(self, input, function, arg=None):
- PyoObject.__init__(self)
- if type(function) == ListType or type(function) == TupleType:
- if not callable(function[0]):
- print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
- exit()
- else:
- if not callable(function):
- print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
- exit()
- self._input = input
- self._function = function
- self._arg = arg
- self._in_fader = InputFader(input)
- in_fader, function, arg, lmax = convertArgsToLists(self._in_fader, function, arg)
- self._base_objs = [TrigFunc_base(wrap(in_fader,i), wrap(function,i), wrap(arg,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'function', 'arg']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setMul(self, x):
- pass
-
- def setAdd(self, x):
- pass
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setFunction(self, x):
- """
- Replace the `function` attribute.
-
- Parameters:
-
- x : Python function
- new `function` attribute.
-
- """
- self._function = x
- x, lmax = convertArgsToLists(x)
- [obj.setFunction(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setArg(self, x):
- """
- Replace the `arg` attribute.
-
- Parameters:
-
- x : Anything
- new `arg` attribute.
-
- """
- self._arg = x
- x, lmax = convertArgsToLists(x)
- [obj.setArg(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def function(self): return self._function
- @function.setter
- def function(self, x): self.setFunction(x)
- @property
- def arg(self): return self._arg
- @arg.setter
- def arg(self, x): self.setArg(x)
-
-class TrigEnv(PyoObject):
- """
- Envelope reader generator.
-
- TrigEnv starts reading an envelope in `dur` seconds each time it
- receives a trigger in its `input` parameter.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- table : PyoTableObject
- Table containing the envelope.
- dur : float or PyoObject, optional
- Duration in seconds of the envelope. Defaults to 1.
- interp : int, optional
- Choice of the interpolation method. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setTable(x) : Replace the `table` attribute.
- setDur(x) : Replace the `dur` attribute.
- setInterp(x) : Replace the `interp` attribute.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- table : PyoTableObject. Envelope table.
- dur : float or PyoObject. Duration in seconds.
- interp : int {1, 2, 3, 4}, Interpolation method.
-
- Notes:
-
- TrigEnv will sends a trigger signal at the end of the playback.
- User can retreive the trigger streams by calling obj['trig'].
- Useful to synchronize other processes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> env = HannTable()
- >>> m = Metro(.125, poly=2).play()
- >>> tr = TrigRand(m, 400, 600)
- >>> te = TrigEnv(m, table=env, dur=.25, mul=.2)
- >>> a = Sine(tr, mul=te).out()
-
- """
- def __init__(self, input, table, dur=1, interp=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._table = table
- self._dur = dur
- self._interp = interp
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, table, dur, interp, mul, add, lmax = convertArgsToLists(self._in_fader, table, dur, interp, mul, add)
- self._base_objs = [TrigEnv_base(wrap(in_fader,i), wrap(table,i), wrap(dur,i), wrap(interp,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
-
- def __dir__(self):
- return ['input', 'table', 'dur', 'interp', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setTable(self, x):
- """
- Replace the `table` attribute.
-
- Parameters:
-
- x : PyoTableObject
- new `table` attribute.
-
- """
- self._table = x
- x, lmax = convertArgsToLists(x)
- [obj.setTable(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDur(self, x):
- """
- Replace the `dur` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `dur` attribute.
-
- """
- self._dur = x
- x, lmax = convertArgsToLists(x)
- [obj.setDur(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int {1, 2, 3, 4}
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(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.01, 10., 'lin', 'dur', self._dur), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def table(self): return self._table
- @table.setter
- def table(self, x): self.setTable(x)
- @property
- def dur(self): return self._dur
- @dur.setter
- def dur(self, x): self.setDur(x)
- @property
- def interp(self): return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
-class TrigLinseg(PyoObject):
- """
- Line segments trigger.
-
- TrigLinseg starts reading a break-points line segments each time it
- receives a trigger in its `input` parameter.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- list : list of tuples
- Points used to construct the line segments. Each tuple is a
- new point in the form (time, value). Times are given in seconds
- and must be in increasing order.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setList(x) : Replace the `list` attribute.
- replace(x) : Alias for `setList` method.
- graph(xlen, yrange, title, wxnoserver) : Opens a grapher window
- to control the shape of the envelope.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- list : list of tuples. Points used to construct the line segments.
-
- Notes:
-
- TrigLinseg will sends a trigger signal at the end of the playback.
- User can retreive the trigger streams by calling obj['trig'].
- Useful to synchronize other processes.
-
- The out() method is bypassed. TrigLinseg's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> m = Metro(time=1, poly=2).play()
- >>> pit = TrigLinseg(m, [(0,1000),(.1,1300),(.2,900),(.3,1000),(2,1000)])
- >>> a = Sine(pit, mul=.2).out()
-
- """
- def __init__(self, input, list, mul=1, add=0):
- PyoObject.__init__(self)
- if type(list) != ListType:
- print >> sys.stderr, 'TypeError: "list" argument of %s must be a list of tuples.\n' % self.__class__.__name__
- exit()
- if type(list[0]) != TupleType:
- print >> sys.stderr, 'TypeError: "list" argument of %s must be a list of tuples.\n' % self.__class__.__name__
- exit()
- self._input = input
- self._list = list
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [TrigLinseg_base(wrap(in_fader,i), list, wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
-
- def __dir__(self):
- return ['input', 'list', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setList(self, x):
- """
- Replace the `list` attribute.
-
- Parameters:
-
- x : list of tuples
- new `list` attribute.
-
- """
- self._list = x
- [obj.setList(x) for i, obj in enumerate(self._base_objs)]
-
- def replace(self, x):
- """
- Alias for `setList` method.
-
- Parameters:
-
- x : list of tuples
- new `list` attribute.
-
- """
- self.setList(x)
-
- def getPoints(self):
- return self._list
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- def graph(self, xlen=None, yrange=None, title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- xlen : float, optional
- Set the maximum value of the X axis of the graph. If None, the
- maximum value is retrieve from the current list of points.
- Defaults to None.
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph. If
- None, min and max are retrieve from the current list of points.
- Defaults to None.
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- if xlen == None:
- xlen = float(self._list[-1][0])
- else:
- xlen = float(xlen)
- if yrange == None:
- ymin = float(min([x[1] for x in self._list]))
- ymax = float(max([x[1] for x in self._list]))
- if ymin == ymax:
- yrange = (0, ymax)
- else:
- yrange = (ymin, ymax)
- createGraphWindow(self, 0, xlen, yrange, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def list(self): return self._list
- @list.setter
- def list(self, x): self.setList(x)
-
-class TrigExpseg(PyoObject):
- """
- Exponential segments trigger.
-
- TrigExpseg starts reading break-points exponential segments each time
- it receives a trigger in its `input` parameter.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- list : list of tuples
- Points used to construct the line segments. Each tuple is a
- new point in the form (time, value). Times are given in seconds
- and must be in increasing order.
- exp : float, optional
- Exponent factor. Used to control the slope of the curves.
- Defaults to 10.
- inverse : boolean, optional
- If True, downward slope will be inversed. Useful to create
- biexponential curves. Defaults to True.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setList(x) : Replace the `list` attribute.
- replace(x) : Alias for `setList` method.
- setExp(x) : Replace the `exp` attribute.
- setInverse(x) : Replace the `inverse` attribute.
- graph(xlen, yrange, title, wxnoserver) : Opens a grapher window
- to control the shape of the envelope.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- list : list of tuples. Points used to construct the line segments.
- exp : float. Exponent factor.
- inverse : boolean. Inversion of downward slope.
-
- Notes:
-
- TrigExpseg will sends a trigger signal at the end of the playback.
- User can retreive the trigger streams by calling obj['trig'].
- Useful to synchronize other processes.
-
- The out() method is bypassed. TrigExpseg's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> m = Metro(time=0.5, poly=2).play()
- >>> pit = TrigExpseg(m, [(0,1000),(.25,1300),(.5,1000),(1,1000)])
- >>> a = Sine(pit, mul=.2).out()
-
- """
- def __init__(self, input, list, exp=10, inverse=True, mul=1, add=0):
- PyoObject.__init__(self)
- if type(list) != ListType:
- print >> sys.stderr, 'TypeError: "list" argument of %s must be a list of tuples.\n' % self.__class__.__name__
- exit()
- if type(list[0]) != TupleType:
- print >> sys.stderr, 'TypeError: "list" argument of %s must be a list of tuples.\n' % self.__class__.__name__
- exit()
- self._input = input
- self._list = list
- self._exp = exp
- self._inverse = inverse
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, exp, inverse, mul, add, lmax = convertArgsToLists(self._in_fader, exp, inverse, mul, add)
- self._base_objs = [TrigExpseg_base(wrap(in_fader,i), list, wrap(exp,i), wrap(inverse,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
-
- def __dir__(self):
- return ['input', 'list', 'exp', 'inverse', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setList(self, x):
- """
- Replace the `list` attribute.
-
- Parameters:
-
- x : list of tuples
- new `list` attribute.
-
- """
- self._list = x
- [obj.setList(x) for i, obj in enumerate(self._base_objs)]
-
- def setExp(self, x):
- """
- Replace the `exp` attribute.
-
- Parameters:
-
- x : float
- new `exp` attribute.
-
- """
- self._exp = x
- x, lmax = convertArgsToLists(x)
- [obj.setExp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInverse(self, x):
- """
- Replace the `inverse` attribute.
-
- Parameters:
-
- x : boolean
- new `inverse` attribute.
-
- """
- self._inverse = x
- x, lmax = convertArgsToLists(x)
- [obj.setInverse(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def replace(self, x):
- """
- Alias for `setList` method.
-
- Parameters:
-
- x : list of tuples
- new `list` attribute.
-
- """
- self.setList(x)
-
- def getPoints(self):
- return self._list
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- def graph(self, xlen=None, yrange=None, title=None, wxnoserver=False):
- """
- Opens a grapher window to control the shape of the envelope.
-
- When editing the grapher with the mouse, the new set of points
- will be send to the object on mouse up.
-
- Ctrl+C with focus on the grapher will copy the list of points to the
- clipboard, giving an easy way to insert the new shape in a script.
-
- Parameters:
-
- xlen : float, optional
- Set the maximum value of the X axis of the graph. If None, the
- maximum value is retrieve from the current list of points.
- Defaults to None.
- yrange : tuple, optional
- Set the min and max values of the Y axis of the graph. If
- None, min and max are retrieve from the current list of points.
- Defaults to None.
- title : string, optional
- Title of the window. If none is provided, the name of the
- class is used.
- wxnoserver : boolean, optional
- With wxPython graphical toolkit, if True, tells the
- interpreter that there will be no server window and not
- to wait for it before showing the controller window.
- Defaults to False.
-
- """
- if xlen == None:
- xlen = float(self._list[-1][0])
- else:
- xlen = float(xlen)
- if yrange == None:
- ymin = float(min([x[1] for x in self._list]))
- ymax = float(max([x[1] for x in self._list]))
- if ymin == ymax:
- yrange = (0, ymax)
- else:
- yrange = (ymin, ymax)
- createGraphWindow(self, 2, xlen, yrange, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def list(self): return self._list
- @list.setter
- def list(self, x): self.setList(x)
- @property
- def exp(self): return self._exp
- @exp.setter
- def exp(self, x): self.setExp(x)
- @property
- def inverse(self): return self._inverse
- @inverse.setter
- def inverse(self, x): self.setInverse(x)
-
-class TrigXnoise(PyoObject):
- """
- Triggered X-class pseudo-random generator.
-
- Xnoise implements a few of the most common noise distributions.
- A new value is generated each time the object receive a trigger
- in input. Each distribution generates values in the range 0 and 1.
-
- Parentclass: PyoObject
-
- Notes:
-
- Available distributions are:
- - uniform
- - linear minimum
- - linear maximum
- - triangular
- - exponential minimum
- - exponential maximum
- - double (bi)exponential
- - cauchy
- - weibull
- - gaussian
- - poisson
- - walker (drunk)
- - loopseg (drunk with looped segments)
-
- Depending on the distribution, `x1` and `x2` parameters are applied
- as follow (names as string, or associated number can be used as `dist`
- parameter):
- 0 - uniform
- no parameter
- 1 - linear_min
- no parameter
- 2 - linear_max
- no parameter
- 3 - triangle
- no parameter
- 4 - expon_min
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 5 - expon_max
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 6 - biexpon
- x1 : bandwidth {0 = huge bandwidth -> 10 = narrow bandwidth}
- 7 - cauchy
- x1 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 8 - weibull
- x1 : mean location {0 -> 1}
- x2 : shape {0.5 = linear min, 1.5 = expon min, 3.5 = gaussian}
- 9 - gaussian
- x1 : mean location {0 -> 1}
- x2 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 10 - poisson
- x1 : gravity center {0 = low values -> 10 = high values}
- x2 : compress/expand range {0.1 = full compress -> 4 full expand}
- 11 - walker
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
- 12 - loopseg
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- dist : string or int, optional
- Distribution type. Defaults to 0.
- x1 : float or PyoObject, optional
- First parameter. Defaults to 0.5.
- x2 : float or PyoObject, optional
- Second parameter. Defaults to 0.5.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setDist(x) : Replace the `dist` attribute.
- setX1(x) : Replace the `x1` attribute.
- setX2(x) : Replace the `x2` attribute.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- dist : string or int. Distribution type.
- x1 : float or PyoObject. First parameter.
- x2 : float or PyoObject. Second parameter.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> wav = SquareTable()
- >>> env = CosTable([(0,0), (100,1), (500,.3), (8191,0)])
- >>> met = Metro(.125, 12).play()
- >>> amp = TrigEnv(met, table=env, mul=.2)
- >>> pit = TrigXnoise(met, dist=4, x1=10, mul=1000, add=200)
- >>> a = Osc(table=wav, freq=pit, mul=amp).out()
-
- """
- def __init__(self, input, dist=0, x1=0.5, x2=0.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._dist = dist
- self._x1 = x1
- self._x2 = x2
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, dist, x1, x2, mul, add, lmax = convertArgsToLists(self._in_fader, dist, x1, x2, mul, add)
- for i, t in enumerate(dist):
- if type(t) == StringType: dist[i] = XNOISE_DICT.get(t, 0)
- self._base_objs = [TrigXnoise_base(wrap(in_fader,i), wrap(dist,i), wrap(x1,i), wrap(x2,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'dist', 'x1', 'x2', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setDist(self, x):
- """
- Replace the `dist` attribute.
-
- Parameters:
-
- x : int
- new `dist` attribute.
-
- """
- self._dist = x
- x, lmax = convertArgsToLists(x)
- for i, t in enumerate(x):
- if type(t) == StringType: x[i] = XNOISE_DICT.get(t, 0)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX1(self, x):
- """
- Replace the `x1` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x1` attribute.
-
- """
- self._x1 = x
- x, lmax = convertArgsToLists(x)
- [obj.setX1(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX2(self, x):
- """
- Replace the `x2` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x2` attribute.
-
- """
- self._x2= x
- x, lmax = convertArgsToLists(x)
- [obj.setX2(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def dist(self): return self._dist
- @dist.setter
- def dist(self, x): self.setDist(x)
- @property
- def x1(self): return self._x1
- @x1.setter
- def x1(self, x): self.setX1(x)
- @property
- def x2(self): return self._x2
- @x2.setter
- def x2(self, x): self.setX2(x)
-
-class TrigXnoiseMidi(PyoObject):
- """
- Triggered X-class midi notes pseudo-random generator.
-
- Xnoise implements a few of the most common noise distributions.
- A new value is generated each time the object receive a trigger
- in input. Each distribution generates integer values in the range
- defined with `mrange` parameter and output can be scaled on midi
- notes, hertz or transposition factor.
-
- Parentclass: PyoObject
-
- Notes:
-
- Available distributions are:
- - uniform
- - linear minimum
- - linear maximum
- - triangular
- - exponential minimum
- - exponential maximum
- - double (bi)exponential
- - cauchy
- - weibull
- - gaussian
- - poisson
- - walker (drunk)
- - loopseg (drunk with looped segments)
-
- Depending on the distribution, `x1` and `x2` parameters are applied
- as follow (names as string, or associated number can be used as `dist`
- parameter):
- 0 - uniform
- no parameter
- 1 - linear_min
- no parameter
- 2 - linear_max
- no parameter
- 3 - triangle
- no parameter
- 4 - expon_min
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 5 - expon_max
- x1 : slope {0 = no slope -> 10 = sharp slope}
- 6 - biexpon
- x1 : bandwidth {0 = huge bandwidth -> 10 = narrow bandwidth}
- 7 - cauchy
- x1 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 8 - weibull
- x1 : mean location {0 -> 1}
- x2 : shape {0.5 = linear min, 1.5 = expon min, 3.5 = gaussian}
- 9 - gaussian
- x1 : mean location {0 -> 1}
- x2 : bandwidth {0 = narrow bandwidth -> 10 = huge bandwidth}
- 10 - poisson
- x1 : gravity center {0 = low values -> 10 = high values}
- x2 : compress/expand range {0.1 = full compress -> 4 full expand}
- 11 - walker
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
- 12 - loopseg
- x1 : maximum value {0.1 -> 1}
- x2 - maximum step {0.1 -> 1}
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- dist : string of int, optional
- Distribution type. Defaults to 0.
- x1 : float or PyoObject, optional
- First parameter. Defaults to 0.5.
- x2 : float or PyoObject, optional
- Second parameter. Defaults to 0.5.
- scale : int {0, 1, 2}, optional
- Output format. 0 = MIDI, 1 = Hertz, 2 = transposition factor.
- In the transposition mode, the central key (the key where there
- is no transposition) is (`minrange` + `maxrange`) / 2. Defaults
- to 0.
- mrange : tuple of int, optional
- Minimum and maximum possible values, in Midi notes. Available
- only at initialization time. Defaults to (0, 127).
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setDist(x) : Replace the `dist` attribute.
- setX1(x) : Replace the `x1` attribute.
- setX2(x) : Replace the `x2` attribute.
- setScale(x) : Replace the `scale` attribute.
- setRange(x, y) : Changes min and max range values and centralkey.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- dist : string or int. Distribution type.
- x1 : float or PyoObject. First parameter.
- x2 : float or PyoObject. Second parameter.
- scale : int. Output format.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> wav = SquareTable()
- >>> env = CosTable([(0,0), (100,1), (500,.3), (8191,0)])
- >>> met = Metro(.125, 12).play()
- >>> amp = TrigEnv(met, table=env, mul=.2)
- >>> pit = TrigXnoiseMidi(met, dist=4, x1=10, scale=1, mrange=(48,84))
- >>> a = Osc(table=wav, freq=pit, mul=amp).out()
-
- """
- def __init__(self, input, dist=0, x1=0.5, x2=0.5, scale=0, mrange=(0,127), mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._dist = dist
- self._x1 = x1
- self._x2 = x2
- self._scale = scale
- self._mrange = mrange
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, dist, x1, x2, scale, mrange, mul, add, lmax = convertArgsToLists(self._in_fader, dist, x1, x2, scale, mrange, mul, add)
- for i, t in enumerate(dist):
- if type(t) == StringType: dist[i] = XNOISE_DICT.get(t, 0)
- self._base_objs = [TrigXnoiseMidi_base(wrap(in_fader,i), wrap(dist,i), wrap(x1,i), wrap(x2,i), wrap(scale,i), wrap(mrange,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'dist', 'x1', 'x2', 'scale', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setDist(self, x):
- """
- Replace the `dist` attribute.
-
- Parameters:
-
- x : int
- new `dist` attribute.
-
- """
- self._dist = x
- x, lmax = convertArgsToLists(x)
- for i, t in enumerate(x):
- if type(t) == StringType: x[i] = XNOISE_DICT.get(t, 0)
- [obj.setType(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setScale(self, x):
- """
- Replace the `scale` attribute.
-
- Possible values are:
- 0 -> Midi notes
- 1 -> Hertz
- 2 -> transposition factor
- (centralkey is (`minrange` + `maxrange`) / 2
-
- Parameters:
-
- x : int {0, 1, 2}
- new `scale` attribute.
-
- """
- self._scale = x
- x, lmax = convertArgsToLists(x)
- [obj.setScale(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setRange(self, mini, maxi):
- """
- Replace the `mrange` attribute.
-
- Parameters:
-
- mini : int
- minimum output midi range.
- maxi : int
- maximum output midi range.
-
- """
- self._mrange = (mini, maxi)
- mini, maxi, lmax = convertArgsToLists(mini, maxi)
- [obj.setRange(wrap(mini,i), wrap(maxi,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX1(self, x):
- """
- Replace the `x1` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x1` attribute.
-
- """
- self._x1 = x
- x, lmax = convertArgsToLists(x)
- [obj.setX1(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setX2(self, x):
- """
- Replace the `x2` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `x2` attribute.
-
- """
- self._x2= x
- x, lmax = convertArgsToLists(x)
- [obj.setX2(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def dist(self): return self._dist
- @dist.setter
- def dist(self, x): self.setDist(x)
- @property
- def scale(self): return self._scale
- @scale.setter
- def scale(self, x): self.setScale(x)
- @property
- def x1(self): return self._x1
- @x1.setter
- def x1(self, x): self.setX1(x)
- @property
- def x2(self): return self._x2
- @x2.setter
- def x2(self, x): self.setX2(x)
-
-class Counter(PyoObject):
- """
- Integer count generator.
-
- Counter keeps track of all triggers received, outputs the current
- count constrained within `min` and `max` range, and can be set to
- count up, down, or up-and-down.
-
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- min : int, optional
- Minimum value of the count, included in the count. Defaults to 0.
- max : int, optional
- Maximum value of the count. excluded of the count.
- The counter will count up to max - 1. Defaults to 100.
- dir : int {0, 1, 2}, optional
- Direction of the count. Three possible values:
- 0 : up
- 1 : down
- 2 : up-and-down
- Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
- setDir(x) : Replace the `dir` attribute.
- reset(value) : Reset the current count.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- min : int. Minimum value.
- max : int. Maximum value.
- dir : int. Direction of the count.
-
- Notes:
-
- The out() method is bypassed. Counter's signal can not be sent
- to audio outs.
-
- See also: Select
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> m = Metro(.125).play()
- >>> c = Counter(m, min=3, max=8, dir=2, mul=100)
- >>> a = Sine(freq=c, mul=.2).mix(2).out()
-
- """
- def __init__(self, input, min=0, max=100, dir=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._min = min
- self._max = max
- self._dir = dir
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, min, max, dir, mul, add, lmax = convertArgsToLists(self._in_fader, min, max, dir, mul, add)
- self._base_objs = [Counter_base(wrap(in_fader,i), wrap(min,i), wrap(max,i), wrap(dir,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'min', 'max', 'dir', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : int
- new `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : int
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDir(self, x):
- """
- Replace the `dir` attribute.
-
- Parameters:
-
- x : int {0, 1, 2}
- new `dir` attribute.
-
- """
- self._dir = x
- x, lmax = convertArgsToLists(x)
- [obj.setDir(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self, value=None):
- """
- Reset the current count of the counter. If `value` is None, the counter
- resets to the beginning of the count.
-
- Parameters:
-
- value : int, optional
- Value where to reset the count. Defaults to None.
-
- """
- value, lmax = convertArgsToLists(value)
- [obj.reset(wrap(value,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def min(self): return self._min
- @min.setter
- def min(self, x): self.setMin(x)
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
- @property
- def dir(self): return self._dir
- @dir.setter
- def dir(self, x): self.setDir(x)
-
-class Select(PyoObject):
- """
- Sends trigger on matching integer values.
-
- Select takes in input an audio signal containing integer numbers
- and sends a trigger when the input matches `value` parameter. This
- object is especially designed to be used with Counter object.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal. Must contains integer numbers.
- value : int, optional
- Value to be matched to send a trigger. Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setValue(x) : Replace the `value` attribute.
-
- Attributes:
-
- input : PyoObject. Audio signal.
- value : int. Matching value.
-
- Notes:
-
- The out() method is bypassed. Select's signal can not be sent
- to audio outs.
-
- See also: Counter
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> env = HannTable()
- >>> m = Metro(.125, poly=2).play()
- >>> te = TrigEnv(m, table=env, dur=.2, mul=.2)
- >>> c = Counter(m, min=0, max=4)
- >>> se = Select(c, 0)
- >>> tr = TrigRand(se, 400, 600)
- >>> a = Sine(freq=tr, mul=te).out()
-
- """
- def __init__(self, input, value=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._value = value
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, value, mul, add, lmax = convertArgsToLists(self._in_fader, value, mul, add)
- self._base_objs = [Select_base(wrap(in_fader,i), wrap(value,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'value', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setValue(self, x):
- """
- Replace the `value` attribute.
-
- Parameters:
-
- x : int
- new `value` attribute.
-
- """
- self._value = x
- x, lmax = 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 = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def value(self): return self._value
- @value.setter
- def value(self, x): self.setValue(x)
-
-class Change(PyoObject):
- """
- Sends trigger that informs when input value has changed.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal. Must contains integer numbers.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Audio signal.
-
- Notes:
-
- The out() method is bypassed. Change's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = CosTable([(0,0), (100,1), (500,.3), (8191,0)])
- >>> a = XnoiseMidi(dist="loopseg", freq=[2, 3], x1=1, scale=1, mrange=(60,73))
- >>> b = Change(a)
- >>> amp = TrigEnv(b, table=t, dur=[.5,.333], mul=.3)
- >>> out = SineLoop(freq=a, feedback=.05, mul=amp).out()
-
- """
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [Change_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Thresh(PyoObject):
- """
- 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.
-
- Parentclass: 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()
-
- """
- def __init__(self, input, threshold=0., dir=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._threshold = threshold
- self._dir = dir
- self._in_fader = InputFader(input)
- in_fader, threshold, dir, mul, add, lmax = convertArgsToLists(self._in_fader, threshold, dir, mul, add)
- self._base_objs = [Thresh_base(wrap(in_fader,i), wrap(threshold,i), wrap(dir,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'threshold', 'dir', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setThreshold(self, x):
- """
- Replace the `threshold` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `threshold` attribute.
-
- """
- self._threshold = x
- x, lmax = convertArgsToLists(x)
- [obj.setThreshold(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setDir(self, x):
- """
- Replace the `dir` attribute.
-
- Parameters:
-
- x : int {0, 1, 2}
- new `dir` attribute.
-
- """
- self._dir = x
- x, lmax = convertArgsToLists(x)
- [obj.setDir(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def threshold(self): return self._threshold
- @threshold.setter
- def threshold(self, x): self.setThreshold(x)
- @property
- def dir(self): return self._dir
- @dir.setter
- def dir(self, x): self.setDir(x)
-
-class Percent(PyoObject):
- """
- Lets pass a certain percentage of the input triggers.
-
- Percent looks at the triggers received in `input` and
- lets them pass `percent` of the time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- percent : float or PyoObject, optional
- How much percentage of triggers to let pass,
- between 0 and 100. Defaults to 50.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setPercent(x) : Replace the `percent` attribute.
-
- Attributes:
-
- input : PyoObject. Audio signal.
- percent : float or PyoObject. Percentage value.
-
- Notes:
-
- The out() method is bypassed. Percent's signal can not
- be sent to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = CosTable([(0,0), (50,1), (250,.3), (8191,0)])
- >>> met = Metro(time=.125, poly=2).play()
- >>> trig = Percent(met, percent=50)
- >>> amp = TrigEnv(trig, table=t, dur=.25, mul=.3)
- >>> fr = TrigRand(trig, min=400, max=1000)
- >>> freq = Port(fr, risetime=0.001, falltime=0.001)
- >>> a = Sine(freq=freq, mul=amp).out()
-
- """
- def __init__(self, input, percent=50., mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._percent = percent
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, percent, mul, add, lmax = convertArgsToLists(self._in_fader, percent, mul, add)
- self._base_objs = [Percent_base(wrap(in_fader,i), wrap(percent,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'percent', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setPercent(self, x):
- """
- Replace the `percent` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `percent` attribute.
-
- """
- self._percent = x
- x, lmax = convertArgsToLists(x)
- [obj.setPercent(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., 100., 'lin', 'percent', self._percent)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def percent(self): return self._percent
- @percent.setter
- def percent(self, x): self.setPercent(x)
-
-class Timer(PyoObject):
- """
- Reports elapsed time between two trigs.
-
- A trigger in `input2` signal starts an internal timer. The next trigger
- in `input` signal stops it and reports the elapsed time between the two
- triggers. Useful for filtering triggers that are too close to each other.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Trigger signal. Stops the timer and reports elapsed time.
- input2 : PyoObject
- Trigger signal. Starts the timer if not already started.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setInput2(x, fadetime) : Replace the `input2` attribute.
-
- Attributes:
-
- input : PyoObject. Timer stop signal.
- input2 : PyoObject. Timer start signal.
-
- Notes:
-
- The `input` signal is evaluated before the `input2` signal, so it's
- safe to stop and start the timer with the same trigger signal.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> cl = Cloud(density=20, poly=2).play()
- >>> ti = Timer(cl, cl)
- >>> # Minimum waiting time before a new trig
- >>> cp = Compare(ti, comp=.05, mode=">")
- >>> trig = cl * cp
- >>> amp = TrigEnv(trig, table=HannTable(), dur=.05, mul=.25)
- >>> freq = TrigChoice(trig, choice=[100,150,200,250,300,350,400])
- >>> a = LFO(freq=freq, type=2, mul=amp).out()
-
- """
- def __init__(self, input, input2, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._input2 = input2
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- self._in_fader2 = InputFader(input2)
- in_fader, in_fader2, mul, add, lmax = convertArgsToLists(self._in_fader, self._in_fader2, mul, add)
- self._base_objs = [Timer_base(wrap(in_fader,i), wrap(in_fader2,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'input2', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setInput2(self, x, fadetime=0.05):
- """
- Replace the `input2` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to process.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._input2 = x
- self._in_fader2.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Timer stop signal."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def input2(self):
- """PyoObject. Timer start signal."""
- return self._input2
- @input2.setter
- def input2(self, x): self.setInput2(x)
-
-class Iter(PyoObject):
- """
- Triggers iterate over a list of values.
-
- Iter loops over a list of user-defined values. When a trigger is received
- in `input`, Iter moves up to the next value in the list, with wrap-around.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- choice : list of floats
- Sequence of values over which to iterate.
- init : float, optional
- Initial value. Available at initialization time only.
- Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setChoice(x) : Replace the `choice` attribute.
- reset(x) : Resets the current count.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- choice : list of floats. Possible values.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> l1 = [300, 350, 400, 450, 500, 550]
- >>> l2 = [300, 350, 450, 500, 550]
- >>> t = CosTable([(0,0), (50,1), (250,.3), (8191,0)])
- >>> met = Metro(time=.125, poly=2).play()
- >>> amp = TrigEnv(met, table=t, dur=.25, mul=.3)
- >>> it = Iter(met, choice=[l1, l2])
- >>> si = Sine(freq=it, mul=amp).out()
-
- """
- def __init__(self, input, choice, init=0., mul=1, add=0):
- PyoObject.__init__(self)
- if type(choice) != ListType:
- print >> sys.stderr, 'TypeError: "choice" argument of %s must be a list.\n' % self.__class__.__name__
- exit()
- self._input = input
- self._choice = choice
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, init, mul, add, lmax = convertArgsToLists(self._in_fader, init, mul, add)
- if type(choice[0]) != ListType:
- self._base_objs = [Iter_base(wrap(in_fader,i), choice, wrap(init,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- else:
- choicelen = len(choice)
- lmax = max(choicelen, lmax)
- self._base_objs = [Iter_base(wrap(in_fader,i), wrap(choice,i), wrap(init,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'choice', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setChoice(self, x):
- """
- Replace the `choice` attribute.
-
- Parameters:
-
- x : list of floats
- new `choice` attribute.
-
- """
- self._choice = x
- if type(x[0]) != ListType:
- [obj.setChoice(self._choice) for i, obj in enumerate(self._base_objs)]
- else:
- [obj.setChoice(wrap(self._choice,i)) for i, obj in enumerate(self._base_objs)]
-
- def reset(self, x=0):
- """
- Resets the current count.
-
- Parameters:
-
- x : int, optional
- Value where to reset the count. Defaults to 0.
-
- """
- [obj.reset(x) for obj in self._base_objs]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def choice(self): return self._choice
- @choice.setter
- def choice(self, x): self.setChoice(x)
-
-class Count(PyoObject):
- """
- Counts integers at audio rate.
-
- Count generates a signal increasing by 1 each sample when it receives a
- trigger. It can be used to do sample playback using TableIndex.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Trigger signal. Start or Restart the count.
- min : int, optional
- Minimum value of the count, included in the count. Defaults to 0.
- max : int, optional
- Maximum value of the count. excluded of the count. A value of 0
- eliminates the maximum, and the count continues increasing without
- resetting. Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
-
- Attributes:
-
- input : PyoObject. Trigger signal. Start/Restart the count.
- min : int. Minimum value.
- max : int. Maximum value.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> t = SndTable(SNDS_PATH+'/accord.aif')
- >>> ind = Count(Trig().play(), [0,100], t.getSize())
- >>> read = TableIndex(t, ind).out()
-
- """
- def __init__(self, input, min=0, max=0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._min = min
- self._max = max
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, min, max, mul, add, lmax = convertArgsToLists(self._in_fader, min, max, mul, add)
- self._base_objs = [Count_base(wrap(in_fader,i), wrap(min,i), wrap(max,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'min', 'max', 'mul', 'add']
-
- def setInput(self, x, fadetime=0.05):
- """
- Replace the `input` attribute.
-
- Parameters:
-
- x : PyoObject
- New input signal.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : int
- new `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : int
- new `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def min(self): return self._min
- @min.setter
- def min(self, x): self.setMin(x)
- @property
- def max(self): return self._max
- @max.setter
- def max(self, x): self.setMax(x)
-
-class NextTrig(PyoObject):
- """
- A trigger in the second stream opens a gate only for the next one in the first stream.
-
- When the gate is opened by a trigger in `input2` signal, the next trigger
- in `input` signal is allowed to pass and automatically closes the gate.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Trigger signal. Trigger stream waiting for the gate to be opened.
- input2 : PyoObject
- Trigger signal. Trigger stream opening the gate.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setInput2(x, fadetime) : Replace the `input2` attribute.
-
- Attributes:
-
- input : PyoObject. Incoming trigger stream signal.
- input2 : PyoObject. Trigger stream opening the gate.
-
- Notes:
-
- The `input` signal is evaluated before the `input2` signal, so it's
- safe to send triggers in both inputs at the same time and wait for the
- next one.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> mid = Urn(max=4, freq=4, add=60)
- >>> sigL = SineLoop(freq=MToF(mid), feedback=.08, mul=0.3).out()
- >>> first = NextTrig(Change(mid), mid["trig"])
- >>> amp = TrigExpseg(first, [(0,0),(.01,.25),(1,0)])
- >>> sigR = SineLoop(midiToHz(84), feedback=0.05, mul=amp).out(1)
-
- """
- def __init__(self, input, input2, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._input2 = input2
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- self._in_fader2 = InputFader(input2)
- in_fader, in_fader2, mul, add, lmax = convertArgsToLists(self._in_fader, self._in_fader2, mul, add)
- self._base_objs = [NextTrig_base(wrap(in_fader,i), wrap(in_fader2,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'input2', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setInput2(self, x, fadetime=0.05):
- """
- Replace the `input2` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to process.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._input2 = x
- self._in_fader2.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def input2(self): return self._input2
- @input2.setter
- def input2(self, x): self.setInput2(x)
-
-class TrigVal(PyoObject):
- """
- Outputs a previously defined value on a trigger signal.
-
- Value defined at `value` argument is sent when a trigger signal
- is detected in input.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Audio signal sending triggers.
- value : float or PyoObject, optional
- Next value. Defaults to 0.
- init : float, optional
- Initial value. Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setValue(x) : Replace the `value` attribute.
-
- Attributes:
-
- input : PyoObject. Audio trigger signal.
- value : float or PyoObject. Next value.
-
- Notes:
-
- The out() method is bypassed. TrigVal's signal can not be sent
- to audio outs.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> def newfreq():
- ... val.value = (val.value + 50) % 500 + 100
- >>> tr = Metro(1).play()
- >>> val = TrigVal(tr, value=250)
- >>> a = SineLoop(val, feedback=.1, mul=.3).out()
- >>> trfunc = TrigFunc(tr, newfreq)
-
- """
- def __init__(self, input, value=0., init=0., mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._value = value
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, value, init, mul, add, lmax = convertArgsToLists(self._in_fader, value, init, mul, add)
- self._base_objs = [TrigVal_base(wrap(in_fader,i), wrap(value,i), wrap(init,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'value', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setValue(self, x):
- """
- Replace the `value` attribute.
-
- Parameters:
-
- x : float or PyoObject
- new `value` attribute.
-
- """
- self._value = x
- x, lmax = convertArgsToLists(x)
- [obj.setValue(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = [SLMap(0., 1., 'lin', 'value', self._value),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def value(self): return self._value
- @value.setter
- def value(self, x): self.setValue(x)
diff --git a/build/lib.linux-x86_64-2.7/pyolib/utils.py b/build/lib.linux-x86_64-2.7/pyolib/utils.py
deleted file mode 100644
index bd535e7..0000000
--- a/build/lib.linux-x86_64-2.7/pyolib/utils.py
+++ /dev/null
@@ -1,2177 +0,0 @@
-"""
-Miscellaneous objects.
-
-"""
-
-"""
-Copyright 2010 Olivier Belanger
-
-This file is part of pyo, a python module to help digital signal
-processing script creation.
-
-pyo is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pyo is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pyo. If not, see <http://www.gnu.org/licenses/>.
-"""
-from _core import *
-from _maps import *
-from types import SliceType
-import threading, time
-
-class Clean_objects(threading.Thread):
- """
- Stops and deletes PyoObjects after a given time.
-
- Parameters:
-
- time : float
- Time, in seconds, to wait before calling stop on the given
- objects and deleting them.
- *args : PyoObject(s)
- Objects to delete.
-
- Methods:
-
- start() : Starts the thread. The timer begins on this call.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(mul=.5).mix(2)
- >>> b = Fader(fadein=.5, fadeout=1, dur=5).play()
- >>> c = Biquad(a, freq=500, q=2, mul=b).out()
- >>> dump = Clean_objects(6, a, b, c)
- >>> dump.start()
-
- """
- def __init__(self, time, *args):
- threading.Thread.__init__(self)
- self.t = time
- self.args = args
-
- def run(self):
- time.sleep(self.t)
- for arg in self.args:
- try: arg.stop()
- except: pass
- for arg in self.args:
- del arg
-
-class Print(PyoObject):
- """
- Print PyoObject's current value.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to filter.
- method : int {0, 1}, optional
- There is two methods to set when a value is printed (Defaults to 0):
- 0 : at a periodic interval.
- 1 : everytime the value changed.
- interval : float, optional
- Interval, in seconds, between each print. Used by method 0.
- Defaults to 0.25.
- message : str, optional
- Message to print before the current value. Defaults to "".
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMethod(x) : Replace the `method` attribute.
- setInterval(x) : Replace the `interval` attribute.
- setMessage(x) : Replace the `message` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal.
- method : int. Controls when a value is printed.
- interval : float. For method 0, interval, in seconds, between each print.
- message : str. Message to print before the current value.
-
- Notes:
-
- The out() method is bypassed. Print's signal can not be sent to
- audio outs.
-
- Print has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = SfPlayer(SNDS_PATH + '/transparent.aif', loop=True, mul=.3).out()
- >>> b = Follower(a)
- >>> p = Print(b, method=0, interval=.1, message="RMS")
-
- """
- def __init__(self, input, method=0, interval=0.25, message=""):
- PyoObject.__init__(self)
- self._input = input
- self._method = method
- self._interval = interval
- self._message = message
- self._in_fader = InputFader(input)
- in_fader, method, interval, message, lmax = convertArgsToLists(self._in_fader, method, interval, message)
- self._base_objs = [Print_base(wrap(in_fader,i), wrap(method,i), wrap(interval,i), wrap(message,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'method', 'interval', 'message']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMethod(self, x):
- """
- Replace the `method` attribute.
-
- Parameters:
-
- x : int {0, 1}
- New `method` attribute.
-
- """
- self._method = x
- x, lmax = convertArgsToLists(x)
- [obj.setMethod(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInterval(self, x):
- """
- Replace the `interval` attribute.
-
- Parameters:
-
- x : float
- New `interval` attribute.
-
- """
- self._interval = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterval(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMessage(self, x):
- """
- Replace the `message` attribute.
-
- Parameters:
-
- x : str
- New `message` attribute.
-
- """
- self._message = x
- x, lmax = convertArgsToLists(x)
- [obj.setMessage(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def method(self):
- """int. Controls when a value is printed."""
- return self._method
- @method.setter
- def method(self, x): self.setMethod(x)
-
- @property
- def interval(self):
- """float. For method 0, interval, in seconds, between each print."""
- return self._interval
- @interval.setter
- def interval(self, x): self.setInterval(x)
-
- @property
- def message(self):
- """str. Message to print before the current value."""
- return self._message
- @message.setter
- def message(self, x): self.setMessage(x)
-
-class Snap(PyoObject):
- """
- Snap input values on a user's defined midi scale.
-
- Snap takes an audio input of floating-point values from 0
- to 127 and output the nearest value in the `choice` parameter.
- `choice` can be defined on any number of octaves and the real
- snapping values will be automatically expended. The object
- will take care of the input octave range. According to `scale`
- parameter, output can be in midi notes, hertz or transposition
- factor (centralkey = 60).
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Incoming Midi notes as an audio stream.
- choice : list of floats
- Possible values, as midi notes, for output.
- scale : int {0, 1, 2}, optional
- Pitch output format. 0 = MIDI, 1 = Hertz, 2 = transpo.
- In the transpo mode, the central key (the key where there
- is no transposition) is 60. Defaults to 0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setChoice(x) : Replace the `choice` attribute.
- setScale(x) : Replace the `scale` attribute.
-
- Attributes:
-
- input : PyoObject. Audio signal to transform.
- choice : list of floats. Possible values.
- scale : int. Output format.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> wav = SquareTable()
- >>> env = CosTable([(0,0), (100,1), (500,.3), (8191,0)])
- >>> met = Metro(.125, 8).play()
- >>> amp = TrigEnv(met, table=env, mul=.2)
- >>> pit = TrigXnoiseMidi(met, dist=4, x1=20, mrange=(48,84))
- >>> hertz = Snap(pit, choice=[0,2,3,5,7,8,10], scale=1)
- >>> a = Osc(table=wav, freq=hertz, phase=0, mul=amp).out()
-
- """
- def __init__(self, input, choice, scale=0, mul=1, add=0):
- PyoObject.__init__(self)
- if type(choice) != ListType:
- print >> sys.stderr, 'TypeError: "choice" argument of %s must be a list.\n' % self.__class__.__name__
- exit()
- self._input = input
- self._choice = choice
- self._scale = scale
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, scale, mul, add, lmax = convertArgsToLists(self._in_fader, scale, mul, add)
- if type(choice[0]) != ListType:
- self._base_objs = [Snap_base(wrap(in_fader,i), choice, wrap(scale,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
- else:
- choicelen = len(choice)
- lmax = max(choicelen, lmax)
- self._base_objs = [Snap_base(wrap(in_fader,i), wrap(choice,i), wrap(scale,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'choice', 'scale', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setChoice(self, x):
- """
- Replace the `choice` attribute.
-
- Parameters:
-
- x : list of floats
- new `choice` attribute.
-
- """
- self._choice = x
- [obj.setChoice(x) for i, obj in enumerate(self._base_objs)]
-
- def setScale(self, x):
- """
- Replace the `scale` attribute.
-
- Possible values are:
- 0 -> Midi notes
- 1 -> Hertz
- 2 -> transposition factor
- (centralkey is (`minrange` + `maxrange`) / 2
-
- Parameters:
-
- x : int {0, 1, 2}
- new `scale` attribute.
-
- """
- self._scale = x
- x, lmax = convertArgsToLists(x)
- [obj.setScale(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self): return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def choice(self): return self._choice
- @choice.setter
- def choice(self, x): self.setChoice(x)
- @property
- def scale(self): return self._scale
- @scale.setter
- def scale(self, x): self.setScale(x)
-
-class Interp(PyoObject):
- """
- Interpolates between two signals.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- First input signal.
- input2 : PyoObject
- Second input signal.
- interp : float or PyoObject, optional
- Averaging value. 0 means only first signal, 1 means only second
- signal. Default to 0.5.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setInput2(x, fadetime) : Replace the `input2` attribute.
- setInterp(x) : Replace the `interp` attribute.
-
- Attributes:
-
- input : PyoObject. First input signal.
- input2 : PyoObject. Second input signal.
- interp : float or PyoObject. Averaging value.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> sf = SfPlayer(SNDS_PATH + '/accord.aif', speed=[.99,1], loop=True, mul=.3)
- >>> sf2 = SfPlayer(SNDS_PATH + '/transparent.aif', speed=[.99,1], loop=True, mul=.3)
- >>> lfo = Osc(table=SquareTable(20), freq=5, mul=.5, add=.5)
- >>> a = Interp(sf, sf2, lfo).out()
-
- """
- def __init__(self, input, input2, interp=0.5, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._input2 = input2
- self._interp = interp
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- self._in_fader2 = InputFader(input2)
- in_fader, in_fader2, interp, mul, add, lmax = convertArgsToLists(self._in_fader, self._in_fader2, interp, mul, add)
- self._base_objs = [Interp_base(wrap(in_fader,i), wrap(in_fader2,i), wrap(interp,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'input2', 'interp', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setInput2(self, x, fadetime=0.05):
- """
- Replace the `input2` attribute.
-
- Parameters:
-
- x : PyoObject
- New signal to process.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._input2 = x
- self._in_fader2.setInput(x, fadetime)
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(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", "interp", self._interp), SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. First input signal."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def input2(self):
- """PyoObject. Second input signal."""
- return self._input2
- @input2.setter
- def input2(self, x): self.setInput2(x)
-
- @property
- def interp(self):
- """float or PyoObject. Averaging value."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
-class SampHold(PyoObject):
- """
- Performs a sample-and-hold operation on its input.
-
- SampHold performs a sample-and-hold operation on its input according
- to the value of `controlsig`. If `controlsig` equals `value`, the input
- is sampled and holded until next sampling.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal.
- controlsig : PyoObject
- Controls when to sample the signal.
- value : float or PyoObject, optional
- Sampling targeted value. Default to 0.0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setControlsig(x, fadetime) : Replace the `controlsig` attribute.
- setValue(x) : Replace the `value` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal.
- controlsig : PyoObject. Controls when to sample the signal.
- value : float or PyoObject. Targeted value.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> a = Noise(500,1000)
- >>> b = Sine([3,4])
- >>> c = SampHold(input=a, controlsig=b, value=0)
- >>> d = Sine(c, mul=.2).out()
-
- """
- def __init__(self, input, controlsig, value=0.0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._controlsig = controlsig
- self._value = value
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- self._in_fader2 = InputFader(controlsig)
- in_fader, in_fader2, value, mul, add, lmax = convertArgsToLists(self._in_fader, self._in_fader2, value, mul, add)
- self._base_objs = [SampHold_base(wrap(in_fader,i), wrap(in_fader2,i), wrap(value,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'controlsig', 'value', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setControlsig(self, x, fadetime=0.05):
- """
- Replace the `controlsig` attribute.
-
- Parameters:
-
- x : PyoObject
- New control signal.
- fadetime : float, optional
- Crossfade time between old and new input. Default to 0.05.
-
- """
- self._controlsig = x
- self._in_fader2.setInput(x, fadetime)
-
- def setValue(self, x):
- """
- Replace the `value` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `value` attribute.
-
- """
- self._value = x
- x, lmax = 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 = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def controlsig(self):
- """PyoObject. Control signal."""
- return self._controlsig
- @controlsig.setter
- def controlsig(self, x): self.setControlsig(x)
-
- @property
- def value(self):
- """float or PyoObject. Targeted value."""
- return self._value
- @value.setter
- def value(self, x): self.setValue(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.
-
- Parentclass: 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=[199,200], feedback=.1, mul=.2)
- >>> b = SineLoop(freq=[149,150], feedback=.1, mul=.2)
- >>> ph = Phasor(freq=1)
- >>> ch = Compare(input=ph, comp=0.5, mode="<=")
- >>> out = Selector(inputs=[a,b], voice=Port(ch)).out()
-
- """
- def __init__(self, input, comp, mode="<", mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._comp = comp
- self._mode = mode
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- self.comp_dict = {"<": 0, "<=": 1, ">": 2, ">=": 3, "==": 4, "!=": 5}
- in_fader, comp, mode, mul, add, lmax = convertArgsToLists(self._in_fader, comp, mode, mul, add)
- self._base_objs = [Compare_base(wrap(in_fader,i), wrap(comp,i), self.comp_dict[wrap(mode,i)], wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'comp', 'mode', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setComp(self, x):
- """
- Replace the `comp` attribute.
-
- Parameters:
-
- x : PyoObject
- New comparison signal.
-
- """
- self._comp = x
- x, lmax = convertArgsToLists(x)
- [obj.setComp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMode(self, x):
- """
- Replace the `mode` attribute.
-
- Allowed operator are "<", "<=", ">", ">=", "==", "!=".
-
- Parameters:
-
- x : string
- New `mode` attribute.
-
- """
- self._mode = x
- x, lmax = convertArgsToLists(x)
- [obj.setMode(self.comp_dict[wrap(x,i)]) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def comp(self):
- """PyoObject. Comparison signal."""
- return self._comp
- @comp.setter
- def comp(self, x): self.setComp(x)
-
- @property
- def mode(self):
- """string. Comparison operator."""
- return self._mode
- @mode.setter
- def mode(self, x): self.setMode(x)
-
-class Record(PyoObject):
- """
- Writes input sound in an audio file on the disk.
-
- `input` parameter must be a valid PyoObject or an addition of
- PyoObjects, parameters can't be in list format.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to record.
- filename : string
- Full path of the file to create.
- chnls : int, optional
- Number of channels in the audio file. Defaults to 2.
- fileformat : int, optional
- Format type of the audio file. Record will first try to
- set the format from the filename extension. If it's not possible,
- it uses the fileformat parameter. Defaults to 0.
- Supported formats are:
- 0 : WAV - Microsoft WAV format (little endian) {.wav, .wave}
- 1 : AIFF - Apple/SGI AIFF format (big endian) {.aif, .aiff}
- sampletype : int, optional
- Bit depth encoding of the audio file. Defaults to 0.
- Supported types are:
- 0 : 16 bits int
- 1 : 24 bits int
- 2 : 32 bits int
- 3 : 32 bits float
- 4 : 64 bits float
- buffering : int, optional
- Number of bufferSize to wait before writing samples to disk.
- High buffering uses more memory but improves performance.
- Defaults to 4.
-
- Notes:
-
- All parameters can only be set at intialization time.
-
- The `stop` method must be called on the object to close the file
- properly.
-
- The out() method is bypassed. Record's signal can not be sent to
- audio outs.
-
- Record has no `mul` and `add` attributes.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> from random import uniform
- >>> import os
- >>> t = HarmTable([1, 0, 0, .2, 0, 0, 0, .1, 0, 0, .05])
- >>> amp = Fader(fadein=.05, fadeout=2, dur=4, mul=.05).play()
- >>> osc = Osc(t, freq=[uniform(350,360) for i in range(10)], mul=amp).out()
- >>> home = os.path.expanduser('~')
- >>> # Records an audio file called "example_synth.aif" in the home folder
- >>> rec = Record(osc, filename=home+"/example_synth.aif", fileformat=1, sampletype=1)
- >>> clean = Clean_objects(4.5, rec)
- >>> clean.start()
-
- """
- def __init__(self, input, filename, chnls=2, fileformat=0, sampletype=0, buffering=4):
- PyoObject.__init__(self)
- self._input = input
- FORMATS = {'wav': 0, 'wave': 0, 'aif': 1, 'aiff': 1}
- ext = filename.rsplit('.')
- if len(ext) >= 2:
- ext = ext[-1].lower()
- if FORMATS.has_key(ext):
- fileformat = FORMATS[ext]
- else:
- print 'Warning: Unknown file extension. Using fileformat value.'
- else:
- print 'Warning: Filename has no extension. Using fileformat value.'
- self._base_objs = [Record_base(self._input.getBaseObjects(), filename, chnls, fileformat, sampletype, buffering)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def __dir__(self):
- return []
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class Denorm(PyoObject):
- """
- Mixes low level noise to an input signal.
-
- Mixes low level (~1e-24 for floats, and ~1e-60 for doubles) noise to a an input signal.
- Can be used before IIR filters and reverbs to avoid denormalized numbers which may
- otherwise result in significantly increased CPU usage.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> amp = Linseg([(0,0),(2,1),(4,0)], loop=True).play()
- >>> a = Sine(freq=[800,1000], mul=0.01*amp)
- >>> den = Denorm(a)
- >>> rev = Freeverb(den, size=.9).out()
-
- """
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [Denorm_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to filter."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class ControlRec(PyoObject):
- """
- Records control values and writes them in a text file.
-
- `input` parameter must be a valid PyoObject managing any number
- of streams, other parameters can't be in list format. The user
- must call the `write` method to create text files on the disk.
-
- Each line in the text files contains two values, the absolute time
- in seconds and the sampled value.
-
- The play() method starts the recording and is not called at the
- object creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to sample.
- filename : string
- Full path (without extension) used to create the files.
- "_000" will be added to file's names with increasing digits
- according to the number of streams in input. The same
- filename can be passed to a ControlRead object to read all
- related files.
- rate : int, optional
- Rate at which the input values are sampled. Defaults to 1000.
- dur : float, optional
- Duration of the recording, in seconds. If 0.0, the recording
- won't stop until the end of the performance. If greater than
- 0.0, the `stop` method is automatically called at the end of
- the recording.
-
- Methods:
-
- write() : Writes values in a text file on the disk.
-
- Notes:
-
- All parameters can only be set at intialization time.
-
- The `write` method must be called on the object to write the files
- on the disk.
-
- The out() method is bypassed. ControlRec's signal can not be sent to
- audio outs.
-
- ControlRec has no `mul` and `add` attributes.
-
- See also: ControlRead
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> rnds = Randi(freq=[1,2], min=200, max=400)
- >>> sines = SineLoop(freq=rnds, feedback=.05, mul=.2).out()
- >>> home = os.path.expanduser('~')
- >>> rec = ControlRec(rnds, home+"/test", rate=100, dur=4).play()
- >>> # call rec.write() to save "test_000" and "test_001" in the home directory.
- >>> def write_files():
- ... sines.mul = 0
- ... rec.write()
- >>> call = CallAfter(function=write_files, time=4.5)
-
- """
- def __init__(self, input, filename, rate=1000, dur=0.0):
- PyoObject.__init__(self)
- self._input = input
- self._filename = filename
- self._path, self._name = os.path.split(filename)
- self._rate = rate
- self._dur = dur
- self._in_fader = InputFader(input)
- in_fader, lmax = convertArgsToLists(self._in_fader)
- self._base_objs = [ControlRec_base(wrap(in_fader,i), rate, dur) for i in range(lmax)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def __dir__(self):
- return []
-
- def write(self):
- """
- Writes recorded values in text files on the disk.
-
- """
- for i, obj in enumerate(self._base_objs):
- f = open(os.path.join(self._path, "%s_%03d" % (self._name, i)), "w")
- [f.write("%f %f\n" % p) for p in obj.getData()]
- f.close()
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class ControlRead(PyoObject):
- """
- Reads control values previously stored in text files.
-
- Read sampled sound from a table, with optional looping mode.
-
- Parentclass: PyoObject
-
- Parameters:
-
- filename : string
- Full path (without extension) used to create the files. Usually
- the same filename as the one given to a ControlRec object to
- record automation. The directory will be scaned and all files
- named "filename_xxx" will add a new stream in the object.
- rate : int, optional
- Rate at which the values are sampled. Defaults to 1000.
- loop : boolean, optional
- Looping mode, False means off, True means on.
- Defaults to False.
- interp : int, optional
- Choice of the interpolation method. Defaults to 2.
- 1 : no interpolation
- 2 : linear
- 3 : cosinus
- 4 : cubic
-
- Methods:
-
- setRate(x) : Replace the `rate` attribute.
- setLoop(x) : Replace the `loop` attribute.
- setInterp(x) : Replace the `interp` attribute.
-
- Attributes:
-
- rate : int, Sampling frequency in cycles per second.
- loop : boolean, Looping mode.
- interp : int {1, 2, 3, 4}, Interpolation method.
-
- Notes:
-
- ControlRead will sends a trigger signal at the end of the playback if
- loop is off or any time it wraps around if loop is on. User can
- retreive the trigger streams by calling obj['trig']:
-
- >>> rnds = ControlRead(home+"/freq_auto", loop=True)
- >>> t = SndTable(SNDS_PATH+"/transparent.aif")
- >>> loop = TrigEnv(rnds["trig"], t, dur=[.2,.3,.4,.5], mul=.5).out()
-
- The out() method is bypassed. ControlRead's signal can not be sent to
- audio outs.
-
- See also: ControlRec
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> home = os.path.expanduser('~')
- >>> # assuming "test_xxx" exists in the user directory
- >>> # run ControlRec's example to generate the files
- >>> rnds = ControlRead(home+"/test", rate=100, loop=True)
- >>> sines = SineLoop(freq=rnds, feedback=.05, mul=.15).out()
-
- """
- def __init__(self, filename, rate=1000, loop=False, interp=2, mul=1, add=0):
- PyoObject.__init__(self)
- self._filename = filename
- self._path, self._name = os.path.split(filename)
- self._rate = rate
- self._loop = loop
- self._interp = interp
- self._mul = mul
- self._add = add
- files = sorted([f for f in os.listdir(self._path) if self._name+"_" in f])
- mul, add, lmax = convertArgsToLists(mul, add)
- self._base_objs = []
- for i in range(len(files)):
- path = os.path.join(self._path, files[i])
- f = open(path, "r")
- values = [float(l.split()[1]) for l in f.readlines()]
- f.close()
- self._base_objs.append(ControlRead_base(values, rate, loop, interp, wrap(mul,i), wrap(add,i)))
- self._trig_objs = Dummy([TriggerDummy_base(obj) for obj in self._base_objs])
-
- def __dir__(self):
- return ['rate', 'loop', 'interp', 'mul', 'add']
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setRate(self, x):
- """
- Replace the `rate` attribute.
-
- Parameters:
-
- x : int
- new `rate` attribute.
-
- """
- self._rate = x
- x, lmax = convertArgsToLists(x)
- [obj.setRate(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setLoop(self, x):
- """
- Replace the `loop` attribute.
-
- Parameters:
-
- x : boolean
- new `loop` attribute.
-
- """
- self._loop = x
- x, lmax = convertArgsToLists(x)
- [obj.setLoop(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInterp(self, x):
- """
- Replace the `interp` attribute.
-
- Parameters:
-
- x : int {1, 2, 3, 4}
- new `interp` attribute.
-
- """
- self._interp = x
- x, lmax = convertArgsToLists(x)
- [obj.setInterp(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def rate(self):
- """int. Sampling frequency in cycles per second."""
- return self._rate
- @rate.setter
- def rate(self, x): self.setRate(x)
-
- @property
- def loop(self):
- """boolean. Looping mode."""
- return self._loop
- @loop.setter
- def loop(self, x): self.setLoop(x)
-
- @property
- def interp(self):
- """int {1, 2, 3, 4}. Interpolation method."""
- return self._interp
- @interp.setter
- def interp(self, x): self.setInterp(x)
-
-class NoteinRec(PyoObject):
- """
- Records Notein inputs and writes them in a text file.
-
- `input` parameter must be a Notein object managing any number
- of streams, other parameters can't be in list format. The user
- must call the `write` method to create text files on the disk.
-
- Each line in the text files contains three values, the absolute time
- in seconds, the Midi pitch and the normalized velocity.
-
- The play() method starts the recording and is not called at the
- object creation time.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : Notein
- Notein signal to sample.
- filename : string
- Full path (without extension) used to create the files.
- "_000" will be added to file's names with increasing digits
- according to the number of streams in input. The same
- filename can be passed to a NoteinRead object to read all
- related files.
-
- Methods:
-
- write() : Writes values in a text file on the disk.
-
- Notes:
-
- All parameters can only be set at intialization time.
-
- The `write` method must be called on the object to write the files
- on the disk.
-
- The out() method is bypassed. NoteinRec's signal can not be sent to
- audio outs.
-
- NoteinRec has no `mul` and `add` attributes.
-
- See also: NoteinRead
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> notes = Notein(poly=2)
- >>> home = os.path.expanduser('~')
- >>> rec = NoteinRec(notes, home+"/test").play()
- >>> # call rec.write() to save "test_000" and "test_001" in the home directory.
-
- """
- def __init__(self, input, filename):
- PyoObject.__init__(self)
- self._input = input
- self._filename = filename
- self._path, self._name = os.path.split(filename)
- self._in_pitch = self._input["pitch"]
- self.in_velocity = self._input["velocity"]
- in_pitch, in_velocity, lmax = convertArgsToLists(self._in_pitch, self.in_velocity)
- self._base_objs = [NoteinRec_base(wrap(in_pitch,i), wrap(in_velocity,i)) for i in range(lmax)]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def __dir__(self):
- return []
-
- def write(self):
- """
- Writes recorded values in text files on the disk.
-
- """
- for i, obj in enumerate(self._base_objs):
- f = open(os.path.join(self._path, "%s_%03d" % (self._name, i)), "w")
- [f.write("%f %f %f\n" % p) for p in obj.getData()]
- f.close()
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
-class NoteinRead(PyoObject):
- """
- Reads Notein values previously stored in text files.
-
- Parentclass: PyoObject
-
- Parameters:
-
- filename : string
- Full path (without extension) used to create the files. Usually
- the same filename as the one given to a NoteinRec object to
- record automation. The directory will be scaned and all files
- named "filename_xxx" will add a new stream in the object.
- loop : boolean, optional
- Looping mode, False means off, True means on.
- Defaults to False.
-
- Methods:
-
- setLoop(x) : Replace the `loop` attribute.
- get(identifier, all) : Return the first sample of the current buffer as a float.
-
- Attributes:
-
- loop : boolean, Looping mode.
-
- Notes:
-
- NoteinRead will sends a trigger signal at the end of the playback if
- loop is off or any time it wraps around if loop is on. User can
- retreive the trigger streams by calling obj['trig']:
-
- >>> notes = NoteinRead(home+"/notes_rec", loop=True)
- >>> t = SndTable(SNDS_PATH+"/transparent.aif")
- >>> loop = TrigEnv(notes["trig"], t, dur=[.2,.3,.4,.5], mul=.25).out()
-
- The out() method is bypassed. NoteinRead's signal can not be sent to
- audio outs.
-
- See also: NoteinRec
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> home = os.path.expanduser('~')
- >>> # assuming "test_xxx" exists in the user directory
- >>> notes = NoteinRead(home+"/test", loop=True)
- >>> amps = Port(notes['velocity'], 0.001, 0.5, mul=.2)
- >>> sines = SineLoop(freq=notes['pitch'], feedback=.05, mul=amps).out()
-
- """
- def __init__(self, filename, loop=False, mul=1, add=0):
- PyoObject.__init__(self)
- self._pitch_dummy = []
- self._velocity_dummy = []
- self._filename = filename
- self._path, self._name = os.path.split(filename)
- self._loop = loop
- self._mul = mul
- self._add = add
- files = sorted([f for f in os.listdir(self._path) if self._name+"_" in f])
- mul, add, lmax = convertArgsToLists(mul, add)
- self._base_objs = []
- _trig_objs_tmp = []
- self._poly = len(files)
- for i in range(self._poly):
- path = os.path.join(self._path, files[i])
- f = open(path, "r")
- vals = [l.split() for l in f.readlines()]
- timestamps = [float(v[0]) for v in vals]
- pitches = [float(v[1]) for v in vals]
- amps = [float(v[2]) for v in vals]
- f.close()
- self._base_objs.append(NoteinRead_base(pitches, timestamps, loop))
- self._base_objs.append(NoteinRead_base(amps, timestamps, loop, wrap(mul,i), wrap(add,i)))
- _trig_objs_tmp.append(TriggerDummy_base(self._base_objs[-1]))
- self._trig_objs = Dummy(_trig_objs_tmp)
-
- def __dir__(self):
- return ['loop', 'mul', 'add']
-
- def __getitem__(self, str):
- if str == 'trig':
- return self._trig_objs
- if str == 'pitch':
- self._pitch_dummy.append(Dummy([self._base_objs[i*2] for i in range(self._poly)]))
- return self._pitch_dummy[-1]
- if str == 'velocity':
- self._velocity_dummy.append(Dummy([self._base_objs[i*2+1] for i in range(self._poly)]))
- return self._velocity_dummy[-1]
-
- def get(self, identifier="pitch", all=False):
- """
- Return the first sample of the current buffer as a float.
-
- Can be used to convert audio stream to usable Python data.
-
- "pitch" or "velocity" must be given to `identifier` to specify
- which stream to get value from.
-
- Parameters:
-
- identifier : string {"pitch", "velocity"}
- Address string parameter identifying audio stream.
- Defaults to "pitch".
- all : boolean, optional
- If True, the first value of each object's stream
- will be returned as a list. Otherwise, only the value
- of the first object's stream will be returned as a float.
- Defaults to False.
-
- """
- if not all:
- return self.__getitem__(identifier)[0]._getStream().getValue()
- else:
- return [obj._getStream().getValue() for obj in self.__getitem__(identifier).getBaseObjects()]
-
- def out(self, chnl=0, inc=1, dur=0, delay=0):
- return self.play(dur, delay)
-
- def setLoop(self, x):
- """
- Replace the `loop` attribute.
-
- Parameters:
-
- x : boolean
- new `loop` attribute.
-
- """
- self._loop = x
- x, lmax = convertArgsToLists(x)
- [obj.setLoop(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def loop(self):
- """boolean. Looping mode."""
- return self._loop
- @loop.setter
- def loop(self, x): self.setLoop(x)
-
-class DBToA(PyoObject):
- """
- Returns the amplitude equivalent of a decibel value.
-
- Returns the amplitude equivalent of a decibel value, 0 dB = 1.
- The `input` values are internally clipped to -120 dB so -120 dB
- returns 0.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal, decibel value.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # amplitude modulation 6 dB around -18 dB
- >>> db = Sine(freq=1, phase=[0,.5], mul=6, add=-18)
- >>> amp = DBToA(db)
- >>> b = SineLoop(freq=[350,400], feedback=.1, mul=amp).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [DBToA_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class AToDB(PyoObject):
- """
- Returns the decibel equivalent of an amplitude value.
-
- Returns the decibel equivalent of an amplitude value, 1 = 0 dB.
- The `input` values are internally clipped to 0.000001 so values
- less than or equal to 0.000001 return -120 dB.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal, amplitude value.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> # amplitude modulation of a notch around 1000 Hz, from -120 db to 0dB
- >>> amp = Sine([1,1.5], mul=.5, add=.5)
- >>> db = AToDB(amp)
- >>> a = PinkNoise(.2)
- >>> b = EQ(a, freq=1000, q=2, boost=db).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [AToDB_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class Scale(PyoObject):
- """
- Maps an input range of audio values to an output range.
-
- Scale maps an input range of audio values to an output range.
- The ranges can be specified with `min` and `max` reversed for
- invert-mapping. If specified, the mapping can also be exponential.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- inmin : float or PyoObject, optional
- Minimum input value. Defaults to 0.
- inmax : float or PyoObject, optional
- Maximum input value. Defaults to 1.
- outmin : float or PyoObject, optional
- Minimum output value. Defaults to 0.
- outmax : float or PyoObject, optional
- Maximum output value. Defaults to 1.
- exp : float, optional
- Exponent value, specifies the nature of the scaling curve.
- Values between 0 and 1 give a reversed curve. Defaults to 1.0.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setInMin(x) : Replace the `inmin` attribute.
- setInMax(x) : Replace the `inmax` attribute.
- setOutMin(x) : Replace the `outmin` attribute.
- setOutMax(x) : Replace the `outmax` attribute.
- setExp(x) : Replace the `exp` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- inmin : float or PyoObject. Minimum input value.
- inmax : float or PyoObject. Maximum input value.
- outmin : float or PyoObject. Minimum output value.
- outmax : float or PyoObject. Maximum output value.
- exp : float or PyoObject. Exponent value (nature of the scaling curve).
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> met = Metro(.125, poly=2).play()
- >>> rnd = TrigRand(met, min=0, max=1, port=.005)
- >>> omlf = Sine(.5, mul=700, add=1000)
- >>> fr = Scale(rnd, inmin=0, inmax=1, outmin=250, outmax=omlf, exp=1)
- >>> amp = TrigEnv(met, table=HannTable(), dur=.25, mul=.2)
- >>> out = SineLoop(fr, feedback=.07, mul=amp).out()
-
- """
- def __init__(self, input, inmin=0, inmax=1, outmin=0, outmax=1, exp=1, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._inmin = inmin
- self._inmax = inmax
- self._outmin = outmin
- self._outmax = outmax
- self._exp = exp
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, inmin, inmax, outmin, outmax, exp, mul, add, lmax = convertArgsToLists(self._in_fader, inmin, inmax, outmin, outmax, exp, mul, add)
- self._base_objs = [Scale_base(wrap(in_fader,i), wrap(inmin,i), wrap(inmax,i), wrap(outmin,i), wrap(outmax,i), wrap(exp,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'inmin', 'inmax', 'outmin', 'outmax', 'exp', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setInMin(self, x):
- """
- Replace the `inmin` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `inmin` attribute.
-
- """
- self._inmin = x
- x, lmax = convertArgsToLists(x)
- [obj.setInMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setInMax(self, x):
- """
- Replace the `inmax` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `inmax` attribute.
-
- """
- self._inmax = x
- x, lmax = convertArgsToLists(x)
- [obj.setInMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setOutMin(self, x):
- """
- Replace the `outmin` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `outmin` attribute.
-
- """
- self._outmin = x
- x, lmax = convertArgsToLists(x)
- [obj.setOutMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setOutMax(self, x):
- """
- Replace the `outmax` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `outmax` attribute.
-
- """
- self._outmax = x
- x, lmax = convertArgsToLists(x)
- [obj.setOutMax(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setExp(self, x):
- """
- Replace the `exp` attribute.
-
- Parameters:
-
- x : float
- New `exp` attribute.
-
- """
- self._exp = x
- x, lmax = convertArgsToLists(x)
- [obj.setExp(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., 127., 'lin', 'inmin', self._inmin),
- SLMap(0., 127., 'lin', 'inmax', self._inmax),
- SLMap(0., 127., 'lin', 'outmin', self._outmin),
- SLMap(0., 127., 'lin', 'outmax', self._outmax),
- SLMap(1., 10., 'lin', 'exp', self._exp),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def inmin(self):
- """float or PyoObject. Minimum input value."""
- return self._inmin
- @inmin.setter
- def inmin(self, x): self.setInMin(x)
-
- @property
- def inmax(self):
- """float or PyoObject. Maximum input value."""
- return self._inmax
- @inmax.setter
- def inmax(self, x): self.setInMax(x)
-
- @property
- def outmin(self):
- """float or PyoObject. Minimum output value."""
- return self._outmin
- @outmin.setter
- def outmin(self, x): self.setOutMin(x)
-
- @property
- def outmax(self):
- """float or PyoObject. Maximum output value."""
- return self._outmax
- @outmax.setter
- def outmax(self, x): self.setOutMax(x)
-
- @property
- def exp(self):
- """float or PyoObject. Exponent value (nature of the scaling curve)."""
- return self._exp
- @exp.setter
- def exp(self, x): self.setExp(x)
-
-class CentsToTranspo(PyoObject):
- """
- Returns the transposition factor equivalent of a given cents value.
-
- Returns the transposition factor equivalent of a given cents value, 0 cents = 1.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal, cents value.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> met = Metro(.125, poly=2).play()
- >>> cts = TrigRandInt(met, max=12, mul=100)
- >>> trans = CentsToTranspo(cts)
- >>> sf = SfPlayer(SNDS_PATH+"/transparent.aif", loop=True, speed=trans, mul=.25).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [CentsToTranspo_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class TranspoToCents(PyoObject):
- """
- Returns the cents value equivalent of a transposition factor.
-
- Returns the cents value equivalent of a transposition factor, 1 = 0 cents.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal, transposition factor.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> met = Metro(.125, poly=2).play()
- >>> trans = TrigChoice(met, choice=[.25,.5,.5,.75,1,1.25,1.5])
- >>> semi = TranspoToCents(trans, mul=0.01)
- >>> sf = SfPlayer(SNDS_PATH+"/transparent.aif", loop=True, mul=.3).out()
- >>> harm = Harmonizer(sf, transpo=semi).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [TranspoToCents_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class MToF(PyoObject):
- """
- Returns the frequency (Hz) equivalent to a midi note.
-
- Returns the frequency (Hz) equivalent to a midi note,
- 60 = 261.62556530066814 Hz.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal as midi note.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> met = Metro(.125, poly=2).play()
- >>> mid = TrigChoice(met, choice=[60, 63, 67, 70], port=.005)
- >>> hz = MToF(mid)
- >>> syn = SineLoop(freq=hz, feedback=.07, mul=.2).out()
-
- """
-
- def __init__(self, input, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
- self._base_objs = [MToF_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
-class MToT(PyoObject):
- """
- Returns the transposition factor equivalent to a midi note.
-
- Returns the transposition factor equivalent to a midi note. If the midi
- note equal the `centralkey` argument, the output is 1.0.
-
- Parentclass: PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal as midi note.
- centralkey : float, optional
- The midi note that returns a transposition factor of 1,
- that is to say no transposition. Defaults to 60.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setCentralKey(x) : Replace the `centralkey` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- centralkey : float. The midi note that returns no transposition.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> tsnd = SndTable(SNDS_PATH+"/accord.aif")
- >>> tenv = CosTable([(0,0), (100,1), (1000,.5), (8192,0)])
- >>> met = Metro(.125, poly=2).play()
- >>> amp = TrigEnv(met, table=tenv, dur=.25, mul=.7)
- >>> mid = TrigChoice(met, choice=[43, 45, 60, 63], port=.0025)
- >>> sp = MToT(mid)
- >>> snd = Osc(tsnd, freq=tsnd.getRate()/sp, mul=amp).out()
-
- """
-
- def __init__(self, input, centralkey=60.0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._centralkey = centralkey
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, centralkey, mul, add, lmax = convertArgsToLists(self._in_fader, centralkey, mul, add)
- self._base_objs = [MToT_base(wrap(in_fader,i), wrap(centralkey,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'centralkey', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setCentralKey(self, x):
- """
- Replace the `centralkey` attribute.
-
- Parameters:
-
- x : float
- New `centralkey` attribute.
-
- """
- self._centralkey = x
- x, lmax = convertArgsToLists(x)
- [obj.setCentralKey(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def ctrl(self, map_list=None, title=None, wxnoserver=False):
- self._map_list = []
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
- @property
- def centralkey(self):
- """float. The midi note that returns no transposition."""
- return self._centralkey
- @centralkey.setter
- def centralkey(self, x): self.setCentralKey(x)
-
-class Between(PyoObject):
- """
- Informs when an input signal is contained in a specified range.
-
- Outputs a value of 1.0 if the input signal is greater or egal
- than `min` and less than `max`. Otherwise, outputs a value of 0.0.
-
- Parentclass : PyoObject
-
- Parameters:
-
- input : PyoObject
- Input signal to process.
- min : float or PyoObject, optional
- Minimum range value. Defaults to 0.
- max : float or PyoObject, optional
- Maximum range value. Defaults to 1.
-
- Methods:
-
- setInput(x, fadetime) : Replace the `input` attribute.
- setMin(x) : Replace the `min` attribute.
- setMax(x) : Replace the `max` attribute.
-
- Attributes:
-
- input : PyoObject. Input signal to process.
- min : float or PyoObject. Minimum range value.
- max : float or PyoObject. Maximum range value.
-
- Examples:
-
- >>> s = Server().boot()
- >>> s.start()
- >>> ph = Phasor(freq=[7,8])
- >>> tr = Between(ph, min=0, max=.25)
- >>> amp = Port(tr, risetime=0.002, falltime=0.002, mul=.2)
- >>> a = SineLoop(freq=[245,250], feedback=.1, mul=amp).out()
-
- """
- def __init__(self, input, min=-1.0, max=1.0, mul=1, add=0):
- PyoObject.__init__(self)
- self._input = input
- self._min = min
- self._max = max
- self._mul = mul
- self._add = add
- self._in_fader = InputFader(input)
- in_fader, min, max, mul, add, lmax = convertArgsToLists(self._in_fader, min, max, mul, add)
- self._base_objs = [Between_base(wrap(in_fader,i), wrap(min,i), wrap(max,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
-
- def __dir__(self):
- return ['input', 'min', 'max', 'mul', 'add']
-
- def setInput(self, 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.
-
- """
- self._input = x
- self._in_fader.setInput(x, fadetime)
-
- def setMin(self, x):
- """
- Replace the `min` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `min` attribute.
-
- """
- self._min = x
- x, lmax = convertArgsToLists(x)
- [obj.setMin(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
-
- def setMax(self, x):
- """
- Replace the `max` attribute.
-
- Parameters:
-
- x : float or PyoObject
- New `max` attribute.
-
- """
- self._max = x
- x, lmax = convertArgsToLists(x)
- [obj.setMax(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', 'min', self._min),
- SLMap(0., 1., 'lin', 'max', self._max),
- SLMapMul(self._mul)]
- PyoObject.ctrl(self, map_list, title, wxnoserver)
-
- @property
- def input(self):
- """PyoObject. Input signal to process."""
- return self._input
- @input.setter
- def input(self, x): self.setInput(x)
-
- @property
- def min(self):
- """float or PyoObject. Minimum range value."""
- return self._min
- @min.setter
- def min(self, x): self.setMin(x)
-
- @property
- def max(self):
- """float or PyoObject. Maximum range value."""
- return self._max
- @max.setter
- def max(self, x): self.setMax(x)
diff --git a/build/temp.linux-x86_64-2.7/src/engine/dummymodule.o b/build/temp.linux-x86_64-2.7/src/engine/dummymodule.o
deleted file mode 100644
index d2c6d6f..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/engine/dummymodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/engine/fft.o b/build/temp.linux-x86_64-2.7/src/engine/fft.o
deleted file mode 100644
index 493b37a..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/engine/fft.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/engine/inputfadermodule.o b/build/temp.linux-x86_64-2.7/src/engine/inputfadermodule.o
deleted file mode 100644
index 1ed0a43..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/engine/inputfadermodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/engine/interpolation.o b/build/temp.linux-x86_64-2.7/src/engine/interpolation.o
deleted file mode 100644
index fafae68..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/engine/interpolation.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/engine/mixmodule.o b/build/temp.linux-x86_64-2.7/src/engine/mixmodule.o
deleted file mode 100644
index dfd4104..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/engine/mixmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/engine/pyomodule.o b/build/temp.linux-x86_64-2.7/src/engine/pyomodule.o
deleted file mode 100644
index c530950..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/engine/pyomodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/engine/servermodule.o b/build/temp.linux-x86_64-2.7/src/engine/servermodule.o
deleted file mode 100644
index 9efed5d..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/engine/servermodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/engine/streammodule.o b/build/temp.linux-x86_64-2.7/src/engine/streammodule.o
deleted file mode 100644
index 040f62a..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/engine/streammodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/engine/wind.o b/build/temp.linux-x86_64-2.7/src/engine/wind.o
deleted file mode 100644
index 4fe0fb8..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/engine/wind.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/analysismodule.o b/build/temp.linux-x86_64-2.7/src/objects/analysismodule.o
deleted file mode 100644
index c2dedaa..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/analysismodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/arithmeticmodule.o b/build/temp.linux-x86_64-2.7/src/objects/arithmeticmodule.o
deleted file mode 100644
index 348c0d6..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/arithmeticmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/bandsplitmodule.o b/build/temp.linux-x86_64-2.7/src/objects/bandsplitmodule.o
deleted file mode 100644
index bb995fa..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/bandsplitmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/chorusmodule.o b/build/temp.linux-x86_64-2.7/src/objects/chorusmodule.o
deleted file mode 100644
index 7a2a070..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/chorusmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/compressmodule.o b/build/temp.linux-x86_64-2.7/src/objects/compressmodule.o
deleted file mode 100644
index 7e9d310..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/compressmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/convolvemodule.o b/build/temp.linux-x86_64-2.7/src/objects/convolvemodule.o
deleted file mode 100644
index a9d34ce..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/convolvemodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/delaymodule.o b/build/temp.linux-x86_64-2.7/src/objects/delaymodule.o
deleted file mode 100644
index 89fa140..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/delaymodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/distomodule.o b/build/temp.linux-x86_64-2.7/src/objects/distomodule.o
deleted file mode 100644
index 8773411..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/distomodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/fadermodule.o b/build/temp.linux-x86_64-2.7/src/objects/fadermodule.o
deleted file mode 100644
index 8a70110..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/fadermodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/fftmodule.o b/build/temp.linux-x86_64-2.7/src/objects/fftmodule.o
deleted file mode 100644
index 6b72514..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/fftmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/filtremodule.o b/build/temp.linux-x86_64-2.7/src/objects/filtremodule.o
deleted file mode 100644
index 8b0a43b..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/filtremodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/freeverbmodule.o b/build/temp.linux-x86_64-2.7/src/objects/freeverbmodule.o
deleted file mode 100644
index 0024113..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/freeverbmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/granulatormodule.o b/build/temp.linux-x86_64-2.7/src/objects/granulatormodule.o
deleted file mode 100644
index cc7921c..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/granulatormodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/harmonizermodule.o b/build/temp.linux-x86_64-2.7/src/objects/harmonizermodule.o
deleted file mode 100644
index 1eb7104..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/harmonizermodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/hilbertmodule.o b/build/temp.linux-x86_64-2.7/src/objects/hilbertmodule.o
deleted file mode 100644
index bdb8066..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/hilbertmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/inputmodule.o b/build/temp.linux-x86_64-2.7/src/objects/inputmodule.o
deleted file mode 100644
index e119bf5..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/inputmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/lfomodule.o b/build/temp.linux-x86_64-2.7/src/objects/lfomodule.o
deleted file mode 100644
index 2e8934f..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/lfomodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/matrixmodule.o b/build/temp.linux-x86_64-2.7/src/objects/matrixmodule.o
deleted file mode 100644
index fb6ecd4..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/matrixmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/matrixprocessmodule.o b/build/temp.linux-x86_64-2.7/src/objects/matrixprocessmodule.o
deleted file mode 100644
index b52bf62..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/matrixprocessmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/metromodule.o b/build/temp.linux-x86_64-2.7/src/objects/metromodule.o
deleted file mode 100644
index b32bb54..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/metromodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/midimodule.o b/build/temp.linux-x86_64-2.7/src/objects/midimodule.o
deleted file mode 100644
index 00a625d..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/midimodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/noisemodule.o b/build/temp.linux-x86_64-2.7/src/objects/noisemodule.o
deleted file mode 100644
index 4946d3d..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/noisemodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/oscbankmodule.o b/build/temp.linux-x86_64-2.7/src/objects/oscbankmodule.o
deleted file mode 100644
index ba0bbf6..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/oscbankmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/oscilmodule.o b/build/temp.linux-x86_64-2.7/src/objects/oscilmodule.o
deleted file mode 100644
index cbcf85f..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/oscilmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/oscmodule.o b/build/temp.linux-x86_64-2.7/src/objects/oscmodule.o
deleted file mode 100644
index 74a1ed8..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/oscmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/panmodule.o b/build/temp.linux-x86_64-2.7/src/objects/panmodule.o
deleted file mode 100644
index b8c22a2..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/panmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/patternmodule.o b/build/temp.linux-x86_64-2.7/src/objects/patternmodule.o
deleted file mode 100644
index 9985072..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/patternmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/randommodule.o b/build/temp.linux-x86_64-2.7/src/objects/randommodule.o
deleted file mode 100644
index f570992..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/randommodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/recordmodule.o b/build/temp.linux-x86_64-2.7/src/objects/recordmodule.o
deleted file mode 100644
index 64b0c9f..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/recordmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/selectmodule.o b/build/temp.linux-x86_64-2.7/src/objects/selectmodule.o
deleted file mode 100644
index 81767cb..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/selectmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/sfplayermodule.o b/build/temp.linux-x86_64-2.7/src/objects/sfplayermodule.o
deleted file mode 100644
index d271afd..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/sfplayermodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/sigmodule.o b/build/temp.linux-x86_64-2.7/src/objects/sigmodule.o
deleted file mode 100644
index 020660a..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/sigmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/tablemodule.o b/build/temp.linux-x86_64-2.7/src/objects/tablemodule.o
deleted file mode 100644
index 9aa7ea1..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/tablemodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/trigmodule.o b/build/temp.linux-x86_64-2.7/src/objects/trigmodule.o
deleted file mode 100644
index 2cc211e..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/trigmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/utilsmodule.o b/build/temp.linux-x86_64-2.7/src/objects/utilsmodule.o
deleted file mode 100644
index e50b570..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/utilsmodule.o and /dev/null differ
diff --git a/build/temp.linux-x86_64-2.7/src/objects/wgverbmodule.o b/build/temp.linux-x86_64-2.7/src/objects/wgverbmodule.o
deleted file mode 100644
index 9bf715e..0000000
Binary files a/build/temp.linux-x86_64-2.7/src/objects/wgverbmodule.o and /dev/null differ
--
python-pyo packaging
More information about the pkg-multimedia-commits
mailing list