[PD-cvs] externals/grill/py/scripts sig.py,NONE,1.1 script.py,1.3,1.4
Thomas Grill
xovo at users.sourceforge.net
Sun Mar 13 05:59:49 CET 2005
- Previous message: [PD-cvs] externals/grill/py/pd sig-1.pd,NONE,1.1 sig-2.pd,NONE,1.1 script-1.pd,1.5,1.6
- Next message: [PD-cvs] externals/grill/py/source pydsp.cpp,NONE,1.1 bound.cpp,1.14,1.15 clmeth.cpp,1.15,1.16 main.cpp,1.29,1.30 main.h,1.35,1.36 modmeth.cpp,1.16,1.17 py.cpp,1.19,1.20 pyargs.cpp,1.13,1.14 pybuffer.cpp,1.2,1.3 pyext.cpp,1.28,1.29 pyext.h,1.19,1.20 register.cpp,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/externals/grill/py/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29887/scripts
Modified Files:
script.py
Added Files:
sig.py
Log Message:
pydsp: share dsp buffer objects at inplace operation
DSP support for py/pyext: new objects pyext~,pyx~,pyext.~,pyx.~
new base class for py and pyext classes
preset sys.argv for module loading
support for buffer objects (preliminary)
py: bang in left inlet now really triggers without arguments
fixes for detached operation and single-threaded version
little restructuring
adjust pd and py files for correct argument passing
more optimizations
update for new flext callback naming
use lock count instead of message queuing to avoid py->py messaging deadlock
pyext: fix for inlet count
--- NEW FILE: sig.py ---
# py/pyext - python script objects for PD and MaxMSP
#
# Copyright (c) 2002-2005 Thomas Grill (gr at grrrr.org)
# For information on usage and redistribution, and for a DISCLAIMER OF ALL
# WARRANTIES, see the file, "license.txt," in this distribution.
#
"""This is an example script for the py/pyext signal support.
For numarray see http://numeric.scipy.org
It will probably once be replaced by Numeric(3)
"""
try:
import pyext
except:
print "ERROR: This script must be loaded by the PD/Max py/pyext external"
try:
import psyco
psyco.full()
print "Using JIT compilation"
except:
# don't care
pass
import sys,math
try:
import numarray
except:
print "Failed importing numarray module:",sys.exc_value
class gain(pyext._class):
"""Just a simple gain stage"""
gain = 0
def _signal(self):
# Multiply input vector by gain and copy to output
self._outvec(0)[:] = self._invec(0)*self.gain
class pan(pyext._class):
"""Stereo panning"""
def __init__(self):
self.float_1(0.5)
def float_1(self,pos):
"""pos ranges from 0 to 1"""
x = pos*math.pi/2
self.fl = math.cos(x)
self.fr = math.sin(x)
def _signal(self):
# Multiply input vector by gain and copy to output
iv = self._invec(0)
# first process right output channel because left one could be
# identical to input
# we could also test with 'self._outvec(1)[:] is iv'
self._outvec(1)[:] = iv*self.fr
self._outvec(0)[:] = iv*self.fl
Index: script.py
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/scripts/script.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** script.py 19 Jan 2005 04:58:35 -0000 1.3
--- script.py 13 Mar 2005 04:59:36 -0000 1.4
***************
*** 29,43 ****
def strcat(*args):
"""Concatenate several symbols"""
! s = ""
! for si in args:
! s += str(si)
! return s
!
def addall(*args): # variable argument list
! s = 0
! for si in args:
! s += si
! return s
--- 29,37 ----
def strcat(*args):
"""Concatenate several symbols"""
! return reduce(lambda a,b: a+str(b), args,"")
def addall(*args): # variable argument list
! """Add a couple of numbers"""
! return reduce(lambda a,b: a+b, args,0)
- Previous message: [PD-cvs] externals/grill/py/pd sig-1.pd,NONE,1.1 sig-2.pd,NONE,1.1 script-1.pd,1.5,1.6
- Next message: [PD-cvs] externals/grill/py/source pydsp.cpp,NONE,1.1 bound.cpp,1.14,1.15 clmeth.cpp,1.15,1.16 main.cpp,1.29,1.30 main.h,1.35,1.36 modmeth.cpp,1.16,1.17 py.cpp,1.19,1.20 pyargs.cpp,1.13,1.14 pybuffer.cpp,1.2,1.3 pyext.cpp,1.28,1.29 pyext.h,1.19,1.20 register.cpp,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list