Use Vamp plugins for audio feature analysis.
Project description
This module allows Python code to load and use native-code Vamp plugins (http://vamp-plugins.org) for audio feature analysis.
The module consists of a native-code extension (“vampyhost”) that provides a low-level wrapper for the Vamp plugin SDK, along with a Python wrapper (“vamp”) that provides a higher-level abstraction.
No code for loading audio files is included; you’ll need to use some other module for that. This code expects to receive decoded audio data of one or more channels, either as a series of frames or as a single whole buffer.
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.
A simple example
Using librosa (http://bmcfee.github.io/librosa/) to read an audio file, and the NNLS Chroma Vamp plugin (https://code.soundsoftware.ac.uk/projects/nnls-chroma/) for analysis:
>>> import vamp >>> import librosa >>> data, rate = librosa.load("example.wav") >>> chroma = vamp.collect(data, rate, "nnls-chroma:nnls-chroma") >>> chroma {'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 = chroma["matrix"] >>> import matplotlib.pyplot as plt >>> plt.imshow(chromadata) <matplotlib.image.AxesImage object at 0x7fe9e0043fd0> >>> plt.show()
And a pitch-chroma plot appears.
High-level interface (vamp)
This module contains three sorts of function:
1. Basic info and lookup functions
vamp.list_plugins
vamp.get_outputs_of
vamp.get_category_of
These retrieve the installed plugin keys and get basic information about each plugin. (For more detailed information, load a plugin and inspect it using the low-level interface described below.)
2. Process functions
vamp.process_audio
vamp.process_frames
vamp.process_audio_multiple_outputs
vamp.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 key (the identifier as returned by vamp.list_plugins). A dictionary of plugin parameter settings may optionally be supplied.
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.
3. The process-and-collect function
vamp.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 key. A dictionary of plugin parameter settings may optionally be supplied.
The collect function 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 else the low-level interface (below).
Low-level interface (vampyhost)
This extension contains facilities 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 names found in the C++ SDK. Elsewhere this module follows Python PEP8 naming.)
See the individual module and function documentation for further details.
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for vamphost-1.2.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 395f9061d20a094ee140d62c26f33ef56af1a6211fbc093e7a5373e12017dba8 |
|
MD5 | b3a4cf6c8e7cf8869de368344ae5c05e |
|
BLAKE2b-256 | 0a0a46ae8bbad7378e750cad8b78c472e1dd10a700498a883afaeb9db0ed2587 |
Hashes for vamphost-1.2.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c4bf9e0607b75ae8fe38a239e4ead187d3d3ca7adfc58ad44a35bd0ffc28897 |
|
MD5 | b739fc1d8e1793c04f6cbe45b1edc59e |
|
BLAKE2b-256 | 7b9a38c9f97bc0418f57889c19eaf8002091beddb2395d44b01327930d89aa33 |
Hashes for vamphost-1.2.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b431098ac4c171f4e8a06206412dab55903aa2b4f55427bedec8faa7bd3857e3 |
|
MD5 | 7cc95b5e52d7637a9cd810e3b9537f38 |
|
BLAKE2b-256 | cacf952dab310306570d51781e680872969afaf98aa8d7886893bfcfbebab719 |
Hashes for vamphost-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8c5d83479d9e6d6ece81d767d0376a4862572aeb0380986f3245a5ba827a437 |
|
MD5 | b21fce85aad5414aa52711d60e7b8ec1 |
|
BLAKE2b-256 | 93043a6c891feecb2286ee603d384fe6458046464356e021e9e9c4798f0ec6db |
Hashes for vamphost-1.2.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd5c862e90617f36d8ea028bd4cb0b3bfa16c65121f7944dc3bb82dfb57eec25 |
|
MD5 | c7429e545f22f533fedfb2ddf5207f10 |
|
BLAKE2b-256 | 687282aa045b9e45a14dae470f0e5d4ef00f768463d4a34a061189ab0da2099e |
Hashes for vamphost-1.2.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5316c2eea04de103a7b4df161617bef456a4022a6be71bb56bbbbc920c60eea2 |
|
MD5 | b80f967e195e96de3604674ac034aa3c |
|
BLAKE2b-256 | e07a44abd6ee0fc0139a95cc077b2a419adf26eb6e7855d99dabf86a335d54b9 |
Hashes for vamphost-1.2.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83fe23168dc5505df1e2c9fb35eb7e3590eefb5ecc9253f57f042f6e00343e76 |
|
MD5 | 207457ea0650a332c8a361bedda8f16e |
|
BLAKE2b-256 | 81a94a0aef1ea8bde944bc3c2843e9c94217e75a6b3d76ecd20910fe8048fb3e |
Hashes for vamphost-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cae7b119cda0930853bd69b2080a473be6092dae5c4e187130dd9fb63c2319c |
|
MD5 | d7d809b0a4d04440549aa9073733c253 |
|
BLAKE2b-256 | af961ea4930e2ea5db1b1ea9a6d7e20ecf0c29447d73c04fae68c73810428ab0 |