- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/Musimathics_local/Musimat/include/Rhythm.h File Reference

Rhythm class. More...

`#include "Musimat.h"`
`#include <iostream>`

Go to the source code of this file.

## Classes
class | Rhythm
| Rhythm class implements standard methods and data structures to manipulate musical rhythm arithmetically. More...
## Functions
Real | metronome (Rhythm B, Real T)
| Calculate the tempo coefficient corresponding to some rhythmic duration B at some tempo T.
Real | Duration (Real x)
| Calculate the actual duration of a Real with the implicit tempo scale applied, as a fraction of a whole note.
Real | Duration (Rhythm x)
| Calculate the actual duration of a Rhythm with the implicit tempo scale applied, as a fraction of a whole note.
Real | AbsDuration (Real x)
| Calculate the absolute duration of a Real without the implicit tempo scale applied, as a fraction of a whole note.
Real | AbsDuration (Rhythm x)
| Calculate the absolute duration of a Rhythm without the implicit tempo scale applied, as a fraction of a whole note.
Void | SetTempoScale (Real ts)
| Set the tempo used by all instances of Rhythm.
## Variables
Rhythm | Whole
| Duration of a whole note.
Rhythm | Half
| Duration of a half note.
Rhythm | Quarter
| Duration of a quarter note.
Rhythm | Eighth
| Duration of a eighth note.
Rhythm | Sixteenth
| < Duration of a sixteenth note

## Detailed Description

Rhythm class.

Definition in file Rhythm.h.

## Function Documentation

Real AbsDuration | ( | Rhythm | x | ) |

Calculate the absolute duration of a Rhythm without the implicit tempo scale applied, as a fraction of a whole note.

Definition at line 60 of file Rhythm.cpp.

References Rhythm::absDuration(), and Return.

    00061 {
    00062         Return y.absDuration();
    00063 }

Real AbsDuration | ( | Real | x | ) |

Calculate the absolute duration of a Real without the implicit tempo scale applied, as a fraction of a whole note.

Definition at line 49 of file Rhythm.cpp.

References Return.

    00050 {
    00051         Rhythm(y);
    00052         Return y.absDuration();
    00053 }

Real Duration | ( | Rhythm | x | ) |

Calculate the actual duration of a Rhythm with the implicit tempo scale applied, as a fraction of a whole note.

Definition at line 55 of file Rhythm.cpp.

References Rhythm::absDuration(), and Return.

    00056 {
    00057         Return y.absDuration();
    00058 }

Real Duration | ( | Real | x | ) |

Calculate the actual duration of a Real with the implicit tempo scale applied, as a fraction of a whole note.

For example, SetTempoScale( 0.5 ); Print( Duration( 1.0/4.0 ) ); prints 0.125.

Definition at line 37 of file Rhythm.cpp.

References Return.

    00038 {
    00039         Rhythm(y);
    00040         Return y.duration();
    00041 }

Real metronome | ( | Rhythm | B,
|  | Real | T |
| ) |  |  |

Calculate the tempo coefficient corresponding to some rhythmic duration B at some tempo T.

B can be expressed as a ratio of reals, e.g., 1.0/4.0 for a quarternote. The expression metronome( 1.0/4.0, 60.0 ) returns the tempo coefficient for "quarter note gets the beat and there are sixty beats per minute". Hence, it returns 1.0.

Definition at line 32 of file Rhythm.cpp.

References B, and Return.

    00033 {
    00034         Return( 1.0 / (4.0 * B.absDuration()) * 60.0 / T );
    00035 }

Void SetTempoScale | ( | Real | ts | ) |

Set the tempo used by all instances of Rhythm.

Definition at line 27 of file Rhythm.cpp.

References Rhythm::tempo().

    00028 {
    00029         Rhythm::tempo(ts);
    00030 }