Classes | Functions | Variables

/Users/garethloy/Musimathics/Musimat1.2/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 ( 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.

{
        Rhythm(y);
        Return y.absDuration();
}
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.

{
        Return y.absDuration();
}
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.

{
        Rhythm(y);
        Return y.duration();
}
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.

{
        Return y.absDuration();
}
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 Rhythm::absDuration(), and Return.

{
        Return( 1.0 / (4.0 * B.absDuration()) * 60.0 / T );
}
Void SetTempoScale ( Real  ts )

Set the tempo used by all instances of Rhythm.

Definition at line 27 of file Rhythm.cpp.

References Rhythm::tempo().

{
        Rhythm::tempo(ts);
}