fazekasgy@37: fazekasgy@37: * VamPy is an API wrapper for Vamp. It allows for writing Vamp fazekasgy@37: plugins in Python with or without Numpy support. fazekasgy@37: fazekasgy@37: WHAT IS IT FOR? fazekasgy@37: fazekasgy@37: This wrapper is for writing Vamp plugins in Python which fazekasgy@37: can do the same as a native C++ plugin, plus a lot more if fazekasgy@37: you're using advanced Python modules. fazekasgy@37: fazekasgy@37: This may be an easier way to get into Vamp development. fazekasgy@37: You can use it for prototyping your plugin before writing fazekasgy@37: it in C++. fazekasgy@37: fazekasgy@37: fazekasgy@37: WHY PYTHON? fazekasgy@37: fazekasgy@37: Python is a general purpose high level scripting language. fazekasgy@37: It is interpreted, so you don't need to compile your plugins. fazekasgy@37: It has very high level libraries. e.g. you can stream audio from your VamPy plugin (it works for me...) fazekasgy@37: Supports functional programming. fazekasgy@37: fazekasgy@37: UPDATE IN THIS VERSION: fazekasgy@37: fazekasgy@37: * Two-way Numpy Support fazekasgy@37: * Embedded extension module exposing Vamp defined names fazekasgy@37: e.g. ParameterDescriptor. This allows easier porting to C++. fazekasgy@37: * Support RealTime time stamps fazekasgy@37: * Support byte compiled Python scripts (.pyc) fazekasgy@37: * Environment variables: VAMPY_COMPILED, VAMPY_EXTPATH fazekasgy@37: * Flags to control type conversion and error reporting for development fazekasgy@37: * Flexible type inference to take advantage of Python's loose typing fazekasgy@37: * Full error checking for all Python/C API calls fazekasgy@37: * Various optimisations and speed-ups fazekasgy@37: fazekasgy@37: PREVIOUS VAMPY README: fazekasgy@37: fazekasgy@37: HOW DOES IT WORK: fazekasgy@37: fazekasgy@37: (1) Make sure you have Python installed. fazekasgy@37: (2) Compile the C++ source or ask me for a binary (MacOS). fazekasgy@37: (3) Copy the library in your Vamp plugin directory like any other Vamp plugins: fazekasgy@37: eg. /Library/Audio/Plug-Ins/Vamp fazekasgy@37: (4) Write some python plugins and copy them to the same place. fazekasgy@37: (5) Each plugin must contain a single class with the same name as your script file. fazekasgy@37: e.g. PyZeroCrossing.py -> calss PyZeroCrossing fazekasgy@37: -Scripts with syntax errors in them are ignored. fazekasgy@37: -Scripts not having the same class as the filename are ignored. (Python is case sensitive!) fazekasgy@37: -Other unknown scripts are likely to cause a crash. (Don't put other python scripts in your Vamp directory.) fazekasgy@37: fazekasgy@37: fazekasgy@37: COMPILING AND LINKING: fazekasgy@37: fazekasgy@37: (1) make sure Python.h is included wherever it is on your machine fazekasgy@37: (2) the plugin needs to be linked against the Python binary: e.g.: ld -lpython2.5 fazekasgy@37: fazekasgy@37: example on on MacOSX: fazekasgy@37: g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5 -c -o PyPlugin.o PyPlugin.cpp fazekasgy@37: g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5 -c -o PyPlugScanner.o PyPlugScanner.cpp fazekasgy@37: g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5 -c -o pyvamp-main.o pyvamp-main.cpp fazekasgy@37: g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5 -c -o Mutex.o Mutex.cpp fazekasgy@37: g++ -shared PyPlugin.o PyPlugScanner.o pyvamp-main.o Mutex.o -o vampy.dylib -L../vamp-plugin-sdk/vamp-sdk -lvamp-sdk -dynamiclib -lpython2.5 -lpthread fazekasgy@37: fazekasgy@37: fazekasgy@37: (3) There is a Makefile that compiles this plugin by default. fazekasgy@37: fazekasgy@37: fazekasgy@37: LIMITATIONS: fazekasgy@37: fazekasgy@37: This is mainly a proof of concept. The implementation is not the most efficient, but using NumPy it's very reasonable. fazekasgy@37: Only tested on MacOSX and Linux (by Chris), but in theory should work on other platforms with small fixes. fazekasgy@37: fazekasgy@37: Error checking is not yet fully complete. fazekasgy@37: You better not make a mistake in your Python script, although in most cases you can see what the problem is fazekasgy@37: if you start the host (e.g. Sonic Visualiser) from a command line interface. fazekasgy@37: The wrapper plugin is quite verbose and outputs error messages. fazekasgy@37: fazekasgy@37: fazekasgy@37: TODO: * needs more complete error checking (almost done) fazekasgy@37: * needs correct implementation of Python threading (done) fazekasgy@37: * more efficient data conversion using the buffering interface or ctypes (done) fazekasgy@37: * Vamp 'programs' not implemented fazekasgy@37: * support multiple classes per script in scanner fazekasgy@37: * ensure proper cleanup, (host does a good job though) fazekasgy@37: fazekasgy@37: HISTORY: fazekasgy@37: added support for NumPy arrays in processN() fazekasgy@37: framecount is now passed also to legacy process() and fixed resulting bugs in the PyZeroCrossing plugin fazekasgy@37: added two examples which use Frequency Domain input in processN() fazekasgy@37: