view README @ 37:27bab3a16c9a vampy2final

new branch Vampy2final
author fazekasgy
date Mon, 05 Oct 2009 11:28:00 +0000
parents
children d2ff6e7be4a1
line wrap: on
line source

 * VamPy is an API wrapper for Vamp. It allows for writing Vamp 
	plugins in Python with or without Numpy support.

WHAT IS IT FOR?
	
	This wrapper is for writing Vamp plugins in Python which 
	can do the same as a native C++ plugin, plus a lot more if 
	you're using advanced Python modules.

	This may be an easier way to get into Vamp development.
	You can use it for prototyping your plugin before writing 
	it in C++.


WHY PYTHON?

	Python is a general purpose high level scripting language.
	It is interpreted, so you don't need to compile your plugins.
	It has very high level libraries. e.g. you can stream audio from your VamPy plugin (it works for me...)
	Supports functional programming. 

UPDATE IN THIS VERSION:

	* Two-way Numpy Support
	* Embedded extension module exposing Vamp defined names 
		e.g. ParameterDescriptor. This allows easier porting to C++.
	* Support RealTime time stamps
	* Support byte compiled Python scripts (.pyc)
	* Environment variables: VAMPY_COMPILED, VAMPY_EXTPATH
	* Flags to control type conversion and error reporting for development
	* Flexible type inference to take advantage of Python's loose typing
	* Full error checking for all Python/C API calls
	* Various optimisations and speed-ups

PREVIOUS VAMPY README:

HOW DOES IT WORK:

	(1) Make sure you have Python installed.
	(2) Compile the C++ source or ask me for a binary (MacOS).
	(3) Copy the library in your Vamp plugin directory like any other Vamp plugins: 
		eg. /Library/Audio/Plug-Ins/Vamp
	(4) Write some python plugins and copy them to the same place.
	(5) Each plugin must contain a single class with the same name as your script file.
		e.g. PyZeroCrossing.py -> calss PyZeroCrossing
		-Scripts with syntax errors in them are ignored.
		-Scripts not having the same class as the filename are ignored. (Python is case sensitive!)
		-Other unknown scripts are likely to cause a crash.  (Don't put other python scripts in your Vamp directory.)

	
COMPILING AND LINKING:

	(1) make sure Python.h is included wherever it is on your machine 
	(2) the plugin needs to be linked against the Python binary: e.g.: ld -lpython2.5

	example on on MacOSX:
	g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5   -c -o PyPlugin.o PyPlugin.cpp
	g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5   -c -o PyPlugScanner.o PyPlugScanner.cpp
	g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5   -c -o pyvamp-main.o pyvamp-main.cpp
	g++ -I../vamp-plugin-sdk -O2 -Wall -I/usr/include/python2.5   -c -o Mutex.o Mutex.cpp
	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

	
	(3) There is a Makefile that compiles this plugin by default.


LIMITATIONS:

	This is mainly a proof of concept. The implementation is not the most efficient, but using NumPy it's very reasonable.	
	Only tested on MacOSX and Linux (by Chris), but in theory should work on other platforms with small fixes.	

	Error checking is not yet fully complete.
	You better not make a mistake in your Python script, although in most cases you can see what the problem is 
	if you start the host (e.g. Sonic Visualiser) from a command line interface.
	The wrapper plugin is quite verbose and outputs error messages.


TODO:	* needs more complete error checking (almost done)
	* needs correct implementation of Python threading (done)
	* more efficient data conversion using the buffering interface or ctypes (done)
	* Vamp 'programs' not implemented
	* support multiple classes per script in scanner
	* ensure proper cleanup, (host does a good job though)

HISTORY:
	added support for NumPy arrays in processN()
	framecount is now passed also to legacy process() and fixed resulting bugs in the PyZeroCrossing plugin
	added two examples which use Frequency Domain input in processN()