matchmaker.prob

class matchmaker.prob.hmm.PitchIOIHMM(reference_features: ndarray, queue: RECVQueue | None = None, tempo_model: TempoModel = None, transition_model: TransitionModel | None = None, observation_model: PitchIOIObservationModel | None = None, transition_matrix: ndarray[Any, dtype[float32]] | None = None, pitch_obs_prob_func: Callable[[...], ndarray[Any, dtype[float32]]] | None = None, ioi_obs_prob_func: Callable[[...], ndarray[Any, dtype[float32]]] | None = None, ioi_matrix: ndarray[Any, dtype[float32]] | None = None, pitch_prob_args: Dict[str, Any] | None = None, ioi_prob_args: Dict[str, Any] | None = None, initial_probabilities: ndarray | None = None, has_insertions: bool = False, piano_range: bool = False, **kwargs)[source]

Bases: BaseHMM

Implements the behavior of a HiddenMarkovModel, specifically designed for the task of score following.

Parameters

_transition_matrixnumpy.ndarray

Matrix for computations of state transitions within the HMM.

_observation_modelObservationModel

Object responsible for computing the observation probabilities for each state of the HMM.

initial_distributionnumpy array

The initial distribution of the model. If not given, it is assumed to be uniform.

forward_variablenumpy array

The current (latest) value of the forward variable.

_variation_coefffloat

The normalized coefficient of variation of the current (latest) forward variable. Used to determine the confidence of the prediction of the HMM.

current_stateint

The index of the current state of the HMM.

__init__(reference_features: ndarray, queue: RECVQueue | None = None, tempo_model: TempoModel = None, transition_model: TransitionModel | None = None, observation_model: PitchIOIObservationModel | None = None, transition_matrix: ndarray[Any, dtype[float32]] | None = None, pitch_obs_prob_func: Callable[[...], ndarray[Any, dtype[float32]]] | None = None, ioi_obs_prob_func: Callable[[...], ndarray[Any, dtype[float32]]] | None = None, ioi_matrix: ndarray[Any, dtype[float32]] | None = None, pitch_prob_args: Dict[str, Any] | None = None, ioi_prob_args: Dict[str, Any] | None = None, initial_probabilities: ndarray | None = None, has_insertions: bool = False, piano_range: bool = False, **kwargs) None[source]

Initialize the object.

Parameters

transition_matrixnumpy array

The Tranistion probability matrix of HMM.

pitch_profilesnumpy array

The pre-computed pitch profiles, for each separate possible pitch in the MIDI range. Used in calculating the pitch observation probabilities.

ioi_matrixnumpy array

The pre-computed score IOI values in beats, from each unique state to all other states, stored in a matrix.

ioi_precisionfloat

The precision parameter for computing the IOI observation probability.

score_onsetsnumpy array

TODO

initial_distributionnumpy array

The initial distribution of the model. If not given, it is asumed to be uniform. Default = None.

run(verbose: bool = True) Generator[float, None, ndarray[Any, dtype[_ScalarType_co]]]

Drive the score follower from self.queue.

Pulls (features, perf_time) items from self.queue, calls self(item) per step, and yields the current beat each step. The final return value is the alignment path.

Parameters

verbosebool, optional

Whether to print a progress bar.

Returns

(yield) beatfloat

The current beat.

(return) alignment_pathNDArray

The alignment path.