madmom.features.beats_hmm

This module contains HMM state spaces, transition and observation models used for beat and downbeat tracking.

Notes

Please note that (almost) everything within this module is discretised to integer values because of performance reasons.

class madmom.features.beats_hmm.BeatStateSpace(min_interval, max_interval, num_intervals=None)[source]

State space for beat tracking with a HMM.

Parameters:

min_interval : float

Minimum interval to model.

max_interval : float

Maximum interval to model.

num_intervals : int, optional

Number of intervals to model; if set, limit the number of intervals and use a log spacing instead of the default linear spacing.

References

[R27]Florian Krebs, Sebastian Böck and Gerhard Widmer, “An Efficient State Space Model for Joint Tempo and Meter Tracking”, Proceedings of the 16th International Society for Music Information Retrieval Conference (ISMIR), 2015.

Attributes

num_states (int) Number of states.
intervals (numpy array) Modeled intervals.
num_intervals (int) Number of intervals.
state_positions (numpy array) Positions of the states.
state_intervals (numpy array) Intervals of the states.
first_states (numpy array) First states for each interval.
last_states (numpy array) Last states for each interval.
class madmom.features.beats_hmm.BarStateSpace(num_beats, min_interval, max_interval, num_intervals=None)[source]

State space for bar tracking with a HMM.

Parameters:

num_beats : int

Number of beats per bar.

min_interval : float

Minimum beat interval to model.

max_interval : float

Maximum beat interval to model.

num_intervals : int, optional

Number of beat intervals to model; if set, limit the number of intervals and use a log spacing instead of the default linear spacing.

References

[R28]Florian Krebs, Sebastian Böck and Gerhard Widmer, “An Efficient State Space Model for Joint Tempo and Meter Tracking”, Proceedings of the 16th International Society for Music Information Retrieval Conference (ISMIR), 2015.

Attributes

num_beats (int) Number of beats.
num_states (int) Number of states.
num_intervals (int) Number of intervals.
state_positions (numpy array) Positions of the states.
state_intervals (numpy array) Intervals of the states.
first_states (list) First interval states for each beat.
last_states (list) Last interval states for each beat.
class madmom.features.beats_hmm.MultiPatternStateSpace(state_spaces)[source]

State space for rhythmic pattern tracking with a HMM.

Parameters:

state_spaces : list

List with state spaces to model.

References

[R29]Florian Krebs, Sebastian Böck and Gerhard Widmer, “An Efficient State Space Model for Joint Tempo and Meter Tracking”, Proceedings of the 16th International Society for Music Information Retrieval Conference (ISMIR), 2015.
madmom.features.beats_hmm.exponential_transition(from_intervals, to_intervals, transition_lambda, threshold=2.2204460492503131e-16, norm=True)[source]

Exponential tempo transition.

Parameters:

from_intervals : numpy array

Intervals where the transitions originate from.

to_intervals

Intervals where the transitions destinate to.

transition_lambda : float

Lambda for the exponential tempo change distribution (higher values prefer a constant tempo from one beat/bar to the next one). If None, allow only transitions from/to the same interval.

threshold : float, optional

Set transition probabilities below this threshold to zero.

norm : bool, optional

Normalize the emission probabilities to sum 1.

Returns:

probabilities : numpy array, shape (num_from_intervals, num_to_intervals)

Probability of each transition from an interval to another.

References

[R30]Florian Krebs, Sebastian Böck and Gerhard Widmer, “An Efficient State Space Model for Joint Tempo and Meter Tracking”, Proceedings of the 16th International Society for Music Information Retrieval Conference (ISMIR), 2015.
class madmom.features.beats_hmm.BeatTransitionModel(state_space, transition_lambda)[source]

Transition model for beat tracking with a HMM.

Within the beat the tempo stays the same; at beat boundaries transitions from one tempo (i.e. interval) to another following an exponential distribution are allowed.

Parameters:

state_space : BeatStateSpace instance

BeatStateSpace instance.

transition_lambda : float

Lambda for the exponential tempo change distribution (higher values prefer a constant tempo from one beat to the next one).

References

[R31]Florian Krebs, Sebastian Böck and Gerhard Widmer, “An Efficient State Space Model for Joint Tempo and Meter Tracking”, Proceedings of the 16th International Society for Music Information Retrieval Conference (ISMIR), 2015.
class madmom.features.beats_hmm.BarTransitionModel(state_space, transition_lambda)[source]

Transition model for bar tracking with a HMM.

Within the beats of the bar the tempo stays the same; at beat boundaries transitions from one tempo (i.e. interval) to another following an exponential distribution are allowed.

Parameters:

state_space : BarStateSpace instance

BarStateSpace instance.

transition_lambda : float or list

Lambda for the exponential tempo change distribution (higher values prefer a constant tempo from one beat to the next one). None can be used to set the tempo change probability to 0. If a list is given, the individual values represent the lambdas for each transition into the beat at this index position.

Notes

Bars performing tempo changes only at bar boundaries (and not at the beat boundaries) must have set all but the first transition_lambda values to None, e.g. [100, None, None] for a bar with 3 beats.

References

[R32]Florian Krebs, Sebastian Böck and Gerhard Widmer, “An Efficient State Space Model for Joint Tempo and Meter Tracking”, Proceedings of the 16th International Society for Music Information Retrieval Conference (ISMIR), 2015.
class madmom.features.beats_hmm.MultiPatternTransitionModel(transition_models, transition_prob=None, transition_lambda=None)[source]

Transition model for pattern tracking with a HMM.

Parameters:

transition_models : list

List with TransitionModel instances.

transition_prob : numpy array, optional

Matrix with transition probabilities from one pattern to another.

transition_lambda : float, optional

Lambda for the exponential tempo change distribution (higher values prefer a constant tempo from one pattern to the next one).

Notes

Right now, no transitions from one pattern to another are allowed.

class madmom.features.beats_hmm.RNNBeatTrackingObservationModel(state_space, observation_lambda)[source]

Observation model for beat tracking with a HMM.

Parameters:

state_space : BeatStateSpace instance

BeatStateSpace instance.

observation_lambda : int

Split one beat period into observation_lambda parts, the first representing beat states and the remaining non-beat states.

References

[R33]Sebastian Böck, Florian Krebs and Gerhard Widmer, “A Multi-Model Approach to Beat Tracking Considering Heterogeneous Music Styles”, Proceedings of the 15th International Society for Music Information Retrieval Conference (ISMIR), 2014.
log_densities(observations)[source]

Computes the log densities of the observations.

Parameters:

observations : numpy array

Observations (i.e. activations of the RNN).

Returns:

numpy array

Log densities of the observations.

class madmom.features.beats_hmm.GMMPatternTrackingObservationModel(pattern_files, state_space)[source]

Observation model for GMM based beat tracking with a HMM.

Parameters:

pattern_files : list

List with files representing the rhythmic patterns, one entry per pattern; each pattern being a list with fitted GMMs.

state_space : MultiPatternStateSpeac instance

Multi pattern state space.

References

[R34]Florian Krebs, Sebastian Böck and Gerhard Widmer, “Rhythmic Pattern Modeling for Beat and Downbeat Tracking in Musical Audio”, Proceedings of the 14th International Society for Music Information Retrieval Conference (ISMIR), 2013.
log_densities(observations)[source]

Computes the log densities of the observations using (a) GMM(s).

Parameters:

observations : numpy array

Observations (i.e. multiband spectral flux features).

Returns:

numpy array

Log densities of the observations.