Generate an accompaniement for a given melody
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HMM Class Referenceabstract

Unified interface for HMMs, independant of the observation type. More...

#include <Markov.hpp>

Inheritance diagram for HMM:
HMM_backend< Obs >

Public Types

using Proba = double
 Return a list of chord progressions with scores. More...
 
using ObsId = unsigned
 
using StateId = unsigned
 
using Score = double
 

Public Member Functions

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

Friends

HMMloadFromFile (std::string fname)
 Load the HMM from a given file. More...
 

Detailed Description

Unified interface for HMMs, independant of the observation type.

Member Typedef Documentation

using HMM::Proba = double

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
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.

Member Function Documentation

virtual std::vector<std::pair<ChordProgression,Score> > HMM::getBestProgressions ( Melody  M,
unsigned  n = 1 
) const
pure 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.

Implemented in HMM_backend< Obs >.

virtual unsigned HMM::getMaxProgressionsNbr ( ) const
pure virtual

Return the maximal number of distinct progressions that can be generated

Returns
a non negative integer, the maximal number of progressions

Implemented in HMM_backend< Obs >.

virtual void HMM::saveToFile ( const std::string &  fname) const
pure virtual

Save the class to a given file.

Parameters
fnameName of the target file

Implemented in HMM_backend< Obs >.

Friends And Related Function Documentation

HMM* loadFromFile ( std::string  fname)
friend

Load the HMM from a given file.

Be careful, this function erase all the existing data of the class

Parameters
fnameName of the file

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