Vamp Plugins

Vamp Example Plugins

The “vamp-example-plugins” library contains a number of Vamp audio analysis plugins provided as part of the Vamp plugin SDK.

These are simple, but sometimes useful, plugins whose source code you are free to study and reuse in any proprietary or non-proprietary plugins of your own without any licensing obligation.

User documentation for the individual plugins in this library follows.

1.  Amplitude Follower
2.  Simple Fixed Tempo Estimator
3.  Simple Percussion Onset Detector
4.  Simple Power Spectrum
5.  Spectral Centroid
6.  Zero Crossings

1.  Amplitude Follower

System identifiervamp-example-plugins:amplitudefollower
RDF URIhttp://vamp-plugins.org/rdf/plugins/vamp-example-plugins#amplitudefollower
LinksBack to top of library documentationDownload locationSource code

Amplitude Follower tracks and returns the amplitude of the audio signal sample by sample, returning peak values block by block.

1.1.  Parameters

Attack time (seconds) – The 60dB convergence time for an increase in amplitude.
Release time (seconds) – The 60dB convergence time for a decrease in amplitude.

For example, if you feed the plugin with a simple step function that jumps from level A to level B, then the output will start off as A, then at the moment of stepping it will start to converge exponentially to B, reaching with 60dB of the actual value within the time specified by the Attack time parameter.

Similarly, if the plugin's input then steps down from B to A, the output will start converging at the moment of stepping, reaching within 60dB of the new value within the time specified by the Release time parameter.

1.2.  Outputs

1.2.1.  Amplitude

The peak tracked amplitude (in volts) for the current processing block.

1.3.  References and Credits

Amplitude Follower uses a method from the SuperCollider audio processing language. It was implemented as a Vamp plugin by Dan Stowell.

2.  Simple Fixed Tempo Estimator

System identifiervamp-example-plugins:fixedtempo
RDF URIhttp://vamp-plugins.org/rdf/plugins/vamp-example-plugins#fixedtempo
LinksBack to top of library documentationDownload locationSource code

Simple Fixed Tempo Estimator analyses a fragment of audio and estimates its tempo. It assumes that its input is of fixed tempo, and it analyses only the first (small but configurable number of) seconds before returning a result, discarding all subsequent input.

The plugin calculates an overall energy rise function across a series of short frequency-domain input frames, takes the autocorrelation of this function, filters it to stress possible metrical patterns, locates peaks, and converts from autocorrelation lag to the corresponding tempo.

The filtering process involves searching for peaks at simple metrically related intervals (at a given autocorrelation lag as well as at 0.5, 2, and 4 times that lag), boosting each peak that shows strong related peaks. A simplistic perceptual curve is also applied in order to increase the probability of detecting a "likely" tempo. For improved tempo precision, each tempo with strong related peaks is averaged with the tempi calculated from those peaks.

The method is best suited for 4/4 pop and dance rhythms.

This plugin returns many of its intermediate calculations as additional outputs, as well as the most favoured tempo. Although as a tempo estimator it's still fairly primitive, it is intended to provide a useful example of a slightly more complex feature extraction plugin than the other examples, as well as one that returns several different types of output at a time.

2.1.  Parameters

Minimum estimated tempo, Maximum estimated tempo (bpm) – These parameters control the range of values within which the tempo estimator will return its estimate.

Input duration to study (seconds) – The tempo estimator uses only the first part of its input, discarding any that follows. This parameter controls how much input it will use. There is no value in increasing this beyond 8x the duration of the slowest returned beat. The default of 10 seconds is likely to be appropriate for most purposes.

2.2.  Outputs

2.2.1.  Tempo

The tempo estimator's best guess at the tempo of its input, in beats per minute.

This is returned as a feature whose timestamp and duration cover the range of the input which was used in estimating the tempo, with a single value containing the tempo.

2.2.2.  Tempo candidates

Several guesses at the possible tempo. This output is returned as a single feature whose timestamp and duration cover the range of the input which was used in estimating the tempo, with up to 10 bins containing one tempo value in each bin, with the "best guess" tempo in bin 0.

2.2.3.  Detection function

The basic onset detection function used in tempo estimation.

2.2.4.  Autocorrelation function

The autocorrelation of the onset detection function.

2.2.5.  Filtered Autocorrelation

The autocorrelation after filtering to boost values with possible metrically related peaks and to apply perceptual weighting. The peak value of this function is the one that will be used as the "best guess".

2.3.  References and Credits

Simple Fixed Tempo Estimator uses a method derived from work by Matthew Davies: see for example M. E. P. Davies and M. D. Plumbley, Beat Tracking With A Two State Model, in Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing 2005. This plugin, made by Chris Cannam, is only an unsubtle simplification of a small part of the published method.

The Queen Mary plugin set (http://www.elec.qmul.ac.uk/digitalmusic/downloads/index.html#qm-vamp-plugins) contains a Tempo and Beat Tracker plugin by Matthew Davies providing a more realistic implementation.

3.  Simple Percussion Onset Detector

System identifiervamp-example-plugins:percussiononsets
RDF URIhttp://vamp-plugins.org/rdf/plugins/vamp-example-plugins#percussiononsets
LinksBack to top of library documentationDownload locationSource code

Simple Percussion Onset Detector estimates the locations of percussive onsets in the audio signal.

The principle is to exploit the broadband nature of noisy percussive onsets by identifying only those frames in which the energy rise shows a broadband profile.

The plugin takes a series of frequency domain frames, and examines each frame to count the number of bins whose energy content has increased by more than a certain threshold since the prior frame. Frames in which this number is at a peak relative to prior and following frames and also exceeds another threshold value are classified as percussive onsets.

3.1.  Parameters

Energy rise threshold (dB) – The rise in energy within a bin from one frame to the next that is required for a bin to be counted toward the detection function's bin count. This roughly corresponds to how "loud" a percussive sound must be in order to be detected.

Sensitivity (%) – The proportion of bins that must exceed the energy rise threshold in order for an onset to be detected (at frames in which the detection function peaks). This roughly corresponds to how "noisy" a percussive sound must be in order to be detected.

3.2.  Outputs

3.2.1.  Onsets

The estimated onset locations.

3.2.2.  Detection Function

The energy rise detection function whose peaks were used to estimate onset locations.

3.3.  References and Credits

The method used in Simple Percussion Onset Detector was described in Dan Barry, Derry Fitzgerald, Eugene Coyle and Bob Lawlor, Drum Source Separation using Percussive Feature Detection and Spectral Modulation, ISSC 2005. The plugin was made by Chris Cannam.

4.  Simple Power Spectrum

System identifiervamp-example-plugins:powerspectrum
RDF URIhttp://vamp-plugins.org/rdf/plugins/vamp-example-plugins#powerspectrum
LinksBack to top of library documentationDownload locationSource code

Simple Power Spectrum returns a power spectrum calculated from windowed short-time Fourier transforms of the input audio. (The power spectrum for a frame consists of a sequence of the squares of the magnitudes of the complex values for each frequency bin in the result of the Fourier transform.)

This very simple plugin is an illustration of the fact that if a plugin requests frequency-domain input, its input will already be in the form needed for a spectrum such as this. The plugin has no work left to do except to calculate the squared magnitude from the cartesian complex representation.

This plugin also illustrates how to return "grid-type" visualisation data from a Vamp plugin.

4.1.  Parameters

None.

4.2.  Outputs

4.2.1.  Power Spectrum

The power spectrum calculated from the input frame. This output returns a single feature per processing block, containing blocksize/2+1 power values corresponding to the FFT bins from DC to Nyquist inclusive. The DC bin is always returned.

5.  Spectral Centroid

System identifiervamp-example-plugins:spectralcentroid
RDF URIhttp://vamp-plugins.org/rdf/plugins/vamp-example-plugins#spectralcentroid
LinksBack to top of library documentationDownload locationSource code

Spectral Centroid calculates the "centre of gravity" of the frequency spectrum for each input frame.

5.1.  Parameters

None.

5.2.  Outputs

5.2.1.  Log Frequency Centroid

The centroid of the log-weighted frequency spectrum. That is, the sum across Fourier transform output bins of the logarithm of the bin frequency multiplied by the bin magnitude, divided by the sum of the bin magnitudes, and the inverse logarithm taken so as to give the result as a frequency in Hz.

5.2.2.  Linear Frequency Centroid

The centroid of the linear-weighted frequency spectrum. That is, the sum across Fourier transform output bins of the bin frequency multiplied by the bin magnitude, divided by the sum of the bin magnitudes. The result is a frequency in Hz.

6.  Zero Crossings

System identifiervamp-example-plugins:zerocrossing
RDF URIhttp://vamp-plugins.org/rdf/plugins/vamp-example-plugins#zerocrossing
LinksBack to top of library documentationDownload locationSource code

Zero Crossings calculates the positions and density of "zero-crossing" points in an audio waveform. For the purposes of this plugin, that means those positions at which the sampled value switches from zero-or-less to greater-than-zero, or vice versa.

6.1.  Parameters

None.

6.2.  Outputs

6.2.1.  Zero Crossing Counts

The number of zero-crossing points found in the current block of samples, as a single-valued feature returned per processing block.

6.2.2.  Zero Crossings

The locations of zero-crossing points, returning one feature timestamped to the zero-crossing location, without values, for each crossing point.