annotate README @ 53:7e59caea821b

* Make a better job of preloading Python, especially when it's in a framework. Go for the Python file in the frameworks directory in preference to any libpythonX.Y.dylib. Particularly, don't try to preload any library without an absolute path until we've exhausted all our framework possibilities (so as to avoid picking up an ancient system library).
author cannam
date Fri, 09 Oct 2009 13:48:25 +0000
parents c1e4f706ca9a
children 87b9ea6fc7d0
rev   line source
fazekasgy@37 1
fazekasgy@37 2 * VamPy is an API wrapper for Vamp. It allows for writing Vamp
fazekasgy@37 3 plugins in Python with or without Numpy support.
fazekasgy@37 4
fazekasgy@38 5
fazekasgy@37 6 WHAT IS IT FOR?
fazekasgy@37 7
fazekasgy@37 8 This wrapper is for writing Vamp plugins in Python which
fazekasgy@37 9 can do the same as a native C++ plugin, plus a lot more if
fazekasgy@38 10 you're using advanced Python modules such as Numpy and Scipy.
fazekasgy@37 11
fazekasgy@37 12 This may be an easier way to get into Vamp development.
fazekasgy@37 13 You can use it for prototyping your plugin before writing
fazekasgy@37 14 it in C++.
fazekasgy@38 15
fazekasgy@37 16
fazekasgy@37 17 WHY PYTHON?
fazekasgy@37 18
fazekasgy@37 19 Python is a general purpose high level scripting language.
fazekasgy@37 20 It is interpreted, so you don't need to compile your plugins.
fazekasgy@38 21 It has very high level libraries. e.g. you can stream audio
fazekasgy@38 22 from a Vampy plugin if you want to.
fazekasgy@37 23 Supports functional programming.
fazekasgy@37 24
fazekasgy@38 25
fazekasgy@38 26 UPDATES IN THIS VERSION (Vampy 2.0):
fazekasgy@37 27
fazekasgy@37 28 * Two-way Numpy Support
fazekasgy@37 29 * Embedded extension module exposing Vamp defined names
fazekasgy@37 30 e.g. ParameterDescriptor. This allows easier porting to C++.
fazekasgy@37 31 * Support RealTime time stamps
fazekasgy@37 32 * Support byte compiled Python scripts (.pyc)
fazekasgy@37 33 * Environment variables: VAMPY_COMPILED, VAMPY_EXTPATH
fazekasgy@37 34 * Flags to control type conversion and error reporting for development
fazekasgy@37 35 * Flexible type inference to take advantage of Python's loose typing
fazekasgy@37 36 * Full error checking for all Python/C API calls
fazekasgy@37 37 * Various optimisations and speed-ups
fazekasgy@38 38
fazekasgy@38 39 Vampy now supports two main use cases:
fazekasgy@38 40 1) Prototyping C++ Vamp plugins in Python.
fazekasgy@38 41 2) Develop Vampy plugins in Python to allow the use of a vamp
fazekasgy@38 42 hosts for e.g. batch processing or visualisation.
fazekasgy@38 43
fazekasgy@38 44 Vampy provides an extension module which allows the use of
fazekasgy@38 45 Vamp data types such as FeatureSet() or RealTime() in Vampy plugins.
fazekasgy@37 46
fazekasgy@37 47
fazekasgy@37 48 HOW DOES IT WORK:
fazekasgy@37 49
fazekasgy@38 50 (1) Make sure you have Python (and Numpy) installed.
fazekasgy@39 51 (2) Download Vampy and install it to your Vamp plugin path.
fazekasgy@37 52 eg. /Library/Audio/Plug-Ins/Vamp
fazekasgy@38 53 (3) Write some python plugins and copy them to the same place.
fazekasgy@38 54 (4) Each plugin must contain a single class with the same name as your script file.
fazekasgy@37 55 e.g. PyZeroCrossing.py -> calss PyZeroCrossing
fazekasgy@37 56 -Scripts with syntax errors in them are ignored.
fazekasgy@37 57 -Scripts not having the same class as the filename are ignored. (Python is case sensitive!)
fazekasgy@38 58 -Other unknown scripts may cause a crash.
fazekasgy@38 59 (Don't put other python scripts in your Vamp directory.)
cannam@48 60 Some example plugin scripts are provided in "Example VamPy plugins".
fazekasgy@38 61
fazekasgy@38 62 FLAGS :
fazekasgy@38 63
fazekasgy@38 64 You can use some flags to control Vampy. They are:
fazekasgy@38 65
fazekasgy@38 66 vf_NULL : zero value, default for vampy version 1 behaviour
fazekasgy@38 67 vf_DEBUG : print debug messages to standard error
fazekasgy@38 68 vf_STRICT : more strict type conversion (follows the C++ API more closely)
fazekasgy@38 69 vf_QUIT : quit the host process on hard errors
fazekasgy@38 70 vf_REALTIME : use RealTime time stamps
fazekasgy@38 71 vf_BUFFER : use the Numpy buffer interface to
fazekasgy@38 72 pass time/frequency domain samples to the python process
fazekasgy@38 73
fazekasgy@38 74 vf_ARRAY : use the numpy Array interface directly
fazekasgy@38 75
fazekasgy@38 76 vf_DEFAULT_V2 : default Vampy version 2 behaviour
fazekasgy@38 77 (= vf_ARRAY | vf_REALTIME)
fazekasgy@38 78
fazekasgy@38 79 The use of these flags is optional. The default behaviour is
fazekasgy@38 80 that of Vampy version 1.
fazekasgy@38 81
fazekasgy@38 82 To set the flags, place a variable called 'vampy_flags' in
fazekasgy@38 83 your plugin class's __init__() function.
fazekasgy@38 84
fazekasgy@38 85 Example:
fazekasgy@38 86
fazekasgy@38 87 class PyMFCC(melScaling):
fazekasgy@38 88 def __init__(self,inputSampleRate):
fazekasgy@38 89 self.vampy_flags = vf_DEBUG | vf_ARRAY | vf_REALTIME
fazekasgy@38 90
fazekasgy@38 91
fazekasgy@38 92 ENVIRONMENT VARIABLES:
fazekasgy@38 93
fazekasgy@38 94 Vampy recognises two optional environment variables:
fazekasgy@38 95
fazekasgy@38 96 VAMPY_COMPILED=1 recognise byte compiled python plugins (default)
fazekasgy@38 97 VAMPY_COMPILED=0 ignore them
fazekasgy@38 98 VAMPY_EXTPATH: if given, searches this path for vampy plugins.
fazekasgy@38 99 (This is useful if you want to keep your python plugins separate.)
fazekasgy@38 100 Only a single fully qualified path name is recognised.
fazekasgy@38 101
fazekasgy@38 102 Example:
fazekasgy@38 103 export VAMPY_EXTPATH="/Users/Shared/Development/vampy-path"
fazekasgy@37 104
fazekasgy@37 105
fazekasgy@37 106 COMPILING AND LINKING:
fazekasgy@38 107
fazekasgy@38 108 Please use the make files provided.
fazekasgy@38 109 Make sure the correct include locations are provided for
fazekasgy@38 110 Python, Numpy, and the Vamp plugin SDK.
fazekasgy@37 111
fazekasgy@37 112
fazekasgy@38 113 COMPILER OPTIONS:
fazekasgy@37 114
fazekasgy@38 115 HAVE_NUMPY : compile with Numpy array interface support
fazekasgy@37 116
fazekasgy@38 117 for developers:
fazekasgy@38 118 _DEBUG : print very detailed messages and logs while Vampy is in use
fazekasgy@38 119 _DEBUG_VALUES : print all converted values to stderr
fazekasgy@37 120
fazekasgy@37 121
fazekasgy@38 122 TODO:
fazekasgy@37 123 * Vamp 'programs' not implemented
fazekasgy@37 124 * support multiple classes per script in scanner
fazekasgy@37 125
cannam@50 126
fazekasgy@37 127 HISTORY:
fazekasgy@37 128
fazekasgy@38 129 v1:
fazekasgy@51 130 * added support for Numpy arrays in processN()
fazekasgy@38 131 * framecount is now passed also to legacy process() and fixed resulting bugs in the PyZeroCrossing plugin
fazekasgy@38 132 * added two examples which use Frequency Domain input in processN()
fazekasgy@38 133
fazekasgy@38 134 v2.0:
fazekasgy@38 135 * complete rewrite (using generic functions implementing full error checking)
fazekasgy@38 136 * added extension module : support RealTime and other Vamp type wrappers
fazekasgy@51 137 * added Numpy Array interface
fazekasgy@51 138 * added flags
fazekasgy@38 139 * added environment variables
fazekasgy@38 140 * recognise byte compiled python scripts
fazekasgy@38 141
cannam@50 142 LICENCE:
cannam@50 143
cannam@50 144 VamPy is distributed under a "new-style BSD" license; see the
cannam@50 145 file COPYING for details. You may modify and redistribute it
cannam@50 146 within any commercial or non-commercial, proprietary or
cannam@50 147 open-source context. VamPy imposes no limitation on how you
cannam@50 148 may choose to license your own plugin scripts. Note that
cannam@50 149 these happen to be the same terms as the Vamp SDK itself.
cannam@50 150
cannam@50 151 VamPy was written by Gyorgy Fazekas at the Centre for Digital
cannam@50 152 Music, Queen Mary University of London.
cannam@50 153 Copyright 2008-2009 Gyorgy Fazekas.
fazekasgy@38 154
fazekasgy@38 155