Skip to content

aud.tempo

Olivier Lartillot edited this page Jan 15, 2019 · 4 revisions

Detects periodicities from the event detection curve.

Tempo estimation is carried out in several steps:

Event detection curve

From audio input

The event detection curve computed in mirevents can be controlled using the following options:

  • ‘Envelope’ (default) and ‘DiffEnvelope’:
    • with the ‘Method’ set by default to ‘Filter’:
      • with ‘FilterType’ option with same default,
      • with ‘Filterbank’ option set to 10 by default,
      • with ‘FilterbankType’ option with same default,
    • ‘Method’ can be set to ‘Spectro’ as well, and the 'Freq','Mel','Bark','Cents' selection can be specified, with same default.
    • Besides ‘Method’: ‘HalfwaveCenter’, ‘HalfwaveDiff’, ‘Lambda’, ‘Center’, ‘Smooth’, ‘Sampling’, ‘Log’ and ‘Mu’, all with same default and ‘Diff’ set to ‘On’ by default.
  • ‘SpectralFlux’: with ‘Complex’, ‘Inc’, ‘Median’ and ‘Halfwave’ with same default.
  • ‘Pitch’ and ‘Novelty’.

Other options related to mirevents can be specified:

  • ‘Filterbank’, with same default value than for mirevents,
  • (..., 'Sum’, w) specifies when to sum the channels. Possible values:
    • w = 'Before’: sum before the autocorrelation or spectrum computation (default).
    • w = 'After’: autocorrelation or spectrum computed for each band, and summed into a "summary".
    • w = 0: tempo estimated for each band separately, with no channel recombination.

From symbolic input

Option 'Gauss' from audio.events can be controlled here as well. Default: 0 (Gaussian of standard deviation 0, i.e., a Dirac)

Frame decomposition

  • aud.tempo(..., ‘Frame’, ...) optionally performs a frame decomposition of the detection curve, with by default a frame length of 3 s and a hop factor of 10% (0.3 s). For the specification of other frame configuration using additional parameters, cf. this page.

Periodicity detection

Periodicities are detected on the detection curve based on several possible strategies:

  • aud.tempo(..., ‘Autocor’) computes an autocorrelation function of the detection curve, using sig.autocor (default choice). Options related to sig.autocor can be specified:
    • 'Enhanced’ (toggled on by default here),
    • ‘NormalWindow’ (same default value).
  • aud.tempo(..., ‘Spectrum’) computes a spectral decomposition of the detection curve, using aud.spectrum. Options related to aud.spectrum can be passed here as well:
    • 'ZeroPad’ (set by default here to 10 000 samples),
    • 'Prod’ (same default, when toggled on, as for aud.spectrum),
  • aud.tempo(..., ‘Autocor’, ‘Spectrum’) combines both strategies: the autocorrelation function is translated into the frequency domain in order to be compared to the spectrum curve, and the two curves are subsequently multiplied.

A peak picking is applied to the autocorrelation function or to the spectrum representation. The parameters of the peak picking can be tuned:

  • aud.tempo(..., ‘Total’, m) selects not only the best tempo, but the m best tempos.
  • aud.tempo(..., ‘Min’, mi) indicates the lowest tempo taken into consideration, expressed in bpm. Default value: 40 bpm.
  • aud.tempo(..., ‘Max’, ma) indicates the highest tempo taken into consideration, expressed in bpm. Default value: 200 bpm.
  • aud.tempo(..., ‘Contrast’, c) specifies the contrast factor for the peak picking. Default value: c = 0.1
  • aud.tempo(..., ‘Nearest’, n) chooses the peak closest to n (in s.). Default value when option toggled on: n = 0.5 s.

Flowchart Interconnections

aud.tempo accepts as input data type either:

  • sig.Autocor objects,
  • sig.Spectrum objects,
  • event detection curve (resulting from aud.events), frame-decomposed or not, channel-decomposed or not, and all the input data accepted by aud.events.

aud.tempo can return several outputs:

  • the tempo itself (or set of tempi) and
  • the sig.Spectrum or sig.Autocor data, where is highlighted the (set of) peak(s) corresponding to the estimated tempo (or set of tempi).

Specialization to music

Cf. mus.tempo

Clone this wiki locally