Module pippi.mir

Functions

bandwidth

def bandwidth(
    snd,
    winsize
)

centroid

def centroid(
    snd,
    winsize
)

contrast

def contrast(
    snd,
    winsize
)

flatness

def flatness(
    snd,
    winsize
)

flatten

def flatten(
    snd
)

onsets

def onsets(
    snd,
    method,
    winsize,
    seconds
)

Returns a list of onset times in seconds detected using the given method. The default method is specflux. An optional seconds argument (normally true) may be set to false to return a list of frame indexes instead of seconds.

Example:

onsets = mir.onsets(snd, 'specflux')

Methods:

This routine is a wrapper for aubio's onset detection. Summaries of the detection methods were taken from: https://aubio.org/manpages/latest/aubioonset.1.html Part of that man page was copied and slightly modified for formatting per the terms of the GPL license which the original page was published under. Please see the above link for details.

hfc - High-Frequency content

This method computes the High Frequency Content (HFC) of the input spectral frame. The resulting function is efficient at detecting percussive onsets.

Paul Masri. Computer modeling of Sound for Transformation and Synthesis of Musical Signal. PhD dissertation, University of Bristol, UK, 1996.

complex - Complex domain onset detection function

This function uses information both in frequency and in phase to determine changes in the spectral content that might correspond to musical onsets. It is best suited for complex signals such as polyphonic recordings.

Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain onset detection for musical signals. In Proceedings of the Digital Audio Effects Conference, DAFx-03, pages 90-93, London, UK, 2003.

phase - Phase based onset detection function

This function uses information both in frequency and in phase to determine changes in the spectral content that might correspond to musical onsets. It is best suited for complex signals such as polyphonic recordings.

Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset detection for music signals. In Proceedings of the IEEE International Conference on Acoustics Speech and Signal Processing, pages 441­444, Hong-Kong, 2003.

specdiff - Spectral difference onset detection function

Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to rhythm analysis. In IEEE International Conference on Multimedia and Expo (ICME 2001), pages 881­884, Tokyo, Japan, August 2001.

kl - Kulback-Liebler onset detection function

Stephen Hainsworth and Malcom Macleod. Onset detection in music audio signals. In Proceedings of the International Computer Music Conference (ICMC), Singapore, 2003.

mkl - Modified Kulback-Liebler onset detection function

Paul Brossier, Automatic annotation of musical audio for interactive systems, Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital music, Queen Mary University of London, London, UK, 2006.

specflux - Spectral flux

Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th International Conference on Digital Audio Effects'' (DAFx-06), Montreal, Canada, 2006.

pitch

def pitch(
    snd,
    tolerance,
    method,
    winsize,
    backfill
)

Returns a wavetable of non-zero frequencies detected which exceed the confidence threshold given. Frequencies are held until the next detection to avoid zeros and outliers. Depending on the input, you may need to play with the tolerance value and the window size to tune the behavior. The default detection method is yinfast.

Example:

pitches = mir.pitch(snd, 0.8, 'yinfast')

Methods:

This routine is a wrapper for aubio's pitch detection. Summaries of the detection methods were taken from: https://aubio.org/manual/latest/cli.html#manpages Part of that man page was copied and slightly modified for formatting per the terms of the GPL license which the original page was published under. Please see the above link for details.

schmitt - Schmitt trigger

This pitch extraction method implements a Schmitt trigger to estimate the period of a signal. It is computationally very inexpensive, but also very sensitive to noise.

fcomb - a fast harmonic comb filter

This pitch extraction method implements a fast harmonic comb filter to determine the fundamental frequency of a harmonic sound.

mcomb - multiple-comb filter

This fundamental frequency estimation algorithm implements spectral flattening, multi-comb filtering and peak histogramming.

specacf - Spectral auto-correlation function

yin - YIN algorithm

This algorithm was developed by A. de Cheveigne and H. Kawahara and was first published in:

De Cheveigné, A., Kawahara, H. (2002) "YIN, a fundamental frequency estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930.

yinfft - Yinfft algorithm

This algorithm was derived from the YIN algorithm. In this implementation, a Fourier transform is used to compute a tapered square difference function, which allows spectral weighting. Because the difference function is tapered, the selection of the period is simplified.

Paul Brossier, Automatic annotation of musical audio for interactive systems, Chapter 3, Pitch Analysis, PhD thesis, Centre for Digital music, Queen Mary University of London, London, UK, 2006.

yinfast - YIN algorithm (accelerated)

An optimised implementation of the YIN algorithm, yielding results identical to the original YIN algorithm, while reducing its computational cost from O(n^2) to O(n log(n)).

rolloff

def rolloff(
    snd,
    winsize
)

segments

def segments(
    snd,
    method,
    winsize
)

A wrapper for mir.onsets which returns a list of SoundBuffers sliced at the onset times. See the documentation for mir.onsets for an overview of the detection methods available.