libdrmconf
0.11.3
A library to program DMR radios.
|
Encodes a note, that is tone and duration. More...
#include <melody.hh>
Public Types | |
enum class | Tone { Rest , C , Cis , D , Dis , E , F , Fis , G , Gis , A , Ais , B } |
Possible tone values. | |
enum class | Duration { Whole , Half , Quarter , Eighth , Sixteenth } |
Note durations as fractions of a bar. | |
Public Member Functions | |
Note () | |
Default constructor. More... | |
bool | fromLilypond (const QString ¬e, Duration currentDuration) |
Reads a note in Lilypond notation. | |
QString | toLilypond (Duration currentDuration) const |
Serializes the note in Lilypond notation. | |
QPair< double, unsigned int > | toTone (unsigned int bpm) const |
Converts the note to a frequency in Hz and duration in seconds. | |
unsigned int | infer (double frequency, unsigned int ms, unsigned int bpm) |
Infers the note from the given frequency and duration in ms. More... | |
Static Public Member Functions | |
static unsigned int | quantizationTimingError (unsigned int ms, unsigned int bpm) |
Computes the quantization timing error for the given duration and BPM. | |
Public Attributes | |
Tone | tone |
The note tone. | |
Duration | duration |
The note duration. | |
bool | dotted |
If true , the note/rest is dottet. | |
int | octave |
The octave of the note, 0 means middle. | |
Encodes a note, that is tone and duration.
Melody::Note::Note | ( | ) |
Default constructor.
A middle C quarter note.
unsigned int Melody::Note::infer | ( | double | frequency, |
unsigned int | ms, | ||
unsigned int | bpm | ||
) |
Infers the note from the given frequency and duration in ms.
This is guesswork, consequently there will be some issues. The function updates the note and returns the timing error in ms.