fazekasgy@0: fazekasgy@0: * VamPy is a VAMP plugin wrapper for Python Scripts. fazekasgy@0: fazekasgy@0: WHAT IS IT FOR? fazekasgy@0: fazekasgy@0: you can write VAMP plugins in Python which can do the same as the native C++ plugins fazekasgy@0: plus more if you're using advanced Python modules. fazekasgy@0: fazekasgy@0: you might get into VAMP development more easily this way. fazekasgy@0: you can use it for prototyping your plugin before writing in C++ fazekasgy@0: fazekasgy@0: fazekasgy@0: LIMITATIONS: fazekasgy@0: fazekasgy@0: this is really just a proof of concept. The implementation is not the most efficient. fazekasgy@0: only tested on MacOSX, but in theory should work on other platforms with small fixes fazekasgy@0: The Python C/API is not fully thread safe and correct threading is not yet implemented. fazekasgy@0: (This can cause problems resulting in nasty crashes.) fazekasgy@0: fazekasgy@0: Error checking is incomplete. fazekasgy@0: You better not make a mistake in your Python script, although in most cases you can see what fazekasgy@0: the problem is if you start the host (Sonic Visualiser) from the command line. fazekasgy@0: fazekasgy@0: fazekasgy@0: HOW DOES IT WORK: fazekasgy@0: fazekasgy@0: (1) Make sure you have Python installed. fazekasgy@0: (2) Compile the C++ source or ask me for a binary (MacOS). fazekasgy@0: (3) Copy the library in your Vamp plugin directory like any other VAMP plugins: fazekasgy@0: eg. /Library/Audio/Plug-Ins/VAMP fazekasgy@0: (4) Write your python plugins and copy them to the same place. fazekasgy@0: (5) Each plugin must contain a single class with the same name as your script file. fazekasgy@0: e.g. PyZeroCrossing.py -> calss PyZeroCrossing fazekasgy@0: -Scripts with syntax errors in them are ignored. fazekasgy@0: -Scripts not having the same class as the filename are ignored. fazekasgy@0: -Other unknown scripts are likely to cause a nasty crash. fazekasgy@0: (Don't put other python scripts in your VAMP directory.) fazekasgy@0: fazekasgy@0: fazekasgy@0: WHY PYTHON? fazekasgy@0: fazekasgy@0: Python is a general purpose high level scripting language. fazekasgy@0: It is interpreted, so you don't need to compile your plugins fazekasgy@0: It has very high level libraries. e.g. you can stream audio from your VamPy plugin (it works for me...) fazekasgy@0: Supports functional programming fazekasgy@0: fazekasgy@0: fazekasgy@0: COMPILING AND LINKING: fazekasgy@1: fazekasgy@0: (1) include Python.h wherever it is on your machine fazekasgy@0: (2) this plugin needs to be linked against the Python binary: fazekasgy@0: fazekasgy@0: example on on MacOSX: fazekasgy@0: g++ -O2 -Wall -I. -fPIC -c -o pyvamp-main.o pyvamp-main.cpp fazekasgy@0: g++ -dynamiclib -o vamp-pyvamp-plugin.dylib ./PyPlugScanner.o ./PyPlugin.o ./pyvamp-main.o sdk/vamp-sdk/libvamp-sdk.a fazekasgy@0: -u _PyMac_Error /Library/Frameworks/Python.framework/Versions/2.5/Python fazekasgy@0: fazekasgy@0: (3) There is a modified Makefile from the VAMP-SDK that compiles this plugin by default. fazekasgy@0: fazekasgy@0: fazekasgy@0: TODO: needs more complete error checking fazekasgy@0: needs correct implementation of Python threading fazekasgy@0: more efficient data conversion using the buffering interface or ctypes fazekasgy@0: VAMP 'programs' not implemented fazekasgy@0: support multiple classes per script in scanner fazekasgy@0: ensure proper cleanup, (host do a good job though) fazekasgy@0: fazekasgy@0: