Package jazzparser :: Package misc :: Package raphsto
[hide private]
[frames] | no frames]

Package raphsto

source code

Raphael and Stoddard's model for chord labelling from midi data.

An implementation of the models described in Function Harmonic Analysis Using Probabilistic Models, Raphael and Stoddard, 2004.

In the future, this should be fitted into the tagger framework. For now it's just a rough prototype, so I'm not bothering to work out how it will implement the tagger interface, etc.


Author: Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>

Submodules [hide private]

Classes [hide private]
  RaphstoHmm
Hidden Markov Model that implements the model described in the paper.
  RaphstoHmmThreeChord
Modification of the Raphsto algorithm that allows it only to assign one of three chords: I, IV and V.
  RaphstoHmmFourChord
Like RaphstoHmmThreeChord, but also allows a minor secondary dominant chord (II).
  RaphstoHmmUnigram
Like RaphstoHmm, but always gives all state transitions equal probability, so that it is effectively a unigram model.
  RaphstoHmmError
  RaphstoHmmParameterError
  RaphstoModelLoadError
  RaphstoModelSaveError
Functions [hide private]
 
format_state(state, time=None)
Formats a state label tuple as a string for output.
source code
 
format_state_as_chord(state, time=None)
Formats a state label tuple, like format_state, but produces a chord name.
source code
 
format_state_as_raphsto(state, time=None)
State representation modeled on the original R&S model's labels that are inserted into the example MIDI files.
source code
 
states_to_key_transition(state, previous_state)
Takes a state and previous state representation and returns the (state, previous state) pair that is used by the model.
source code
 
raphsto_d(pitch_class, state)
The function described in the paper as d.
source code
Variables [hide private]
  FILE_EXTENSION = 'mdl'
  MODEL_TYPES = {'four-chord': <class 'jazzparser.misc.raphsto.R...
  __package__ = 'jazzparser.misc.raphsto'
Function Details [hide private]

format_state_as_chord(state, time=None)

source code 

Formats a state label tuple, like format_state, but produces a chord name. This contains less information than the result of format_state, but is easier to read.

states_to_key_transition(state, previous_state)

source code 

Takes a state and previous state representation and returns the (state, previous state) pair that is used by the model. This mapping effectively implements the parameter tying of the first part of the transition distribution.

raphsto_d(pitch_class, state)

source code 

The function described in the paper as d. Maps a pitch class to an abstract representation that depends on the state.

This gets called a bajillion times, so needs to be as efficient as possible.


Variables Details [hide private]

MODEL_TYPES

Value:
{'four-chord': <class 'jazzparser.misc.raphsto.RaphstoHmmFourChord'>,
 'standard': <class 'jazzparser.misc.raphsto.RaphstoHmm'>,
 'three-chord': <class 'jazzparser.misc.raphsto.RaphstoHmmThreeChord'>\
,
 'unigram': <class 'jazzparser.misc.raphsto.RaphstoHmmUnigram'>}