fazekasgy@0: 
cannam@7:  * VamPy is a Vamp plugin wrapper for Python Scripts.
fazekasgy@0: 
fazekasgy@0: WHAT IS IT FOR?
fazekasgy@0: 	
fazekasgy@10: 	This wrapper is for writing Vamp plugins in Python which can do the same as a native C++ plugin,
fazekasgy@10: 	plus a lot more if you're using advanced Python modules.
fazekasgy@0: 
fazekasgy@10: 	This may be an easier way to get into Vamp development.
fazekasgy@10: 	You can use it for prototyping your plugin before writing it in C++	 
fazekasgy@0: 
fazekasgy@0: 
fazekasgy@10: WHY PYTHON?
fazekasgy@0: 
fazekasgy@10: 	Python is a general purpose high level scripting language.
fazekasgy@10: 	It is interpreted, so you don't need to compile your plugins.
fazekasgy@10: 	It has very high level libraries. e.g. you can stream audio from your VamPy plugin (it works for me...)
fazekasgy@10: 	Supports functional programming. 
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).
cannam@7: 	(3) Copy the library in your Vamp plugin directory like any other Vamp plugins: 
cannam@7: 		eg. /Library/Audio/Plug-Ins/Vamp
fazekasgy@10: 	(4) Write some 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@10: 		-Scripts not having the same class as the filename are ignored. (Python is case sensitive!)
fazekasgy@10: 		-Other unknown scripts are likely to cause a crash.  (Don't put other python scripts in your Vamp directory.)
fazekasgy@0: 
fazekasgy@0: 	
fazekasgy@0: COMPILING AND LINKING:
fazekasgy@1: 
fazekasgy@10: 	(1) make sure Python.h is included wherever it is on your machine 
fazekasgy@10: 	(2) the plugin needs to be linked against the Python binary: e.g.: ld -lpython2.5
fazekasgy@0: 
fazekasgy@0: 	example on on MacOSX:
fazekasgy@10: 	g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5   -c -o PyPlugin.o PyPlugin.cpp
fazekasgy@10: 	g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5   -c -o PyPlugScanner.o PyPlugScanner.cpp
fazekasgy@10: 	g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5   -c -o pyvamp-main.o pyvamp-main.cpp
fazekasgy@10: 	g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5   -c -o Mutex.o Mutex.cpp
fazekasgy@10: 	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@10: 
fazekasgy@0: 	
fazekasgy@10: 	(3) There is a Makefile that compiles this plugin by default.
fazekasgy@0: 
fazekasgy@0: 
fazekasgy@10: LIMITATIONS:
fazekasgy@0: 
fazekasgy@10: 	This is mainly a proof of concept. The implementation is not the most efficient, but using NumPy it's very reasonable.	
fazekasgy@10: 	Only tested on MacOSX and Linux (by Chris), but in theory should work on other platforms with small fixes.	
fazekasgy@0: 
fazekasgy@10: 	Error checking is not yet fully complete.
fazekasgy@10: 	You better not make a mistake in your Python script, although in most cases you can see what the problem is 
fazekasgy@10: 	if you start the host (e.g. Sonic Visualiser) from a command line interface.
fazekasgy@10: 	The wrapper plugin is quite verbose and outputs error messages.
fazekasgy@10: 
fazekasgy@10: 
fazekasgy@10: TODO:	* needs more complete error checking (almost done)
fazekasgy@10: 	* needs correct implementation of Python threading (done)
fazekasgy@10: 	* more efficient data conversion using the buffering interface or ctypes (done)
fazekasgy@10: 	* Vamp 'programs' not implemented
fazekasgy@10: 	* support multiple classes per script in scanner
fazekasgy@10: 	* ensure proper cleanup, (host does a good job though)
fazekasgy@10: 
fazekasgy@10: HISTORY:
fazekasgy@10: 	added support for NumPy arrays in processN()
fazekasgy@10: 	framecount is now passed also to legacy process() and fixed resulting bugs in the PyZeroCrossing plugin
fazekasgy@10: 	added two examples which use Frequency Domain input in processN()
fazekasgy@10: