madmom.features.beats_crf

This module contains the speed crucial Viterbi functionality for the CRFBeatDetector plus some functions computing the distributions and normalisation factors.

References

[R26]Filip Korzeniowski, Sebastian Böck and Gerhard Widmer, “Probabilistic Extraction of Beat Positions from a Beat Activation Function”, Proceedings of the 15th International Society for Music Information Retrieval Conference (ISMIR), 2014.
madmom.features.beats_crf.best_sequence(activations, interval, interval_sigma)

Extract the best beat sequence for a piece with the Viterbi algorithm.

Parameters:

activations : numpy array

Beat activation function of the piece.

interval : int

Beat interval of the piece.

interval_sigma : float

Allowed deviation from the interval per beat.

Returns:

beat_pos : numpy array

Extracted beat positions [frame indices].

log_prob : float

Log probability of the beat sequence.

madmom.features.beats_crf.initial_distribution(num_states, interval)

Compute the initial distribution.

Parameters:

num_states : int

Number of states in the model.

interval : int

Beat interval of the piece [frames].

Returns:

numpy array

Initial distribution of the model.

madmom.features.beats_crf.normalisation_factors(activations, transition_distribution)

Compute normalisation factors for model.

Parameters:

activations : numpy array

Beat activation function of the piece.

transition_distribution : numpy array

Transition distribution of the model.

Returns:

numpy array

Normalisation factors for model.

madmom.features.beats_crf.transition_distribution(interval, interval_sigma)

Compute the transition distribution between beats.

Parameters:

interval : int

Interval of the piece [frames].

interval_sigma : float

Allowed deviation from the interval per beat.

Returns:

numpy array

Transition distribution between beats.

madmom.features.beats_crf.viterbi(__Pyx_memviewslice pi, __Pyx_memviewslice transition, __Pyx_memviewslice norm_factor, __Pyx_memviewslice activations, int tau)

Viterbi algorithm to compute the most likely beat sequence from the given activations and the dominant interval.

Parameters:

pi : numpy array

Initial distribution.

transition : numpy array

Transition distribution.

norm_factor : numpy array

Normalisation factors.

activations : numpy array

Beat activations.

tau : int

Dominant interval [frames].

Returns:

beat_pos : numpy array

Extracted beat positions [frame indices].

log_prob : float

Log probability of the beat sequence.