Mercurial > hg > vampy-host
changeset 123:89cc3595c404
Build updates
author | Chris Cannam |
---|---|
date | Wed, 24 Jun 2015 10:50:13 +0100 |
parents | 26f75b221828 |
children | bea7cf4126b5 |
files | .hgignore COPYING COPYING.rst MANIFEST.in README README.rst setup.py vamp/__init__.py |
diffstat | 8 files changed, 181 insertions(+), 137 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Tue Jun 23 10:48:52 2015 +0100 +++ b/.hgignore Wed Jun 24 10:50:13 2015 +0100 @@ -8,3 +8,6 @@ *.bak *.orig .tests +vamp.egg-info +build +dist
--- a/COPYING Tue Jun 23 10:48:52 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ - - Python Vamp Host - Copyright (c) 2008-2015 Queen Mary, University of London - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the names of the Centre for - Digital Music and Queen Mary, University of London shall not be - used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/COPYING.rst Wed Jun 24 10:50:13 2015 +0100 @@ -0,0 +1,28 @@ + + Python Vamp Host + Copyright (c) 2008-2015 Queen Mary, University of London + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music and Queen Mary, University of London shall not be + used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MANIFEST.in Wed Jun 24 10:50:13 2015 +0100 @@ -0,0 +1,3 @@ +include README.rst COPYING.rst +recursive-include native *.cpp *.h +recursive-include vamp-plugin-sdk *.cpp *.h
--- a/README Tue Jun 23 10:48:52 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ - -Python Vamp plugin host -======================= - -This module allows Python code to load and use Vamp plugins for audio -feature analysis. - -It consists of a native-code extension ("vampyhost") which provides a -low-level wrapper for the Vamp plugin SDK, along with a Python module -("vamp") that provides a higher-level abstraction. - -No code for loading audio files etc is included; you'll need to use -some other module for that. - - -High-level interface (vamp) ---------------------------- - -This module contains three sorts of function: - - * Lookup functions: list_plugins, get_outputs_of, get_category_of - - These retrieve the installed plugin identifiers and get basic - information about each plugin. For more detailed information, - load a plugin and inspect it (using the low-level interface). - - * Process functions: process_audio, process_frames, - process_audio_multiple_outputs, process_frames_multiple_outputs - - These accept audio input, and produce output in the form of a list - of feature sets structured similarly to those in the C++ Vamp - plugin SDK. The plugin to be used is specified by its identifier. - - The _audio versions take a single (presumably long) array of audio - samples as input, and chop it into frames according to the plugin's - preferred step and block sizes. The _frames versions instead accept - an enumerable sequence of audio frame arrays. - - * The process-and-collect function: collect - - This accepts a single array of audio samples as input, and returns - an output structure that reflects the underlying structure of the - feature output (depending on whether it is a curve, grid, etc). The - plugin to be used is specified by its identifier. - - It processes the whole input before returning anything; if you need - to supply a streamed input, or retrieve results as they are - calculated, then you must use one of the process functions (above) - or the low-level interface (below) instead. - - -Low-level interface (vampyhost) -------------------------------- - -This module contains functions that operate on Vamp plugins in a way -analogous to the existing C++ Vamp Host SDK: list_plugins, -get_plugin_path, get_category_of, get_library_for, get_outputs_of, -load_plugin, and a utility function frame_to_realtime. - -Calling load_plugin gets you a vampyhost.Plugin object, which then -exposes all of the methods found in the Vamp SDK Plugin class. - -(Note that methods wrapped directly from the Vamp SDK are named using -camelCase, so as to match the SDK. Elsewhere this module follows -Python PEP8 naming.) - - -See the individual module and function documentation for more details. - - -A simple example ----------------- - -Using librosa (http://bmcfee.github.io/librosa/) for audio file I/O, -and the NNLS Chroma Vamp plugin -(https://code.soundsoftware.ac.uk/projects/nnls-chroma/) - -$ python ->>> import vamp ->>> import librosa ->>> data, rate = librosa.load("example.wav") ->>> collected = vamp.collect(data, rate, "nnls-chroma:nnls-chroma") ->>> collected -{'matrix': ( 0.092879819, array([[ 61.0532608 , 60.27478409, 59.3938446 , ..., 182.13394165, - 42.40084457, 116.55457306], - [ 68.8901825 , 63.98115921, 60.77633667, ..., 245.88218689, - 68.51251984, 164.70120239], - [ 58.59794617, 50.3429184 , 45.44804764, ..., 258.02362061, - 83.95749664, 179.91200256], - ..., - [ 0. , 0. , 0. , ..., 0. , - 0. , 0. ], - [ 0. , 0. , 0. , ..., 0. , - 0. , 0. ], - [ 0. , 0. , 0. , ..., 0. , - 0. , 0. ]], dtype=float32))} ->>> stepsize, chromadata = collected["matrix"] ->>> import matplotlib.pyplot as plt ->>> plt.imshow(chromadata) -<matplotlib.image.AxesImage object at 0x7fe9e0043fd0> ->>> plt.show() - -And a pitch-chroma plot appears (though it's rotated 90 degrees -compared with its more usual orientation). -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.rst Wed Jun 24 10:50:13 2015 +0100 @@ -0,0 +1,112 @@ + +Python Vamp plugin host +======================= + +This module allows Python code to load and use Vamp plugins for audio +feature analysis. + +It consists of a native-code extension ("vampyhost") which provides a +low-level wrapper for the Vamp plugin SDK, along with a Python module +("vamp") that provides a higher-level abstraction. + +No code for loading audio files etc is included; you'll need to use +some other module for that. + +Written by Chris Cannam and George Fazekas at the Centre for Digital +Music, Queen Mary University of London. Copyright 2008-2015 Queen +Mary, University of London. Refer to COPYING.rst for licence details. + +See home page at https://code.soundsoftware.ac.uk/projects/vampy-host +for more details. + + +High-level interface (vamp) +--------------------------- + +This module contains three sorts of function: + + * Lookup functions: list_plugins, get_outputs_of, get_category_of + + These retrieve the installed plugin identifiers and get basic + information about each plugin. For more detailed information, + load a plugin and inspect it (using the low-level interface). + + * Process functions: process_audio, process_frames, + process_audio_multiple_outputs, process_frames_multiple_outputs + + These accept audio input, and produce output in the form of a list + of feature sets structured similarly to those in the C++ Vamp + plugin SDK. The plugin to be used is specified by its identifier. + + The _audio versions take a single (presumably long) array of audio + samples as input, and chop it into frames according to the plugin's + preferred step and block sizes. The _frames versions instead accept + an enumerable sequence of audio frame arrays. + + * The process-and-collect function: collect + + This accepts a single array of audio samples as input, and returns + an output structure that reflects the underlying structure of the + feature output (depending on whether it is a curve, grid, etc). The + plugin to be used is specified by its identifier. + + It processes the whole input before returning anything; if you need + to supply a streamed input, or retrieve results as they are + calculated, then you must use one of the process functions (above) + or the low-level interface (below) instead. + + +Low-level interface (vampyhost) +------------------------------- + +This module contains functions that operate on Vamp plugins in a way +analogous to the existing C++ Vamp Host SDK: list_plugins, +get_plugin_path, get_category_of, get_library_for, get_outputs_of, +load_plugin, and a utility function frame_to_realtime. + +Calling load_plugin gets you a vampyhost.Plugin object, which then +exposes all of the methods found in the Vamp SDK Plugin class. + +(Note that methods wrapped directly from the Vamp SDK are named using +camelCase, so as to match the SDK. Elsewhere this module follows +Python PEP8 naming.) + + +See the individual module and function documentation for more details. + + +A simple example +---------------- + +Using librosa (http://bmcfee.github.io/librosa/) for audio file I/O, +and the NNLS Chroma Vamp plugin +(https://code.soundsoftware.ac.uk/projects/nnls-chroma/):: + + $ python + >>> import vamp + >>> import librosa + >>> data, rate = librosa.load("example.wav") + >>> collected = vamp.collect(data, rate, "nnls-chroma:nnls-chroma") + >>> collected + {'matrix': ( 0.092879819, array([[ 61.0532608 , 60.27478409, 59.3938446 , ..., 182.13394165, + 42.40084457, 116.55457306], + [ 68.8901825 , 63.98115921, 60.77633667, ..., 245.88218689, + 68.51251984, 164.70120239], + [ 58.59794617, 50.3429184 , 45.44804764, ..., 258.02362061, + 83.95749664, 179.91200256], + ..., + [ 0. , 0. , 0. , ..., 0. , + 0. , 0. ], + [ 0. , 0. , 0. , ..., 0. , + 0. , 0. ], + [ 0. , 0. , 0. , ..., 0. , + 0. , 0. ]], dtype=float32))} + >>> stepsize, chromadata = collected["matrix"] + >>> import matplotlib.pyplot as plt + >>> plt.imshow(chromadata) + <matplotlib.image.AxesImage object at 0x7fe9e0043fd0> + >>> plt.show() + +And a pitch-chroma plot appears (though it's rotated 90 degrees +compared with its more usual orientation). +
--- a/setup.py Tue Jun 23 10:48:52 2015 +0100 +++ b/setup.py Wed Jun 24 10:50:13 2015 +0100 @@ -1,4 +1,5 @@ -from distutils.core import setup, Extension +import os +from setuptools import setup, find_packages, Extension import numpy as np sdkdir = 'vamp-plugin-sdk/src/vamp-hostsdk/' @@ -9,8 +10,16 @@ 'PluginSummarisingAdapter', 'PluginWrapper', 'RealTime' ] vpyfiles = [ 'PyPluginObject', 'PyRealTime', 'VectorConversion', 'vampyhost' ] -srcfiles = [ sdkdir + f + '.cpp' for f in sdkfiles ] + [ vpydir + f + '.cpp' for f in vpyfiles ] +srcfiles = [ + sdkdir + f + '.cpp' for f in sdkfiles +] + [ + vpydir + f + '.cpp' for f in vpyfiles +] +def read(*paths): + with open(os.path.join(*paths), 'r') as f: + return f.read() + vampyhost = Extension('vampyhost', sources = srcfiles, define_macros = [ ('_USE_MATH_DEFINES', 1) ], @@ -18,6 +27,26 @@ setup (name = 'vamp', version = '1.0', + url = 'https://code.soundsoftware.ac.uk/projects/vampy-host', description = 'This module allows Python code to load and use Vamp plugins for audio feature analysis.', + long_description = ( read('README.rst') + '\n\n' + read('COPYING.rst') ), + license = 'MIT', + packages = find_packages(exclude = [ '*test*' ]), + ext_modules = [ vampyhost ], requires = [ 'numpy' ], - ext_modules = [ vampyhost ]) + author = [ 'Chris Cannam' ], + author_email = [ 'cannam@all-day-breakfast.com' ], + classifiers = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Science/Research', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Operating System :: MacOS X', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: POSIX', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 3', + 'Topic :: Multimedia :: Sound/Audio :: Analysis' + ] + )
--- a/vamp/__init__.py Tue Jun 23 10:48:52 2015 +0100 +++ b/vamp/__init__.py Wed Jun 24 10:50:13 2015 +0100 @@ -27,7 +27,9 @@ # used in advertising or otherwise to promote the sale, use or other # dealings in this Software without prior written authorization. -'''A high-level interface to the vampyhost extension module, for quickly and easily running Vamp audio analysis plugins on audio files and buffers.''' +'''Load and use Vamp plugins for audio feature analysis. This module +is a high-level interface to the vampyhost extension, for quickly and +easily running Vamp analysis plugins on buffers of audio data.''' import vampyhost