Generate an accompaniement for a given melody
|
Describes a melody. More...
#include <Music.hpp>
Public Types | |
using | ConstIterator = std::vector< Measure >::const_iterator |
Allows to iterate on the measures of the Melody. | |
Public Member Functions | |
Melody (const std::vector< Measure > &v, Key k, unsigned tempo=120) | |
Constructor with initializations. More... | |
Melody (const Key &k=Key(NoteName::C)) | |
Creates an empty melody. | |
std::vector< Measure > | convertToMeasures () const __attribute__((pure)) |
Returns the measures of the melody. More... | |
const Key & | getKey () const __attribute__((pure)) |
ConstIterator | begin () const __attribute__((pure)) |
Returns a measure iterator at the beginning of the Melody. More... | |
ConstIterator | end () const __attribute__((pure)) |
Returns a measure iterator at the end of the Melody. More... | |
unsigned | size () const |
Returns The number of measures in the Melody. More... | |
Melody | transpose (const Key &k) const |
Transpose a melody into a given key. More... | |
bool | isBinary () const |
returns if the melody is binary (looks at first measure) More... | |
bool | operator== (const Melody &o) const __attribute__((pure)) |
Equality operator for Melody. More... | |
bool | operator!= (const Melody &o) const __attribute__((pure)) |
Inequality operator for Melody. More... | |
std::ostream & | createABCChordFile (std::ostream &out, const ChordProgression &chords) const |
Adds a Chord Progression to a file. More... | |
Public Attributes | |
unsigned | m_BPM |
Describes a melody.
A melody is simply a set of bars. Invariants such as key may be checked (although they are by no means required) Carefull : If some notes of the key are sharp, you still need to put Accidental::Sharp in these notes.
Constructor with initializations.
v | The vector of measures composing the melody |
k | The key of the melody |
ConstIterator Melody::begin | ( | ) | const |
Returns a measure iterator at the beginning of the Melody.
std::vector<Measure> Melody::convertToMeasures | ( | ) | const |
Returns the measures of the melody.
std::ostream& Melody::createABCChordFile | ( | std::ostream & | out, |
const ChordProgression & | chords | ||
) | const |
Adds a Chord Progression to a file.
out | is the stream to write the ChordProgression to |
chords | is the ChordProgression to add |
ConstIterator Melody::end | ( | ) | const |
Returns a measure iterator at the end of the Melody.
const Key& Melody::getKey | ( | ) | const |
Returns the key of the melody
bool Melody::isBinary | ( | ) | const |
returns if the melody is binary (looks at first measure)
runtime_error("Unknown"); |
unsigned Melody::size | ( | ) | const |
Transpose a melody into a given key.
k | The target key |