Generate an accompaniement for a given melody
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HMM_backend< Obs > Class Template Reference

Backend for a Hidden Markov Model object, templated over the observation type. More...

#include <Markov.hpp>

Inheritance diagram for HMM_backend< Obs >:
HMM

Classes

class  State
 

Public Member Functions

std::vector< std::pair
< ChordProgression, Score > > 
getBestProgressions (Melody M, unsigned n=1) const
 Return a list of chord progressions with scores. More...
 
unsigned getMaxProgressionsNbr () const
 
void saveToFile (const std::string &fname) const
 Save the class to a given file. More...
 
void learn (Database &db, const std::string &style)
 
void learn_unsupervised (Database &db, const std::string &style)
 

Protected Member Functions

void forwardProcedure (const std::vector< Obs > &o)
 
void backwardProcedure (const std::vector< Obs > &o)
 
void updateProcedure (const std::vector< Obs > &o)
 
void generateObsSet (const std::vector< Data > &entries)
 

Additional Inherited Members

- Public Types inherited from HMM
using Proba = double
 Return a list of chord progressions with scores. More...
 
using ObsId = unsigned
 
using StateId = unsigned
 
using Score = double
 

Detailed Description

template<class Obs>
class HMM_backend< Obs >

Backend for a Hidden Markov Model object, templated over the observation type.

The parameter of the template correspond to the Observation type. We can imagine several ways to describe these, for example with meta datas rather than plain music description

Member Function Documentation

template<class Obs >
std::vector<std::pair<ChordProgression,Score> > HMM_backend< Obs >::getBestProgressions ( Melody  M,
unsigned  n = 1 
) const
virtual

Return a list of chord progressions with scores.

Scores are non negative. It is guaranted that at least one progression has a score different than 0.

Parameters
MObserved melody from which we want to generate chords
nNumber of chord progressions wanted (n > 0 )
Exceptions
std::domain_errorIf the number of chords requested is higher than what can be generated, an exception is thrown
Returns
A list of n chord progressions, along with their scores, in decreasing order.

Implements HMM.

template<class Obs >
unsigned HMM_backend< Obs >::getMaxProgressionsNbr ( ) const
virtual

Return the maximal number of distinct progressions that can be generated

Returns
a non negative integer, the maximal number of progressions

Implements HMM.

template<class Obs >
void HMM_backend< Obs >::saveToFile ( const std::string &  fname) const
virtual

Save the class to a given file.

Parameters
fnameName of the target file

Implements HMM.


The documentation for this class was generated from the following file: